Skip to content

Commit c94b342

Browse files
prasanna-lmsaceabias
authored andcommitted
Improvement: Improve wrapping of the outside-left and outside-right regions, resolves #255
1 parent ea6f51e commit c94b342

File tree

8 files changed

+99
-1
lines changed

8 files changed

+99
-1
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Changes
66

77
### Unreleased
88

9+
* 2025-11-07 - Improvement: Improve wrapping of the outside-left and outside-right regions, resolves #255.
910
* 2025-11-07 - Upstream change: Adopt changes from MDL-85774 into loginform.mustache, resolves #1093
1011
* 2025-11-04 - Improvement: Add vertical offset to the outside-left and outside-right block regions, resolves #254.
1112
* 2025-11-04 - Bugfix: When upgrading a Boost Union installation from the ancient pre-smart-menu-era to a recent version, Boost Union tried to access a table which does not exist yet, resolves #1085

lang/en/theme_boost_union.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,9 @@
710710
$string['outsideregionsverticalalignment_desc'] = 'With this setting, you can control if, on larger screens, the \'Outside (left)\' and \'Outside (right)\' block regions should be vertically aligned with the page content or not.';
711711
$string['outsideregionsverticalaligndefault'] = 'None';
712712
$string['outsideregionsverticalalignpagecontent'] = 'Align \'Outside (left)\' and \'Outside (right)\' regions vertically with the page content';
713+
// ... ... Setting: Wrap outside left and right regions below main content.
714+
$string['outsideregionswrap'] = 'Wrap outside left and right regions below main content';
715+
$string['outsideregionswrap_desc'] = 'With this setting, you can control if the \'Outside (left)\' and \'Outside (right)\' block regions should be wrapped below the main content area on smaller screens.';
713716
// ... Section: Site home right-hand block drawer behaviour.
714717
$string['sitehomerighthandblockdrawerbehaviour'] = 'Site home right-hand block drawer';
715718
// ... ... Setting: Show right-hand block drawer of site home on visit.

layout/includes/blockregions.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,13 @@ public function maininnerwrapperclass($regionsdata) {
112112
$maininnerwrapperclass = 'main-inner-outside-none';
113113
}
114114

115+
// If outside-regions wrap below main content is enabled.
116+
$outsideregionswrap = get_config('theme_boost_union', 'blockregionoutsidewrap');
117+
if ($outsideregionswrap == THEME_BOOST_UNION_SETTING_SELECT_YES) {
118+
// Include class in main inner wrapper to wrap the outside regions below main content.
119+
$maininnerwrapperclass .= ' left-region-nextmaincontent ';
120+
}
121+
115122
return $maininnerwrapperclass;
116123
}
117124

scss/boost_union/post.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,6 +1320,24 @@ body.theme-boost-union-commincourse {
13201320
margin-left: .5rem;
13211321
margin-right: .5rem;
13221322
}
1323+
1324+
/* Wrap the left and right outside regions below the main content. */
1325+
.left-region-nextmaincontent {
1326+
&.main-inner-outside-left-right.main-inner-outside-nextmaincontent,
1327+
&.main-inner-outside-left.main-inner-outside-nextmaincontent,
1328+
&.main-inner-outside-right.main-inner-outside-nextmaincontent,
1329+
&.main-inner-outside-left-right.main-inner-outside-nearwindowedges,
1330+
&.main-inner-outside-left.main-inner-outside-nearwindowedges,
1331+
&.main-inner-outside-right.main-inner-outside-nearwindowedges {
1332+
display: grid;
1333+
#theme-block-region-outside-left {
1334+
order: 1;
1335+
}
1336+
#theme-block-region-outside-right {
1337+
order: 2;
1338+
}
1339+
}
1340+
}
13231341
}
13241342
}
13251343

settings.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2484,6 +2484,13 @@
24842484
);
24852485
$tab->add($setting);
24862486

2487+
// Setting: Wrap outside left and right regions below maincontent (on mobile).
2488+
$name = 'theme_boost_union/blockregionoutsidewrap';
2489+
$title = get_string('outsideregionswrap', 'theme_boost_union', null, true);
2490+
$description = get_string('outsideregionswrap_desc', 'theme_boost_union', null, true);
2491+
$setting = new admin_setting_configselect($name, $title, $description, THEME_BOOST_UNION_SETTING_SELECT_NO, $yesnooption);
2492+
$tab->add($setting);
2493+
24872494
// Create footer regions heading.
24882495
$name = 'theme_boost_union/footerregionsheading';
24892496
$title = get_string('footerregionsheading', 'theme_boost_union', null, true);

