mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 04:22:07 +02:00
MDL-77640 gradebook: Moved add items to new tertiary nav dropdown
This commit is contained in:
parent
e998f14061
commit
4f9e931993
@ -54,57 +54,55 @@ class gradebook_setup_action_bar extends action_bar {
|
||||
$generalnavselector = new general_action_bar($this->context,
|
||||
new moodle_url('/grade/edit/tree/index.php', ['id' => $courseid]), 'settings', 'setup');
|
||||
$data = $generalnavselector->export_for_template($output);
|
||||
$actions = [];
|
||||
$additemurl = new moodle_url('#');
|
||||
|
||||
// Add a button to the action bar with a link to the 'add grade item' page.
|
||||
$addgradeitemlink = new moodle_url('#');
|
||||
$addgradeitembutton = new \single_button(
|
||||
$addgradeitemlink,
|
||||
// Add a button to the action bar dropdown with a link to the 'add grade item' modal.
|
||||
$actions[] = new \action_menu_link_secondary(
|
||||
$additemurl,
|
||||
null,
|
||||
get_string('additem', 'grades'),
|
||||
'get',
|
||||
\single_button::BUTTON_SECONDARY,
|
||||
[
|
||||
'data-courseid' => $courseid,
|
||||
'data-itemid' => -1,
|
||||
'data-trigger' => 'add-item-form',
|
||||
'data-gprplugin' => 'tree'
|
||||
'data-gprplugin' => 'tree',
|
||||
]
|
||||
);
|
||||
$data['addgradeitembutton'] = $addgradeitembutton->export_for_template($output);
|
||||
|
||||
// If outcomes are enabled, add a button to the action bar with a link to the 'add outcome item' page.
|
||||
// If outcomes are enabled, add a button to the action bar dropdown with a link to the 'add outcome item' modal.
|
||||
if (!empty($CFG->enableoutcomes) && count(\grade_outcome::fetch_all_available($courseid)) > 0) {
|
||||
// Add a button to the action bar with a link to the 'add outcome item' page.
|
||||
$addoutcomeitem = new moodle_url('#');
|
||||
$addoutcomeitembutton = new \single_button(
|
||||
$addoutcomeitem,
|
||||
// Add a button to the action bar dropdown with a link to the 'add outcome item' modal.
|
||||
$actions[] = new \action_menu_link_secondary(
|
||||
$additemurl,
|
||||
null,
|
||||
get_string('addoutcomeitem', 'grades'),
|
||||
'get',
|
||||
\single_button::BUTTON_SECONDARY,
|
||||
[
|
||||
'class' => 'btn btn-secondary',
|
||||
'data-courseid' => $courseid,
|
||||
'data-itemid' => -1,
|
||||
'data-trigger' => 'add-outcome-form',
|
||||
'data-gprplugin' => 'tree'
|
||||
'data-gprplugin' => 'tree',
|
||||
]
|
||||
);
|
||||
$data['addoutcomeitembutton'] = $addoutcomeitembutton->export_for_template($output);
|
||||
}
|
||||
|
||||
// Add a button to the action bar with a link to the 'add category' page.
|
||||
$addgradecategorybutton = new \single_button(
|
||||
$addgradeitemlink,
|
||||
// Add a button to the action bar dropdown with a link to the 'add category' modal.
|
||||
$actions[] = new \action_menu_link_secondary(
|
||||
$additemurl,
|
||||
null,
|
||||
get_string('addcategory', 'grades'),
|
||||
'get',
|
||||
\single_button::BUTTON_SECONDARY,
|
||||
[
|
||||
'data-courseid' => $courseid,
|
||||
'data-category' => -1,
|
||||
'data-trigger' => 'add-category-form',
|
||||
'data-gprplugin' => 'tree'
|
||||
'data-gprplugin' => 'tree',
|
||||
]
|
||||
);
|
||||
$data['addcategorybutton'] = $addgradecategorybutton->export_for_template($output);
|
||||
|
||||
$addmenu = new \action_menu($actions);
|
||||
$addmenu->set_menu_trigger(get_string('add'), 'btn font-weight-bold');
|
||||
$data['addmenu'] = $addmenu->export_for_template($output);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
@ -18,9 +18,7 @@
|
||||
|
||||
Context variables required for this template:
|
||||
* generalnavselector - The data object containing the required properties to render the general navigation selector.
|
||||
* addgradeitembutton - The data object containing the required properties to render the 'add grade item' button.
|
||||
* addoutcomeitembutton - The data object containing the required properties to render the 'add outcome item' button.
|
||||
* addcategorybutton - The data object containing the required properties to render the 'add category' button.
|
||||
* addmenu - The data object containing the required properties to render the 'Add' action menu.
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
@ -62,39 +60,17 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"addgradeitembutton": {
|
||||
"id": "single_button12345",
|
||||
"method" : "get",
|
||||
"classes": "singlebutton",
|
||||
"formid": null,
|
||||
"url" : "#",
|
||||
"primary" : false,
|
||||
"tooltip" : null,
|
||||
"label" : "Add grade item",
|
||||
"attributes": []
|
||||
},
|
||||
"addoutcomeitembutton": {
|
||||
"id": "single_button13245",
|
||||
"method" : "get",
|
||||
"classes": "singlebutton",
|
||||
"formid": null,
|
||||
"url" : "#",
|
||||
"primary" : false,
|
||||
"tooltip" : null,
|
||||
"label" : "Add outcome item",
|
||||
"attributes": []
|
||||
},
|
||||
"addcategorybutton": {
|
||||
"id": "single_button14325",
|
||||
"method" : "get",
|
||||
"classes": "singlebutton",
|
||||
"formid": null,
|
||||
"url" : "#",
|
||||
"primary" : false,
|
||||
"tooltip" : null,
|
||||
"label" : "Add category",
|
||||
"attributes": []
|
||||
}
|
||||
"addmenu": [
|
||||
{
|
||||
"classes": "",
|
||||
"primary": {
|
||||
"items": [{"rawhtml": "<p>Item in primary menu</p>"}]
|
||||
},
|
||||
"secondary": {
|
||||
"items": [{"rawhtml": "<p>Item in secondary menu</p>"}]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}}
|
||||
<div class="container-fluid tertiary-navigation full-width-bottom-border">
|
||||
@ -105,20 +81,12 @@
|
||||
</div>
|
||||
<div class="navitem-divider"></div>
|
||||
{{/generalnavselector}}
|
||||
{{#addgradeitembutton}}
|
||||
<div class="navitem">
|
||||
{{>core/single_button}}
|
||||
</div>
|
||||
{{/addgradeitembutton}}
|
||||
{{#addoutcomeitembutton}}
|
||||
<div class="navitem">
|
||||
{{>core/single_button}}
|
||||
</div>
|
||||
{{/addoutcomeitembutton}}
|
||||
{{#addcategorybutton}}
|
||||
<div class="navitem">
|
||||
{{>core/single_button}}
|
||||
</div>
|
||||
{{/addcategorybutton}}
|
||||
<div class="navitem-divider ml-auto"></div>
|
||||
<div class="navitem">
|
||||
{{#addmenu}}
|
||||
{{>core/action_menu}}
|
||||
{{/addmenu}}
|
||||
</div>
|
||||
<div class="navitem-divider"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user