MDL-66893 mod_forum: update navigation bar in grader UI
[moodle.git] / mod / forum / templates / local / grades / grader.mustache
1 {{!
2     This file is part of Moodle - http://moodle.org/
4     Moodle is free software: you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation, either version 3 of the License, or
7     (at your option) any later version.
9     Moodle is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
14     You should have received a copy of the GNU General Public License
15     along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16 }}
17 {{!
18     @template mod_forum/local/grades/local/grader
20     Classes required for JS:
21     * TODO
23     Data attributes required for JS:
24     * data-first-userid="350"
25     * data-cmid="1337"
27     Context variables required for this template:
28     * userid: ID of the first user to jump to
29     * cmid: ID of the course module we want to grade
31     Example context (json):
32     {
33         "userid": 350,
34         "cmid": 1337
35     }
36 }}
37 <div
38     id="grader-container-{{uniqid}}"
39     class="d-flex flex-column h-100 unified-grader"
40     data-region="unified-grader"
41     {{#userid}}data-first-userid="{{.}}"{{/userid}}
42     data-cmid="{{cmid}}"
43 >
44     {{> mod_forum/local/grades/local/grader/navigation }}
46     <div class="d-flex flex-grow-1 h-100 position-relative">
47         {{#drawer}}{{> mod_forum/local/grades/local/grader/grading }}{{/drawer}}
48         {{> mod_forum/local/grades/local/grader/content }}
49     </div>
50 </div>
51 {{#js}}
52     require(['jquery', 'core/drawer'], function($, Drawer) {
53         var root = $('#grader-container-{{uniqid}}');
54         var drawer = root.find('[data-region="right-hand-drawer"]');
55         var expandButtons = root.find('[data-action="expand-grading-drawer"]');
56         var collapseButtons = root.find('[data-action="collapse-grading-drawer"]');
58         expandButtons.click(function() {
59             collapseButtons.removeClass('active');
60             expandButtons.addClass('active');
61             collapseButtons.attr('aria-expanded', true);
62             expandButtons.attr('aria-expanded', true);
63             Drawer.show(drawer);
64         });
66         collapseButtons.click(function() {
67             expandButtons.removeClass('active');
68             collapseButtons.addClass('active');
69             collapseButtons.attr('aria-expanded', false);
70             expandButtons.attr('aria-expanded', false);
71             Drawer.hide(drawer);
72         });
73     });
74 {{/js}}