Skip to content

Commit ce84ed8

Browse files
committed
Merge commit 'cdff40ecd3e75ad77f8767466a71cf6a35126b64' into css_snippets
2 parents 234f4f3 + cdff40e commit ce84ed8

16 files changed

+158
-33
lines changed

CHANGES.md

+13-3
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,23 @@ moodle-theme_boost_union
44
Changes
55
-------
66

7-
### Unreleased
7+
### v4.5-r8
8+
9+
* 2025-02-17 - Bugfix: Remove the possibility to set the activity purpose for subsections to avoid that activities within subsections get tinted with the wrong color, resolves #823.
10+
* 2025-02-12 - Bugfix: Accessibility page link in description differed from real location, resolves #818.
11+
12+
### v4.5-r7
13+
14+
* 2025-02-11 - Bugfix: Using smart menus together with custom menus broke Moodle, resolves #814, regression of #602.
15+
* 2025-02-10 - Bugfix: Adopt accessibility changes from MDL-67683 which led to Boost Union Behat failures on Moodle core 4.5.2 and 4.4.6, resolves #813.
16+
Please note: This change raises Boost Union's required Moodle core version to 4.5.2.
17+
18+
### v4.5-r6
819

920
* 2025-02-04 - Feature: Add first version of CSS snippets feature, credits go to all members of the MoodleMootDACH dev camp team 22.
1021
* 2025-02-04 - Improvement: Hide the 'Menu item mode' settings for smart menu items which are not of the 'dynamic courses' item type, resolves #804.
1122
* 2025-02-04 - Bugfix: Smart menu 3rd level submenus were being cut-off in responsive / mobile view, resolves #356.
12-
Please note: This is a comparably large visual change which effectively replaces the presentation of a 3rd level smart menu (which can only be realized with dynamic courses menu items up to now). flyout menus in the main navigation area and the menu bar area with the 'sliding door' submenu behaviour which has been used in the user menu only up to now.
13-
Please test your particular
23+
Please note: This is a comparably large visual change which effectively replaces the presentation of a 3rd level smart menu (which can only be realized with dynamic courses menu items up to now). Flyout menus in the main navigation area and the menu bar area have been replaced with the 'sliding door' submenu behaviour which has been used in the user menu only up to now. If you are using dynamic courses menu items, please test your particular smart menu setup before updating to this Boost Union release.
1424
* 2025-02-04 - Bugfix: Smart menu 3rd level submenus had a font color which differed from the 2nd level and might have been even invisible, resolves #459.
1525
* 2025-02-04 - Bugfix: Long smart menus were not scrollable vertically, resolves #406.
1626
* 2025-02-04 - Bugfix: Fix smart menu dynamic course items not updating properly based on course role assignments, resolves #749.

