mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 14:03:52 +01:00
Merge branch 'MDL-83087-main' of https://github.com/roland04/moodle
This commit is contained in:
commit
660b4a9566
@ -16,6 +16,8 @@
|
||||
|
||||
namespace core_course\output;
|
||||
|
||||
use action_menu;
|
||||
use action_menu_link_secondary;
|
||||
use context_coursecat;
|
||||
use core_course_category;
|
||||
use course_request;
|
||||
@ -161,10 +163,26 @@ class category_action_bar extends manage_categories_action_bar {
|
||||
* - additionaloptions Additional actions that can be performed in a category
|
||||
*/
|
||||
public function export_for_template(\renderer_base $output): array {
|
||||
$additionaloptions = $this->get_additional_category_options();
|
||||
// Generate the action menu if there are additional options.
|
||||
if (!empty($additionaloptions)) {
|
||||
$actionmenu = new action_menu();
|
||||
$actionmenu->set_kebab_trigger(get_string('moreactions'));
|
||||
$actionmenu->set_additional_classes('ms-auto');
|
||||
foreach ($additionaloptions['options'] as $option) {
|
||||
$actionmenu->add(new action_menu_link_secondary(
|
||||
$option['url'],
|
||||
null,
|
||||
$option['string']
|
||||
));
|
||||
}
|
||||
$actionmenucontent = $output->render($actionmenu);
|
||||
}
|
||||
|
||||
return [
|
||||
'categoryselect' => $this->get_category_select($output),
|
||||
'search' => $this->get_search_form(),
|
||||
'additionaloptions' => $this->get_additional_category_options()
|
||||
'additionaloptions' => $actionmenucontent ?? '',
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -98,20 +98,6 @@
|
||||
{{> core/search_input }}
|
||||
</div>
|
||||
{{/search}}
|
||||
{{#additionaloptions}}
|
||||
<div class="ms-auto d-flex">
|
||||
<div class="navitem dropdown">
|
||||
<button aria-label="{{#str}}moreactions{{/str}}" class="btn btn-secondary dropdown-toggle" id="dropdown-actions" data-toggle="dropdown" aria-haspopup="true" aria-controls="moreactionsmenu">
|
||||
{{#str}}moremenu{{/str}}
|
||||
</button>
|
||||
|
||||
<div id="moreactionsmenu" class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdown-actions" role="menu">
|
||||
{{#options}}
|
||||
<a role="menuitem" class="dropdown-item" {{#attributes}}{{name}}="{{value}}" {{/attributes}} href="{{url}}" tabindex="-1">{{string}}</a>
|
||||
{{/options}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/additionaloptions}}
|
||||
{{{additionaloptions}}}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -22,7 +22,7 @@ Feature: Users can request and approve courses
|
||||
| moodle/course:request | allow |
|
||||
When I log in as "user1"
|
||||
And I am on course index
|
||||
And I click on "More actions" "button"
|
||||
And I click on "More actions" "link"
|
||||
And I click on "Request a course" "link"
|
||||
And I set the following fields to these values:
|
||||
| Course full name | My new course |
|
||||
@ -36,7 +36,7 @@ Feature: Users can request and approve courses
|
||||
And I log out
|
||||
And I log in as "user2"
|
||||
And I am on course index
|
||||
And I click on "More actions" "button"
|
||||
And I click on "More actions" "link"
|
||||
And I click on "Courses pending approval" "link"
|
||||
And the following should exist in the "pendingcourserequests" table:
|
||||
| Requested by | Course short name | Course full name | Category | Reason for course request |
|
||||
@ -75,7 +75,7 @@ Feature: Users can request and approve courses
|
||||
And I log in as "user1"
|
||||
And I am on course index
|
||||
And I follow "English category"
|
||||
And I click on "More actions" "button"
|
||||
And I click on "More actions" "link"
|
||||
And I click on "Request a course" "link"
|
||||
And I should see "English category" in the ".form-autocomplete-selection" "css_element"
|
||||
And I set the following fields to these values:
|
||||
@ -91,7 +91,7 @@ Feature: Users can request and approve courses
|
||||
And I should not see "Courses pending approval"
|
||||
And I am on course index
|
||||
And I follow "Science category"
|
||||
And I click on "More actions" "button"
|
||||
And I click on "More actions" "link"
|
||||
And I click on "Courses pending approval" "link"
|
||||
And I should not see "Mynewcourse"
|
||||
And I press "Back to course listing"
|
||||
@ -99,7 +99,7 @@ Feature: Users can request and approve courses
|
||||
And I log in as "user3"
|
||||
And I am on course index
|
||||
And I follow "English category"
|
||||
And I click on "More actions" "button"
|
||||
And I click on "More actions" "link"
|
||||
And I click on "Courses pending approval" "link"
|
||||
And the following should exist in the "pendingcourserequests" table:
|
||||
| Requested by | Course short name | Course full name | Category | Reason for course request |
|
||||
|
Loading…
x
Reference in New Issue
Block a user