Skip to content

Commit

Permalink
Review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
abias committed Dec 5, 2023
1 parent b621a24 commit 8425cac
Show file tree
Hide file tree
Showing 14 changed files with 308 additions and 186 deletions.
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Changes

### Unreleased

* 2023-11-12 - Improvement: Option to suppress footer button, solves #444.
* 2023-11-12 - Improvement: Option to suppress footer (circle containing the question mark) button, solves #444.
* 2023-11-23 - Bugfix: Add background color to OAuth2 login button, solves #473.

### v4.3-r2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ Whatever you add to this textarea will be displayed at the end of a page, in the

###### Footer

With these settings, you can show where to show or whether to suppress the footer (circle containing the question mark) button.
With these settings, you can control whether to show or to suppress the footer (circle containing the question mark) button at the bottom of the page.

#### Tab "Static pages"

Expand Down
21 changes: 21 additions & 0 deletions classes/output/core_renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,27 @@ public function body_attributes($additionalclasses = []) {
$additionalclasses[] = 'flavour'.'-'.$flavour->id;
}

// If the admin decided to change the breakpoints of the footer button,
// add the setting as additional body class.
// With this setting, we show and hide the footer button as well as move the buttons
// (back-to-top and communication) which are stacked on top of the footer button upwards.
$footerbutton = get_config('theme_boost_union', 'enablefooterbutton');
switch ($footerbutton) {
case THEME_BOOST_UNION_SETTING_ENABLEFOOTER_NONE:
$additionalclasses[] = 'theme_boost-union-footerbuttonnone';
break;
case THEME_BOOST_UNION_SETTING_ENABLEFOOTER_ALL:
$additionalclasses[] = 'theme_boost-union-footerbuttonall';
break;
case THEME_BOOST_UNION_SETTING_ENABLEFOOTER_MOBILE:
$additionalclasses[] = 'theme_boost-union-footerbuttonmobile';
break;
case THEME_BOOST_UNION_SETTING_ENABLEFOOTER_DESKTOP:
default:
$additionalclasses[] = 'theme_boost-union-footerbuttondesktop';
break;
}

return ' id="'. $this->body_id().'" class="'.$this->body_css_classes($additionalclasses).'"';
}

Expand Down
13 changes: 6 additions & 7 deletions lang/en/theme_boost_union.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,14 +441,13 @@
$string['footnotesetting_desc'] = 'Whatever you add to this textarea will be displayed at the end of a page, in the footer (not the floating footer) on every page which uses the layouts "drawers", "columns2" or "login". Content in this area could be for example the copyright, the terms of use or the name of your organisation. <br/> If you want to remove the footnote again, just empty the text area.';
// ... Section: Footer.
$string['footerheading'] = 'Footer';
// ... ... Setting: Footer.
// ... ... Setting: Enable footer.
$string['enablefooterbutton'] = 'Enable footer';
$string['enablefooterbutton_desc'] = 'With "footer", the circle containing the question mark at the bottom of the page is meant.<br />Upon click, the user is presented with an overlay. Depending on the site configuration the links
Help and documentation, Services and support, Contact site support, Login information, Reset user tour on this page, Data retention summary, Get the mobile app, Policies and Powered by Moodle could be shown.<br />With this setting it is possible to choose on which device to show or entirely suppress this footer button.';
$string['enablefooterbuttonboth'] = 'Desktop and mobile';
$string['enablefooterbuttondesktop'] = 'Desktop only';
$string['enablefooterbuttonmobile'] = 'Mobile only';
$string['enablefooterbuttonhidden'] = 'Hidden';
$string['enablefooterbutton_desc'] = 'With "footer", the circle containing the question mark at the bottom of the page is meant.<br />Upon click, the user is presented with an overlay. Depending on the site configuration Moodle shows several links (like "Help and documentation" or "Data retention summary") are shown in this overlay.<br />With this setting, you can control whether to show or to suppress the footer button at the bottom of the page.';
$string['enablefooterbuttonboth'] = 'Enable on desktop, tablet and mobile';
$string['enablefooterbuttondesktop'] = 'Enable on desktop and tablet only, hide on mobile (unchanged as presented by Moodle core)';
$string['enablefooterbuttonmobile'] = 'Enable on mobile only, hide on desktop and tablet';
$string['enablefooterbuttonhidden'] = 'Hide on all devices';

// Settings: Static pages tab.
$string['staticpagestab'] = 'Static pages';
Expand Down
3 changes: 3 additions & 0 deletions layout/columns2.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@
if (isset($primarymenu['includesmartmenu']) && $primarymenu['includesmartmenu'] == true) {
$extraclasses[] = 'theme-boost-union-smartmenu';
}
if (isset($primarymenu['bottombar']) && !empty($primarymenu['includesmartmenu'])) {
$extraclasses[] = 'theme-boost-union-bottombar';
}

$buildregionmainsettings = !$PAGE->include_region_main_settings_in_header_actions() && !$PAGE->has_secondary_navigation();
// If the settings menu will be included in the header then don't add it here.
Expand Down
5 changes: 4 additions & 1 deletion layout/drawers.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,13 @@
$renderer = $PAGE->get_renderer('core');
$primarymenu = $primary->export_for_template($renderer);