classes/output/core_renderer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ public function block(block_contents $bc, $region) {
530530
$context->skiptitle = strip_tags($bc->title);
531531
$context->showskiplink = !empty($context->skiptitle);
532532
$context->arialabel = $bc->arialabel;
533-
$context->ariarole = !empty($bc->attributes['role']) ? $bc->attributes['role'] : 'complementary';
533+
$context->ariarole = !empty($bc->attributes['role']) ? $bc->attributes['role'] : '';
534534
$context->class = $bc->attributes['class'];
535535
$context->type = $bc->attributes['data-block'];
536536
$context->title = $bc->title;

classes/output/navigation/primary.php

+12-2
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,9 @@ public function build_usermenus(&$usermenu, $menus, $forusermenu = true) {
355355
*/
356356
protected function convert_submenus($menus) {
357357

358-
// Verify the empty entries.
358+
// If the given menu is empty for whatever reason.
359359
if (empty($menus)) {
360+
// Return the menu directly.
360361
return $menus;
361362
}
362363

@@ -366,10 +367,19 @@ protected function convert_submenus($menus) {
366367
return clone (object) $item;
367368
}, $menus);
368369

370+
// Iterate over the primary menu items.
369371
foreach ($primarymenu as $key => $parentmenu) {
370372

371-
// Menu doesn't contain any children menus, continue to the next menu.
373+
// The given menu is not a smart menu (but most probably a Moodle core main navigation item or a custom menu).
374+
if (!property_exists($parentmenu, 'menudata')) {
375+
// We must not convert this menu unless we want to break Moodle completely.
376+
// Continue to the next menu.
377+
continue;
378+
}
379+
380+
// The given menu doesn't contain any children menus or is card menu.
372381
if (!$parentmenu->haschildren || $parentmenu->card) {
382+
// Continue to the next menu.
373383
continue;
374384
}
375385

db/upgrade.php

+9
Original file line numberDiff line numberDiff line change
@@ -540,5 +540,14 @@ function xmldb_theme_boost_union_upgrade($oldversion) {
540540
snippets::add_builtin_snippets();
541541
}
542542

543+
if ($oldversion < 2024100716) {
544+
545+
// Remove the activitypurposesubsection setting from Boost Union.
546+
unset_config('activitypurposesubsection', 'theme_boost_union');
547+
548+
// Boost_union savepoint reached.
549+
upgrade_plugin_savepoint(true, 2024100716, 'theme', 'boost_union');
550+
}
551+
543552
return true;
544553
}

lib.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ function theme_boost_union_get_pre_scss($theme) {
214214
// Instead, we must only add additionally CSS code which is based on any Boost Union-only functionality.
215215

216216
// But, well, there is one exception: Boost Union Child themes.
217-
// Due to the described call chain, Boost Union Child won't get all the necessary extra SCSS.
218-
// Thus, we fetch Boost's extra SCSS if the current theme is not Union itself (i.e. a Boost Union Child theme is active).
217+
// Due to the described call chain, Boost Union Child won't get all the necessary pre SCSS.
218+
// Thus, we fetch Boost's pre SCSS if the current theme is not Union itself (i.e. a Boost Union Child theme is active).
219219
if (theme_boost_union_is_active_childtheme() == true) {
220220
$scss .= theme_boost_get_pre_scss(\core\output\theme_config::load('boost_union'));
221221
}

settings.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,12 @@
624624
$installedactivities = get_module_types_names();
625625
// Iterate over all existing activities.
626626
foreach ($installedactivities as $modname => $modinfo) {
627+
// If this is the subsection activity type which must not be tinted itself.
628+
if ($modname == 'subsection') {
629+
// Skip it.
630+
continue;
631+
}
632+
627633
// Get default purpose of activity module.
628634
$defaultpurpose = plugin_supports('mod', $modname, FEATURE_MOD_PURPOSE, MOD_PURPOSE_OTHER);
629635
// If the plugin does not have any default purpose.
@@ -2879,7 +2885,7 @@
28792885
// Setting: Declaration of accessibility page link position.
28802886
$name = 'theme_boost_union/accessibilitydeclarationlinkposition';
28812887
$title = get_string('accessibilitydeclarationlinkpositionsetting', 'theme_boost_union', null, true);
2882-
$pageurl = theme_boost_union_get_staticpage_link('accessibility');
2888+
$pageurl = theme_boost_union_get_accessibility_link('declaration');
28832889
$description = get_string('accessibilitydeclarationlinkpositionsetting_desc', 'theme_boost_union', ['url' => $pageurl],
28842890
true);
28852891
$linkpositionoption =

templates/theme_boost/columns2.mustache

+4-4
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
<div> {{{ regionmainsettingsmenu }}} </div>
8787
</div>
8888
{{/hasregionmainsettingsmenu}}
89-
<section id="region-main" {{#hasblocks}}class="has-blocks mb-3"{{/hasblocks}} aria-label="{{#str}}content{{/str}}">
89+
<div id="region-main" {{#hasblocks}}class="has-blocks mb-3"{{/hasblocks}}>
9090

9191
{{#hasregionmainsettingsmenu}}
9292
<div class="region_main_settings_menu_proxy"></div>
@@ -103,12 +103,12 @@
103103
{{{ output.activity_navigation }}}
104104
{{{ output.course_content_footer }}}
105105

106-
</section>
106+
</div>
107107
{{#hasblocks}}
108-
<section data-region="blocks-column" class="d-print-none" aria-label="{{#str}}blocks{{/str}}">
108+
<div data-region="blocks-column" class="d-print-none">
109109
{{{ addblockbutton }}}
110110
{{{ sidepreblocks }}}
111-
</section>
111+
</div>
112112
{{/hasblocks}}
113113
</div>
114114
</div>

templates/theme_boost/columns2.mustache.upstream

+4-4
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
<div> {{{ regionmainsettingsmenu }}} </div>
7474
</div>
7575
{{/hasregionmainsettingsmenu}}
76-
<section id="region-main" {{#hasblocks}}class="has-blocks mb-3"{{/hasblocks}} aria-label="{{#str}}content{{/str}}">
76+
<div id="region-main" {{#hasblocks}}class="has-blocks mb-3"{{/hasblocks}}>
7777

7878
{{#hasregionmainsettingsmenu}}
7979
<div class="region_main_settings_menu_proxy"></div>
@@ -89,12 +89,12 @@
8989
{{{ output.activity_navigation }}}
9090
{{{ output.course_content_footer }}}
9191

92-
</section>
92+
</div>
9393
{{#hasblocks}}
94-
<section data-region="blocks-column" class="d-print-none" aria-label="{{#str}}blocks{{/str}}">
94+
<div data-region="blocks-column" class="d-print-none">
9595
{{{ addblockbutton }}}
9696
{{{ sidepreblocks }}}
97-
</section>
97+
</div>
9898
{{/hasblocks}}
9999
</div>
100100
</div>

templates/theme_boost/drawers.mustache

+4-4
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@
9393
{{$id}}theme_boost-drawers-blocks{{/id}}
9494
{{$drawerclasses}}drawer drawer-right{{#blockdraweropen}} show{{/blockdraweropen}}{{/drawerclasses}}
9595
{{$drawercontent}}
96-
<section class="d-print-none" aria-label="{{#str}}blocks{{/str}}">
96+
<div class="d-print-none">
9797
{{{ addblockbutton }}}
9898
{{{ sidepreblocks }}}
99-
</section>
99+
</div>
100100
{{/drawercontent}}
101101
{{$drawerpreferencename}}drawer-open-block{{/drawerpreferencename}}
102102
{{$forceopen}}{{#forceblockdraweropen}}1{{/forceblockdraweropen}}{{/forceopen}}
@@ -212,7 +212,7 @@
212212
<div> {{{ regionmainsettingsmenu }}} </div>
213213
</div>
214214
{{/hasregionmainsettingsmenu}}
215-
<section id="region-main" aria-label="{{#str}}content{{/str}}">
215+
<div id="region-main">
216216

217217
{{#hasregionmainsettingsmenu}}
218218
<div class="region_main_settings_menu_proxy"></div>
@@ -251,7 +251,7 @@
251251
{{> theme_boost_union/slider }}
252252
{{/sliderpositionafterafter}}
253253

254-
</section>
254+
</div>
255255
</div>
256256
</div>
257257
{{#regions.contentlower.hasblocks}}

templates/theme_boost/drawers.mustache.upstream

+4-4
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@
7979
{{$id}}theme_boost-drawers-blocks{{/id}}
8080
{{$drawerclasses}}drawer drawer-right{{#blockdraweropen}} show{{/blockdraweropen}}{{/drawerclasses}}
8181
{{$drawercontent}}
82-
<section class="d-print-none" aria-label="{{#str}}blocks{{/str}}">
82+
<div class="d-print-none">
8383
{{{ addblockbutton }}}
8484
{{{ sidepreblocks }}}
85-
</section>
85+
</div>
8686
{{/drawercontent}}
8787
{{$drawerpreferencename}}drawer-open-block{{/drawerpreferencename}}
8888
{{$forceopen}}{{#forceblockdraweropen}}1{{/forceblockdraweropen}}{{/forceopen}}
@@ -142,7 +142,7 @@
142142
<div> {{{ regionmainsettingsmenu }}} </div>
143143
</div>
144144
{{/hasregionmainsettingsmenu}}
145-
<section id="region-main" aria-label="{{#str}}content{{/str}}">
145+
<div id="region-main">
146146

147147
{{#hasregionmainsettingsmenu}}
148148
<div class="region_main_settings_menu_proxy"></div>
@@ -162,7 +162,7 @@
162162
{{{ output.activity_navigation }}}
163163
{{{ output.course_content_footer }}}
164164

165-
</section>
165+
</div>
166166
</div>
167167
</div>
168168
</div>

templates/theme_boost/login.mustache

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@
5151
{{> theme_boost_union/infobanners }}
5252
<div id="page-content" class="row">
5353
<div id="region-main-box" class="col-12">
54-
<section id="region-main" class="col-12 h-100" aria-label="{{#str}}content{{/str}}">
54+
<div id="region-main" class="col-12 h-100">
5555
<div class="login-wrapper {{loginwrapperclass}}">
5656
<div class="login-container {{logincontainerclass}}">
5757
{{{ output.main_content }}}
5858
</div>
5959
</div>
60-
</section>
60+
</div>
6161
</div>
6262
</div>
6363
</div>

templates/theme_boost/login.mustache.upstream

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@
4141
<div id="page" class="container-fluid pt-5 mt-0">
4242
<div id="page-content" class="row">
4343
<div id="region-main-box" class="col-12">
44-
<section id="region-main" class="col-12 h-100" aria-label="{{#str}}content{{/str}}">
44+
<div id="region-main" class="col-12 h-100">
4545
<div class="login-wrapper">
4646
<div class="login-container">
4747
{{{ output.main_content }}}
4848
</div>
4949
</div>
50-
</section>
50+
</div>
5151
</div>
5252
</div>
5353
</div>

tests/behat/theme_boost_union_looksettings_activitybranding.feature

+52
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,33 @@ Feature: Configuring the theme_boost_union plugin for the "Activity branding" ta
3535
| content | book | #FFFF00 | invert(0.49) sepia(0.52) saturate(46.75) hue-rotate(156deg) brightness(0.89) contrast(1.02) |
3636
| interactivecontent | lesson | #00FFFF | invert(0.25) sepia(0.63) saturate(11.52) hue-rotate(344deg) brightness(0.94) contrast(0.91) |
3737

38+
@javascript
39+
Scenario Outline: Setting: Activity icon colors - Setting the color (for activities in subsections)
40+
Given I enable "subsection" "mod" plugin
41+
And the following "courses" exist:
42+
| fullname | shortname | category | numsections | initsections |
43+
| Subsectioncourse 1 | SC1 | 0 | 3 | 1 |
44+
And the following "activities" exist:
45+
| activity | name | course | idnumber | section |
46+
| subsection | Subsection1 | SC1 | sub | 1 |
47+
| <modname> | Activity in Subsection1 | SC1 | subact | 4 |
48+
And the following config values are set as admin:
49+
| config | value | plugin |
50+
| activityiconcolor<purposename> | <colorhex> | theme_boost_union |
51+
| activityiconcolorfidelity | 500 | theme_boost_union |
52+
And the theme cache is purged and the theme is reloaded
53+
When I log in as "admin"
54+
And I am on "Subsectioncourse 1" course homepage
55+
# First, we test that the default filter is _not_ set anymore.
56+
Then DOM element ".modtype_subsection .modtype_<modname> .activityicon" should not have computed style "filter" "<originalfilter>"
57+
# And then, as the hex color to CSS filter conversion results are not reproducible, we test if the applied filter is close enough to the hex color.
58+
And DOM element ".modtype_subsection .modtype_<modname> .activityicon" should have a CSS filter close enough to hex color "<colorhex>"
59+
60+
# We only test one example. That's enough to verify that subsections work.
61+
Examples:
62+
| purposename | modname | colorhex | originalfilter |
63+
| content | book | #FFFF00 | invert(0.49) sepia(0.52) saturate(46.75) hue-rotate(156deg) brightness(0.89) contrast(1.02) |
64+
3865
@javascript
3966
Scenario Outline: Setting: Activity icon purposes - Setting the purpose
4067
Given I log in as "admin"
@@ -63,6 +90,31 @@ Feature: Configuring the theme_boost_union plugin for the "Activity branding" ta
6390
| Book | Name | Communication | book | invert(0.48) sepia(0.74) saturate(48.87) hue-rotate(11deg) brightness(1.02) contrast(1.01) |
6491
| Assignment | Assignment name | Other | assign | none |
6592

93+
@javascript
94+
Scenario Outline: Setting: Activity icon purposes - Setting the purpose (for activities in subsections)
95+
Given I enable "subsection" "mod" plugin
96+
And the following "courses" exist:
97+
| fullname | shortname | category | numsections | initsections |
98+
| Subsectioncourse 1 | SC1 | 0 | 3 | 1 |
99+
And the following "activities" exist:
100+
| activity | name | course | idnumber | section |
101+
| subsection | Subsection1 | SC1 | sub | 1 |
102+
| <mod> | Activity in Subsection1 | SC1 | subact | 4 |
103+
And I log in as "admin"
104+
And Behat debugging is disabled
105+
And I navigate to "Appearance > Boost Union > Look" in site administration
106+
And I click on "Activity branding" "link" in the "#adminsettings .nav-tabs" "css_element"
107+
And I select "<purpose>" from the "<modname>" singleselect
108+
And I press "Save changes"
109+
And Behat debugging is enabled
110+
When I am on "Subsectioncourse 1" course homepage
111+
Then DOM element ".modtype_subsection .modtype_<mod> .activityicon" should have computed style "filter" "<filter>"
112+
113+
# We only test one example. That's enough to verify that subsections work.
114+
Examples:
115+
| modname | titlesetting | purpose | mod | filter |
116+
| Book | Name | Communication | book | invert(0.48) sepia(0.74) saturate(48.87) hue-rotate(11deg) brightness(1.02) contrast(1.01) |
117+
66118
@javascript @_file_upload
67119
Scenario Outline: Setting: Custom icons files - Upload custom icons files
68120
Given the following config values are set as admin:

tests/behat/theme_boost_union_smartmenusettings_menus_application.feature

+38
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,41 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app
8484
And I add a smart menu static item item "Privacy" "https://moodle.org/privacy"
8585
Then I should see "Bottom" in the "SmartMenu Policy" "table_row"
8686
And I should see smart menu "SmartMenu Policy" in location "Bottom"
87+
88+
@javascript
89+
Scenario: Smartmenu: Menus: Application - Show a smart menu in the main navigation together with a custom menu
90+
Given I log in as "admin"
91+
And I navigate to "Appearance > Advanced theme settings" in site administration
92+
And I set the field "Custom menu items" to multiline:
93+
"""
94+
Custom menu
95+
-Custom node 1|/foo/
96+
-Custom node 2|/bar/foobar.php
97+
"""
98+
And I press "Save changes"
99+
And the following "theme_boost_union > smart menu" exists:
100+
| title | Smart menu |
101+
| location | Main navigation |
102+
And the following "theme_boost_union > smart menu item" exists:
103+
| menu | Smart menu |
104+
| title | Smart menu node 1 |
105+
| itemtype | Static |
106+
| url | /foooo |
107+
And the following "theme_boost_union > smart menu item" exists:
108+
| menu | Smart menu |
109+
| title | Smart menu node 2 |
110+
| itemtype | Static |
111+
| url | /baaar |
112+
And I log out
113+
And I log in as "user1"
114+
# Resize the window to avoid that menus fall into the "More" menu and influence this test.
115+
And I change window size to "large"
116+
Then I should see smart menu "Smart menu" in location "Main"
117+
And "Smart menu node 1" "theme_boost_union > Smart menu item" should exist in the "Smart menu" "theme_boost_union > Main menu smart menu"
118+
And "Smart menu node 2" "theme_boost_union > Smart menu item" should exist in the "Smart menu" "theme_boost_union > Main menu smart menu"
119+
And I should see "Custom menu" in the "nav" "css_element"
120+
And I click on "Custom menu" "link" in the "nav" "css_element"
121+
And I should see "Custom node 1" in the "nav" "css_element"
122+
And I should see "Custom node 2" in the "nav" "css_element"
123+
And "Custom menu" "link" should appear before "Smart menu" "link" in the "nav" "css_element"
124+
And "My courses" "link" should appear before "Custom menu" "link" in the "nav" "css_element"

0 commit comments

Comments
 (0)