tests/behat/behat_theme_boost_union_behat_blocks.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,46 @@
3939
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
4040
*/
4141
class behat_theme_boost_union_behat_blocks extends behat_blocks {
42+
43+
/**
44+
* Checks the order of elements before or after.
45+
*
46+
* @Then :arg1 :arg2 should display :arg3 :arg4 :arg5
47+
*
48+
* @param string $selector1 The first element selector.
49+
* @param string $type1 The type of the first element selector.
50+
* @param string $order The expected order (before or after).
51+
* @param string $selector2 The second element selector.
52+
* @param string $type2 The type of the second element selector.
53+
*/
54+
public function assert_element_order($selector1, $type1, $order, $selector2, $type2) {
55+
$element1 = $this->find($type1, $selector1);
56+
$element2 = $this->find($type2, $selector2);
57+
58+
if (!$element1) {
59+
throw new ElementNotFoundException($this->getSession(), 'element', $type1, $selector1);
60+
}
61+
62+
if (!$element2) {
63+
throw new ElementNotFoundException($this->getSession(), 'element', $type2, $selector2);
64+
}
65+
66+
$script = "
67+
return (function() {
68+
const el1 = document.querySelector('$selector1');
69+
const el2 = document.querySelector('$selector2');
70+
const order1 = parseInt(window.getComputedStyle(el1).order);
71+
const order2 = parseInt(window.getComputedStyle(el2).order);
72+
return order1 < order2 ? true : false;
73+
})();";
74+
75+
$result = $this->evaluate_script($script);
76+
77+
if (($order === 'before' && $result == false) || ($order === 'after' && $result == true)) {
78+
throw new Exception(sprintf(
79+
'The element "%s" (%s) is not displayed %s the element "%s" (%s).',
80+
$selector1, $type1, $order, $selector2, $type2
81+
));
82+
}
83+
}
4284
}

tests/behat/theme_boost_union_feelsettings_blocks.feature

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,3 +538,23 @@ Feature: Configuring the theme_boost_union plugin for the "Blocks" tab on the "F
538538
| 1 | outside-left,outside-right | outside-left | outside-right | should | should | #theme-block-region-outside-left .add_block_button,#theme-block-region-outside-right .add_block_button,#page-content | #block-region-outside-left,#block-region-outside-right,#page-content |
539539
| 1 | outside-left,outside-top | outside-left | outside-top | should | should not | #theme-block-region-outside-left .add_block_button,#page-content | #block-region-outside-left,#page-content |
540540
| 1 | outside-top,outside-right | outside-top | outside-right | should not | should | #theme-block-region-outside-right .add_block_button,#page-content | #block-region-outside-right,#page-content |
541+
542+
Scenario Outline: Setting: Wrap outside regions below main content
543+
Given the following config values are set as admin:
544+
| config | value | plugin |
545+
| blockregionoutsidewrap | <setting> | theme_boost_union |
546+
| blockregionsforcourse | outside-left,outside-right | theme_boost_union |
547+
And the following "blocks" exist:
548+
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
549+
| online_users | Course | C1 | course-view-* | outside-left |
550+
| myprofile | Course | C1 | course-view-* | outside-right |
551+
When I am on the "Course 1" "Course" page logged in as "student1"
552+
553+
Then the "class" attribute of ".main-inner-wrapper" "css_element" <shouldcontain> "left-region-nextmaincontent"
554+
And I change window size to "mobile"
555+
Then ".main-inner#topofscroll" "css_element" should display <beforeafter> "#theme-block-region-outside-left" "css_element"
556+
557+
Examples:
558+
| setting | shouldcontain | beforeafter |
559+
| yes | should contain | before |
560+
| no | should not contain | after |

version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
defined('MOODLE_INTERNAL') || die();
2626

2727
$plugin->component = 'theme_boost_union';
28-
$plugin->version = 2025041430;
28+
$plugin->version = 2025041431;
2929
$plugin->release = 'v5.0-r11';
3030
$plugin->requires = 2025041401;
3131
$plugin->supported = [500, 500];

0 commit comments

Comments
 (0)