From b1249bdc4225ad06968b87dd863177ce704b3d1e Mon Sep 17 00:00:00 2001 From: Alexander Bias Date: Sat, 30 Mar 2024 21:48:05 +0100 Subject: [PATCH] Review changes --- CHANGES.md | 1 + classes/output/navigation/primary.php | 9 +++++++++ scss/boost_union/post.scss | 13 ------------- ...menusettings_menuitems_presentation.feature | 18 ++++++++++++++++++ 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 9bd6d726144..c08a2d1b360 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ Changes ### Unreleased +* 2024-03-30 - Bugfix: Smart menu divider did not work for user menu submenus, resolves #537. * 2024-03-25 - Backport: Boost Union settings were moved to an admin settings category of its own to support the new theme chooser on Moodle 4.4, resolves #482. This change was backported to this Moodle major version. * 2024-03-22 - Backport: Align the before_standard_html_head() function with the new hook callback on Moodle 4.4, resolves #604. diff --git a/classes/output/navigation/primary.php b/classes/output/navigation/primary.php index 1f8021a7a0c..ded227a4396 100644 --- a/classes/output/navigation/primary.php +++ b/classes/output/navigation/primary.php @@ -186,6 +186,15 @@ public function get_user_menu(renderer_base $output): array { foreach ($parentoutput['submenus'] as $sm) { // Search the 'Language' submenu. if ($sm->title == $needle) { + // Create and inject a divider node. + $dividernode = [ + 'title' => '####', + 'itemtype' => 'divider', + 'divider' => 1, + 'link' => '', + ]; + $sm->items[] = $dividernode; + // Create and inject the 'Set preferred language' link. $spfnode = [ 'title' => get_string('setpreferredlanglink', 'theme_boost_union'), diff --git a/scss/boost_union/post.scss b/scss/boost_union/post.scss index 1e69f7dde9a..9afef8a98cb 100644 --- a/scss/boost_union/post.scss +++ b/scss/boost_union/post.scss @@ -467,19 +467,6 @@ body.hascourseindexcplsol.editing { padding: .25rem 1.75rem .25rem .75rem; } -/*--------------------------------------- - * Setting: Add preferred language link to language menu. - --------------------------------------*/ - -/* Add a bottom-top to the 'Set preferred language' link. - This could be rebuilt as soon as https://github.com/moodle-an-hochschulen/moodle-theme_boost_union/issues/537 - is solved. */ -#user-action-menu .carousel-item.submenu a[href$="user/language.php"] { - border-top: 1px solid $dropdown-divider-bg; - margin-top: 0.5rem; - padding-top: 0.5rem; -} - /*--------------------------------------- * Setting: Show starred courses popover in the navbar. --------------------------------------*/ diff --git a/tests/behat/theme_boost_union_smartmenusettings_menuitems_presentation.feature b/tests/behat/theme_boost_union_smartmenusettings_menuitems_presentation.feature index c6f2ccb50a1..9bec724035e 100644 --- a/tests/behat/theme_boost_union_smartmenusettings_menuitems_presentation.feature +++ b/tests/behat/theme_boost_union_smartmenusettings_menuitems_presentation.feature @@ -331,3 +331,21 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app And I am on site homepage Then I should see smart menu "Quick links" item "Dolor sit amet" in location "Main, Menu, User, Bottom" And I should not see smart menu "Quick links" item "Lorem ipsum" in location "Main, Menu, User, Bottom" + + @javascript + Scenario: Smartmenus: Menu items: Presentation - Use a divider as static menu item + When I log in as "admin" + And I navigate to smart menu "Quick links" items + And I click on "Add menu item" "button" + And I set the following fields to these values: + | Menu item type | Heading | + | Title | ### | + And I click on "Save changes" "button" + # Divider in main navigation. + And ".dropdown-divider" "css_element" should exist in the ".primary-navigation" "css_element" + # Divider in user menu. + And ".dropdown-divider" "css_element" should exist in the "#usermenu-carousel" "css_element" + # Divider in bottom menu. + And ".dropdown-divider" "css_element" should exist in the ".bottom-navigation" "css_element" + # Divider in menubar. + And ".dropdown-divider" "css_element" should exist in the "nav.menubar" "css_element"