Permalink
Browse files

MDL-41788 theme_bootstrapbase: Custom menus - sub-menus breaking.

  • Loading branch information...
1 parent 8703e65 commit 997731210cc0ce95c47fdea057e878fd4fea5a00 @gjb2048 gjb2048 committed Dec 19, 2013
@@ -176,10 +176,9 @@ img.icon-pre {
}
// Extends bootstrapbase/less/bootstrap/navbar.less
-// to enable scroll in longer menus especially language menu.
-
-.open > .dropdown-menu {
+// to enable scroll in the language menu.
+.langmenu.open > .dropdown-menu {
display: block;
- max-height: 500px;
+ max-height: 150px;
overflow-y: auto;
}
@@ -24,6 +24,9 @@
class theme_bootstrapbase_core_renderer extends core_renderer {
+ /** @var custom_menu_item language The language menu if created */
+ protected $language = null;
+
/*
* This renders a notification message.
* Uses bootstrap compatible html.
@@ -102,9 +105,9 @@ protected function render_custom_menu(custom_menu $menu) {
}
if ($addlangmenu) {
- $language = $menu->add(get_string('language'), new moodle_url('#'), get_string('language'), 10000);
+ $this->language = $menu->add(get_string('language'), new moodle_url('#'), get_string('language'), 10000);
foreach ($langs as $langtype => $langname) {
- $language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
+ $this->language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
}
}
@@ -126,12 +129,15 @@ protected function render_custom_menu_item(custom_menu_item $menunode, $level =
if ($menunode->has_children()) {
if ($level == 1) {
- $dropdowntype = 'dropdown';
+ $class = 'dropdown';
} else {
- $dropdowntype = 'dropdown-submenu';
+ $class = 'dropdown-submenu';
}
- $content = html_writer::start_tag('li', array('class'=>$dropdowntype));
+ if ($menunode === $this->language) {
+ $class .= ' langmenu';
+ }
+ $content = html_writer::start_tag('li', array('class' => $class));
// If the child has menus render it as a sub menu.
$submenucount++;
if ($menunode->get_url() !== null) {
Oops, something went wrong.

0 comments on commit 9977312

Please sign in to comment.