MDL-73379 admin: consistent secondary navigation on settings pages.

Co-authored-by: Adrian Greeve <adrian@moodle.com>
This commit is contained in:
Paul Holden 2021-12-16 11:06:41 +00:00
parent 58a729f088
commit 7d61928cfb
4 changed files with 23 additions and 8 deletions

View File

@ -140,13 +140,7 @@ if ($errormsg !== '') {
echo $OUTPUT->notification($statusmsg, 'notifysuccess');
}
$path = array_reverse($settingspage->visiblepath);
if (is_array($path)) {
$visiblename = join(' / ', $path);
} else {
$visiblename = $path;
}
echo $OUTPUT->heading(get_string('admincategory', 'admin', $visiblename), 2);
echo $OUTPUT->heading(get_string('admincategory', 'admin', $settingspage->visiblename), 2);
echo html_writer::start_tag('form', array('action' => '', 'method' => 'post', 'id' => 'adminsettings'));
echo html_writer::start_tag('div');

View File

@ -13,7 +13,6 @@ $PAGE->set_context(context_system::instance());
$PAGE->set_url('/admin/settings.php', array('section' => $section));
$PAGE->set_pagetype('admin-setting-' . $section);
$PAGE->set_pagelayout('admin');
$PAGE->has_secondary_navigation_setter(false);
$PAGE->navigation->clear_cache();
navigation_node::require_admin_tree();

View File

@ -0,0 +1,21 @@
@core @core_admin
Feature: Navigate site administration pages
In order to configure my site
As an admin
I need to be able to navigate the site administration pages
@javascript
Scenario: Navigate to an admin category page
Given I log in as "admin"
When I navigate to "Plugins > Activity modules > Assignment" in site administration
# Ensure secondary navigation is still present and "Plugins" is selected.
Then "//a[@aria-current = 'true' and normalize-space() = 'Plugins']" "xpath" should exist in the ".secondary-navigation" "css_element"
And I should see "Category: Assignment"
@javascript
Scenario: Navigate to an admin settings page
Given I log in as "admin"
When I navigate to "Plugins > Activity modules > Forum" in site administration
# Ensure secondary navigation is still present and "Plugins" is selected.
Then "//a[@aria-current = 'true' and normalize-space() = 'Plugins']" "xpath" should exist in the ".secondary-navigation" "css_element"
And I should see "Forum"

View File

@ -4,6 +4,7 @@
],
"features": [
"lib/tests/behat/action_menu.feature",
"admin/tests/behat/site_administration.feature",
"blocks/tests/behat/hide_blocks.feature",
"blocks/tests/behat/move_blocks.feature",
"course/format/tests/behat/course_courseindex.feature",