From 95a0ba16daeb670d62f6683386d2ef7a8c9938b9 Mon Sep 17 00:00:00 2001 From: Ilya Tregubov Date: Tue, 9 May 2023 15:37:44 +0800 Subject: [PATCH] MDL-75512 core_grades: Add sticky footer to setup page. --- grade/edit/tree/index.php | 4 ++ grade/templates/edit_tree.mustache | 28 ++-------- .../edit_tree_sticky_footer.mustache | 51 +++++++++++++++++++ 3 files changed, 58 insertions(+), 25 deletions(-) create mode 100644 grade/templates/edit_tree_sticky_footer.mustache diff --git a/grade/edit/tree/index.php b/grade/edit/tree/index.php index ae874d56f0e..5fe3b19b8f4 100644 --- a/grade/edit/tree/index.php +++ b/grade/edit/tree/index.php @@ -284,6 +284,10 @@ if ($moving) { new moodle_url('index.php', ['id' => $course->id]), get_string('cancel'), 'get'); } +$footercontent = $OUTPUT->render_from_template('core_grades/edit_tree_sticky_footer', $tpldata); +$stickyfooter = new core\output\sticky_footer($footercontent); +$tpldata->stickyfooter = $OUTPUT->render($stickyfooter); + echo $OUTPUT->render_from_template('core_grades/edit_tree', $tpldata); echo $OUTPUT->box_end(); diff --git a/grade/templates/edit_tree.mustache b/grade/templates/edit_tree.mustache index 86ad03a376c..e7f3f8cd790 100644 --- a/grade/templates/edit_tree.mustache +++ b/grade/templates/edit_tree.mustache @@ -23,10 +23,8 @@ * actionurl - string - Form action URL. * sesskey - string - The session key. * notification - object - Context data for the notification. - * showsave - boolean - Whether to show the save changes button. - * showbulkmove - boolean - Whether to show the bulk move select menu. * table - string - HTML content of the grade items table. - * bulkmoveoptions - array - Key-value pair array for the options of the the bulk move select menu element. + * stickyfooter - string - HTML content of the sticky footer. * cancelmovingbutton - HTML content of the cancel move button. Example context (json): @@ -35,11 +33,7 @@ "sesskey": "fakesesskey", "notification": "", "table": "
NameWeightsMax gradeActions
", - "showsave": "true", - "showbulkmove": "true", - "bulkmoveoptions": "{'value' : '1', 'name' : 'Test grade category'}", - "value": "1", - "name": "Test grade category", + "stickyfooter": "
", "cancelmovingbutton": "
" } }} @@ -51,23 +45,7 @@
{{{table}}} -
- {{#showsave}} - - {{/showsave}} - {{#showbulkmove}} -
- - - -
- {{/showbulkmove}} -
+ {{{stickyfooter}}}
{{{cancelmovingbutton}}} diff --git a/grade/templates/edit_tree_sticky_footer.mustache b/grade/templates/edit_tree_sticky_footer.mustache new file mode 100644 index 00000000000..8b6a2692881 --- /dev/null +++ b/grade/templates/edit_tree_sticky_footer.mustache @@ -0,0 +1,51 @@ +{{! + 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 . +}} +{{! + @template core_grades/edit_tree_sticky_footer + + Edit tree sticky footer template. + + Context variables required for this template: + * showsave - boolean - Whether to show the save changes button. + * showbulkmove - boolean - Whether to show the bulk move select menu. + * bulkmoveoptions - array - Key-value pair array for the options of the the bulk move select menu element. + Example context (json): + { + "showsave": "true", + "showbulkmove": "true", + "bulkmoveoptions": "{'value' : '1', 'name' : 'Test grade category'}", + "value": "1", + "name": "Test grade category" + } +}} +
+ {{#showbulkmove}} + + + + {{/showbulkmove}} +
+
+ {{#showsave}} + + {{/showsave}} +