Skip to content

Commit

Permalink
Improvement: Add navigation to policy overview page, resolves moodle-…
Browse files Browse the repository at this point in the history
  • Loading branch information
christianwolters authored May 8, 2024
1 parent b01cd47 commit d60c39b
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ moodle-theme_boost_union
Changes
-------

### Unreleased

* 2024-04-27 - Improvement: Add navigation to policy overview page, resolves #633

### v4.3-r12

* 2024-04-20 - Bugfix: Footnote ignored paragraph breaks, resolves #623.
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,10 @@ With this setting, upon toggling edit mode on and off, the scroll position at wh

With this setting the elements to jump to the previous and next activity/resource as well as the pull down menu to jump to a distinct activity/resource become displayed. UI elements like this existed already on Boost in Moodle Core until Moodle 3.11, but were removed in 4.0. With Boost Union, you can bring them back.

###### Show navigation on policy overview page

By default, the policy overview page (provided by tool_policy) does not show a navigation menu or footer. With this setting, you can show the primary navigation and footer on that page.

#### Tab "Blocks"

In this tab there are the following settings:
Expand Down
51 changes: 51 additions & 0 deletions classes/output/tool_policy_renderer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

namespace theme_boost_union\output;

/**
* Theme Boost Union - tool_policy renderer
*
* @package theme_boost_union
* @copyright 2024 Christian Wolters <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class tool_policy_renderer extends \tool_policy\output\renderer {

/**
* Overrides the header() function.
*
* The goal here is to override page layout for /admin/tool/policy/viewall.php.
*
* @return string HTML of the page header.
*/
public function header() {
// Check that only the /admin/tool/policy/viewall.php page is affected.
$pageurl = new \moodle_url('/admin/tool/policy/viewall.php');
if ($pageurl->compare($this->page->url, URL_MATCH_BASE) == true) {

// If the admin wants to show navigation on the policy page.
$config = get_config('theme_boost_union', 'policyoverviewnavigation');
if (isset($config) && $config == THEME_BOOST_UNION_SETTING_SELECT_YES) {
// Set the page layout to standard.
$this->page->set_pagelayout('standard');
}
}

// Call and return the header function.
return parent::header();
}
}
8 changes: 8 additions & 0 deletions lang/en/theme_boost_union.php
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,14 @@
$string['showsitehomerighthandblockdraweronguestloginsetting'] = 'Show right-hand block drawer of site home on guest login';
$string['showsitehomerighthandblockdraweronguestloginsetting_desc'] = 'With this setting, the right-hand block drawer of site home will be displayed in its expanded state by default. This only applies to users who log in as a guest.';

// Settings: Page layouts tab.
$string['pagelayoutstab'] = 'Page layouts';
// ... Section: tool_policy heading.
$string['policyheading'] = 'Policies';
// ... ... Setting: Navigation on policy overview page.
$string['policyoverviewnavigationsetting'] = 'Show navigation on policy overview page';
$string['policyoverviewnavigationsetting_desc'] = 'By default, the policy overview page (provided by tool_policy) does not show a navigation menu or footer. With this setting, you can show the primary navigation and footer on that page.';

// Settings: Links tab.
$string['linkstab'] = 'Links';
// ... Section: Special links markup.
Expand Down
21 changes: 21 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -1549,6 +1549,27 @@
$page->add($tab);


// Create page layouts tab.
$tab = new admin_settingpage('theme_boost_union_feel_pagelayouts',
get_string('pagelayoutstab', 'theme_boost_union', null, true));

// Create tool_policy heading.
$name = 'theme_boost_union/policyheading';
$title = get_string('policyheading', 'theme_boost_union', null, true);
$setting = new admin_setting_heading($name, $title, null);
$tab->add($setting);

// Setting: Navigation on policy overview page.
$name = 'theme_boost_union/policyoverviewnavigation';
$title = get_string('policyoverviewnavigationsetting', 'theme_boost_union', null, true);
$description = get_string('policyoverviewnavigationsetting_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configselect($name, $title, $description, THEME_BOOST_UNION_SETTING_SELECT_NO, $yesnooption);
$tab->add($setting);

// Add tab to settings page.
$page->add($tab);


// Create links tab.
$tab = new admin_settingpage('theme_boost_union_feel_links', get_string('linkstab', 'theme_boost_union', null, true));

Expand Down
19 changes: 19 additions & 0 deletions tests/behat/theme_boost_union_feelsettings_pagelayouts.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@theme @theme_boost_union @theme_boost_union_feelsettings @theme_boost_union_feelsettings_pagelayouts
Feature: Configuring the theme_boost_union plugin for the "Page layouts" tab on the "Feel" page
In order to use the features
As admin
I need to be able to configure the theme Boost Union plugin

@javascript
Scenario Outline: Setting: Show navigation on policy overview page
Given the following config values are set as admin:
| config | value | plugin |
| policyoverviewnavigation | <setting> | theme_boost_union |
And I visit '/admin/tool/policy/viewall.php'
Then ".navbar" "css_element" <shouldornot> exist
And "#page-footer" "css_element" <shouldornot> exist

Examples:
| setting | shouldornot |
| yes | should |
| no | should not |
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();

$plugin->component = 'theme_boost_union';
$plugin->version = 2023102035;
$plugin->version = 2023102036;
$plugin->release = 'v4.3-r12';
$plugin->requires = 2023100900;
$plugin->supported = [403, 403];
Expand Down

0 comments on commit d60c39b

Please sign in to comment.