a3d31cbda0dcd04d19f87d3a0b33401983f70ce9
[moodle.git] / grade / grading / form / rubric / templates / grades / grader / gradingpanel.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 gradingform_rubric/grades/grader/gradingpanel
20     Classes required for JS:
21     * none
23     Data attributes required for JS:
24     * none
26     Context variables required for this template:
27     * instanceid: Instance of the module this grading form belongs too
28     * criteria: A gradeable item in the Marking Guide
29     * id: The ID of the criteria
30     * description: Description of the criteria
31     * levels: The level that a criteria can be graded at
32     * criterionid: The ID of the criteria
33     * checked: Flag for if this is the currently selected level
34     * definition: Definition of the level
35     * remark: Text input for the teacher to relay to the student
37     Example context (json):
38     {
39         "instanceid": "42",
40         "criteria": [
41             {
42                 "id": 13,
43                 "description": "Show your motivation to rock climbing",
44                 "levels": [
45                     {
46                         "criterionid": 13,
47                         "checked": true,
48                         "definition": "Great work!"
49                     }
50                 ],
51                 "remark": "That's great!"
52             }
53         ]
54     }
55 }}
56 <form id="gradingform_rubric-{{uniqid}}">
57     <input type="hidden" name="instanceid" value="{{instanceid}}">
58     <div id="rubric-advancedgrading-{{uniqid}}" class="criterion">
59         {{#criteria}}
60             <div class="mb-3">
61                 <div class="d-flex align-items-center mb-2">
62                     <h5 class="px-0 mb-0 description font-weight-bold">{{{description}}}</h5>
63                     <button class="criterion-toggle btn btn-icon icon-no-margin text-reset p-0 font-weight-bold mb-0 ml-auto"
64                             type="button"
65                             data-toggle="collapse"
66                             data-target="#criteria-{{id}}"
67                             aria-expanded="true"
68                             aria-controls="criteria-{{id}}">
69                             <span class="collapsed-icon">
70                                 {{#pix}} t/collapsed, core {{/pix}}
71                                 <span class="sr-only">{{#str}} expandcriterion, core_grades {{/str}}</span>
72                             </span>
73                             <span class="expanded-icon">
74                                 {{#pix}} t/expanded, core {{/pix}}
75                                 <span class="sr-only">{{#str}} collapsecriterion, core_grades {{/str}}</span>
76                             </span>
77                     </button>
78                 </div>
79                 <div class="collapse show" id="criteria-{{id}}">
80                     {{#levels}}
81                         <div class="form-check">
82                             <input class="form-check-input level"
83                                    type="radio"
84                                    name="advancedgrading[criteria][{{criterionid}}][levelid]"
85                                    id="advancedgrading-criteria-{{criterionid}}-levels-{{id}}-definition"
86                                    value="{{id}}"
87                                     {{#checked}}
88                                         aria-checked="true"
89                                         tabindex="0"
90                                         checked
91                                     {{/checked}}
92                                     {{^checked}}
93                                         aria-checked="false"
94                                         tabindex="-1"
95                                     {{/checked}}
96                             >
97                             <label class="w-100" for="advancedgrading-criteria-{{criterionid}}-levels-{{id}}-definition">
98                                 <span>
99                                     {{{definition}}}
100                                 </span>
101                                 <span class="pull-right">
102                                     {{#str}}pointsvalue, gradingform_rubric, {{score}}{{/str}}
103                                 </span>
104                             </label>
105                         </div>
106                     {{/levels}}
107                     <div class="form-group">
108                         <label class="text-muted" for="advancedgrading-criteria-{{id}}-remark">{{#str}} additionalfeedback, core_grades {{/str}}</label>
109                         <textarea class="form-control"
110                                   name="advancedgrading[criteria][{{id}}][remark]"
111                                   id="advancedgrading-criteria-{{id}}-remark"
112                                   cols="10"
113                                   rows="1"
114                                   data-max-rows="5"
115                                   data-auto-rows="true"
116                         >{{{remark}}}</textarea>
117                     </div>
118                 </div>
119             </div>
120         {{/criteria}}
121     </div>
122 </form>
123 {{#js}}
124 require(['core/auto_rows'], function(AutoRows) {
125     AutoRows.init(document.getElementById('gradingform_rubric-{{uniqid}}'));
126 });
127 {{/js}}