// Add a special class selector to improve the Smart menus SCSS selectors.
// Add special class selectors to improve the Smart menus SCSS selectors.
if (isset($primarymenu['includesmartmenu']) && $primarymenu['includesmartmenu'] == true) {
$extraclasses[] = 'theme-boost-union-smartmenu';
}
if (isset($primarymenu['bottombar']) && !empty($primarymenu['includesmartmenu'])) {
$extraclasses[] = 'theme-boost-union-bottombar';
}

$buildregionmainsettings = !$PAGE->include_region_main_settings_in_header_actions() && !$PAGE->has_secondary_navigation();
// If the settings menu will be included in the header then don't add it here.
Expand Down
14 changes: 5 additions & 9 deletions layout/includes/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,11 @@

defined('MOODLE_INTERNAL') || die();

// Require the necessary libraries.
require_once($CFG->dirroot.'/theme/boost_union/locallib.php');
$footersetting = get_config('theme_boost_union', 'enablefooterbutton');

$config = get_config('theme_boost_union');

// If the footerbutton is enabled.
$footerquestionmark = isset($config->enablefooterbutton) ? $config->enablefooterbutton :
THEME_BOOST_UNION_SETTING_ENABLEFOOTER_BOTH;

if ($footerquestionmark != THEME_BOOST_UNION_SETTING_ENABLEFOOTER_HIDDEN) {
// If the footer button is enabled.
$footerquestionmark = isset($footersetting) ? $footersetting : THEME_BOOST_UNION_SETTING_ENABLEFOOTER_ALL;
if ($footerquestionmark != THEME_BOOST_UNION_SETTING_ENABLEFOOTER_NONE) {
// Add marker to show the footer button to templatecontext.
$templatecontext['footerbutton'] = true;
}
32 changes: 2 additions & 30 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@
define('THEME_BOOST_UNION_SETTING_OUTSIDEREGIONSWITH_COURSECONTENTWIDTH', 'coursecontentwidth');
define('THEME_BOOST_UNION_SETTING_OUTSIDEREGIONSWITH_HEROWIDTH', 'herowidth');

define('THEME_BOOST_UNION_SETTING_ENABLEFOOTER_BOTH', 'enablefooterbuttonall');
define('THEME_BOOST_UNION_SETTING_ENABLEFOOTER_ALL', 'enablefooterbuttonall');
define('THEME_BOOST_UNION_SETTING_ENABLEFOOTER_DESKTOP', 'enablefooterbuttondesktop');
define('THEME_BOOST_UNION_SETTING_ENABLEFOOTER_MOBILE', 'enablefooterbuttonmobile');
define('THEME_BOOST_UNION_SETTING_ENABLEFOOTER_HIDDEN', 'enablefooterbuttonhidden');
define('THEME_BOOST_UNION_SETTING_ENABLEFOOTER_NONE', 'enablefooterbuttonnone');

/**
* Returns the main SCSS content.
Expand Down Expand Up @@ -294,34 +294,6 @@ function theme_boost_union_get_extra_scss($theme) {
// Setting: Mark external links.
$content .= theme_boost_union_get_scss_to_mark_external_links($theme);

// If the footerbutton is enabled.
$footerquestionmark = get_config('theme_boost_union', 'enablefooterbutton');

switch ($footerquestionmark) {
case THEME_BOOST_UNION_SETTING_ENABLEFOOTER_BOTH:
$content .= '@media (max-width: 575px) { #page-footer [data-region="footer-container-popover"] .btn-footer-popover ' .
'{ display: block !important; } }' . PHP_EOL;
break;
case THEME_BOOST_UNION_SETTING_ENABLEFOOTER_DESKTOP:
$content .= '@media (min-width: 576px) { #page-footer [data-region="footer-container-popover"] .btn-footer-popover ' .
'{ display: block !important; } }' . PHP_EOL;
$content .= '#page-footer .footer-content-popover.container { display: none !important; }' . PHP_EOL;
break;
case THEME_BOOST_UNION_SETTING_ENABLEFOOTER_MOBILE:
$content .= '@media (min-width: 576px) { #page-footer [data-region="footer-container-popover"] .btn-footer-popover ' .
'{ display: none !important; } }' . PHP_EOL;
$content .= '@media (max-width: 575px) { #page-footer [data-region="footer-container-popover"] .btn-footer-popover ' .
'{ display: block !important; bottom: 5rem; } }' . PHP_EOL;
$content .= '#page-footer .footer-content-popover.container { display: none !important; }' . PHP_EOL;
break;
default:
$content .= '@media (max-width: 575px) { #page-footer [data-region="footer-container-popover"] .btn-footer-popover ' .
'{ display: none !important; } }' . PHP_EOL;
$content .= '@media (max-width: 575px) { #page-footer .footer-content-popover.container ' .
'{ display: none !important; } }' . PHP_EOL;
break;
}

return $content;
}

Expand Down
Loading

0 comments on commit 8425cac

Please sign in to comment.