MDL-78579 mod_glossary: show approval pending count in navigation.

This commit is contained in:
Paul Holden 2023-06-26 21:37:18 +01:00
parent a1d5d1b2f7
commit 24ce2bb86f
No known key found for this signature in database
GPG key ID: A81A96D6045F6164
4 changed files with 3 additions and 3 deletions

View file

@ -280,6 +280,7 @@ $string['page-mod-glossary-x'] = 'Any glossary module page';
$string['page-mod-glossary-edit'] = 'Glossary add/edit entry page';
$string['page-mod-glossary-view'] = 'View glossary edit page';
$string['pendingapproval'] = 'Pending approval';
$string['pendingapprovalcount'] = 'Pending approval ({$a})';
$string['pluginadministration'] = 'Glossary administration';
$string['pluginname'] = 'Glossary';
$string['popupformat'] = 'Popup format';

View file

@ -3167,7 +3167,7 @@ function glossary_extend_settings_navigation(settings_navigation $settings, navi
// Safe guard check - Ideally, there shouldn't be any hidden entries if the glossary has 'defaultapproval'.
if (has_capability('mod/glossary:approve', $settings->get_page()->cm->context) &&
(!$glossary->defaultapproval || $hiddenentries)) {
$glossarynode->add(get_string('pendingapproval', 'glossary'),
$glossarynode->add(get_string('pendingapprovalcount', 'glossary', $hiddenentries),
new moodle_url('/mod/glossary/view.php', ['id' => $settings->get_page()->cm->id, 'mode' => 'approval']),
navigation_node::TYPE_CUSTOM, null, 'pendingapproval');
}

View file

@ -40,7 +40,7 @@ Feature: A teacher can choose whether glossary entries require approval
And I log out
# Approve the entry.
And I am on the "Test glossary name" "glossary activity" page logged in as teacher1
And I follow "Pending approval"
And I follow "Pending approval (1)"
Then I should see "(this entry is currently hidden)"
And I follow "Approve"
And I am on the "Test glossary name" "glossary activity" page

View file

@ -295,7 +295,6 @@ if (!empty($CFG->enablerssfeeds) && !empty($CFG->glossary_enablerssfeeds)
}
if ($tab == GLOSSARY_APPROVAL_VIEW) {
require_capability('mod/glossary:approve', $context);
$PAGE->navbar->add($strwaitingapproval);
}
$hassecondary = $PAGE->has_secondary_navigation();