Difference between revisions of "MediaWiki:Menu.rythm"
Jump to navigation
Jump to search
Line 14: | Line 14: | ||
String homeUrl_de; | String homeUrl_de; | ||
String iconUrl; | String iconUrl; | ||
+ | Map<String,MenuItem> menuItemMap=new LinkedHashMap<String,MenuItem(); | ||
public Menu(String homeUrl_en,String homeUrl_de,String iconUrl) { | public Menu(String homeUrl_en,String homeUrl_de,String iconUrl) { | ||
Line 19: | Line 20: | ||
this.homeUrl_de=homeUrl_de; | this.homeUrl_de=homeUrl_de; | ||
this.iconUrl=iconUrl; | this.iconUrl=iconUrl; | ||
+ | } | ||
+ | |||
+ | public void addMenuItem(MenuItem menuItem) { | ||
+ | menuItemMap.put(menuItem.id,menuItem); | ||
+ | } | ||
+ | |||
+ | public MenuItem getMenuItem(String menuItemId) { | ||
+ | MenuItem menuItem=menuItemMap.get(menuItemId); | ||
+ | return menuItem; | ||
+ | } | ||
+ | |||
+ | public Collection<MenuItem> getMenuItems() { | ||
+ | return MenuItemMap.values(); | ||
} | } | ||
} | } | ||
class MenuItem { | class MenuItem { | ||
+ | String id; | ||
+ | String text_de; | ||
+ | String text_en; | ||
+ | String url_en; | ||
+ | String url_de; | ||
+ | public MenuItem(String id,String text_en,String url_en, String text_de,String url_de) { | ||
+ | this.id=id; | ||
+ | this.text_en=text_en; | ||
+ | this.text_de=text_de; | ||
+ | this.url_en=url_en; | ||
+ | this.url_de=url_de; | ||
+ | } | ||
} | } | ||
} | } |
Revision as of 09:40, 9 November 2017
Links
- MediaWiki:Bootstrap.rythm
- MediaWiki:Form.rythm
- https://www.w3schools.com/bootstrap/bootstrap_ref_comp_glyphs.asp
Rythm template source
@// Rythm template for Bootstrap menu
@// field definitions
@def static {
// a menu
class Menu {
String homeUrl_en;
String homeUrl_de;
String iconUrl;
Map<String,MenuItem> menuItemMap=new LinkedHashMap<String,MenuItem();
public Menu(String homeUrl_en,String homeUrl_de,String iconUrl) {
this.homeUrl_en=homeUrl_en;
this.homeUrl_de=homeUrl_de;
this.iconUrl=iconUrl;
}
public void addMenuItem(MenuItem menuItem) {
menuItemMap.put(menuItem.id,menuItem);
}
public MenuItem getMenuItem(String menuItemId) {
MenuItem menuItem=menuItemMap.get(menuItemId);
return menuItem;
}
public Collection<MenuItem> getMenuItems() {
return MenuItemMap.values();
}
}
class MenuItem {
String id;
String text_de;
String text_en;
String url_en;
String url_de;
public MenuItem(String id,String text_en,String url_en, String text_de,String url_de) {
this.id=id;
this.text_en=text_en;
this.text_de=text_de;
this.url_en=url_en;
this.url_de=url_de;
}
}
}
@def showMenu(boolean de,Menu menu) {
<nav class="navbar">
<div class="container">
<div class="navbar-header">
<button type="button">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href='@(de?menu.homeUrl_de:menu.homeUrl_en)'>
<img src='@(menu.iconUrl)' style="max-height:7vh; margin-top: -2vh;" >
</a>
</div>
</div>
</nav>
}