MDL-64506 templates: Move BS2 labels to BS4 badges
[moodle.git] / admin / tool / lp / templates / user_competency_summary_in_plan.mustache
CommitLineData
0845a3a0
DW
1{{!
2 This file is part of Moodle - http://moodle.org/
3
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.
8
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.
13
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 tool_lp/user_competency_summary_in_plan
19
20 Moodle template for the the summary of a user competency
21
22 Classes required for JS:
23 * none
24
25 Data attributes required for JS:
26 * none
27
28 Context variables required for this template:
29 * usercompetencysummary - object containing:
30 * showrelatedcompetencies - boolean
31 * cangrade - boolean
0845a3a0
DW
32 * competency - competency summary record
33 * user - user record
34 * usercompetency - user competency record
e0820366 35 * usercompetencyplan - user competency plan record
0845a3a0 36 * evidence - array of evidence
e0820366 37 * commentarea - comment block
0845a3a0 38 * plan - plan summary record
e0820366 39 * iscompleted - is completed
0845a3a0
DW
40
41 This template does not have an example context because it includes ajax functionality.
42}}
43{{#usercompetencysummary}}
d17cbbfb 44<div data-region="user-competency-full-info" data-node="user-competency" data-competencyid="{{usercompetency.competencyid}}" data-userid="{{usercompetency.userid}}" data-region-id="{{uniqid}}">
cb22606c 45<div>{{{plan.description}}}</div>
e0820366
IT
46{{#plan.iscompleted}}
47<div class="alert alert-info" role="alert">
3ed982e1 48 {{#str}} usercompetencyfrozen, tool_lp {{/str}}
e0820366
IT
49</div>
50{{/plan.iscompleted}}
0845a3a0
DW
51<div data-region="competency-summary">
52 {{#competency}}
53 {{> tool_lp/competency_summary }}
54 {{/competency}}
55 <dl>
0845a3a0 56 {{#usercompetency}}
182f6092 57 <dt>{{#str}}reviewstatus, tool_lp{{/str}}</dt>
c008e92d
FM
58 <dd data-region="user-competency-status">{{statusname}}
59
60 {{#isstatusinreview}}
61 - {{reviewer.fullname}}
62 {{/isstatusinreview}}
63
207136f2
DW
64 {{#isrequestreviewallowed}}<button class="btn btn-secondary" data-action="request-review">{{#str}}requestreview, tool_lp{{/str}}</button>{{/isrequestreviewallowed}}
65 {{#iscancelreviewrequestallowed}}<button class="btn btn-secondary" data-action="cancel-review-request">{{#str}}cancelreviewrequest, tool_lp{{/str}}</button>{{/iscancelreviewrequestallowed}}
66 {{#isstartreviewallowed}}<button class="btn btn-secondary" data-action="start-review">{{#str}}startreview, tool_lp{{/str}}</button>{{/isstartreviewallowed}}
67 {{#isstopreviewallowed}}<button class="btn btn-secondary" data-action="stop-review">{{#str}}stopreview, tool_lp{{/str}}</button>{{/isstopreviewallowed}}
c008e92d 68 </dd>
9f422dc2 69 <dt>{{#str}}proficient, tool_lp{{/str}}</dt>
0845a3a0 70 <dd>
3f2c68f1 71 <span class="badge{{^proficiency}} badge-danger{{/proficiency}} pull-left">
9f422dc2
DW
72 {{proficiencyname}}
73 </span>
74 </dd>
75 <dt>{{#str}}rating, tool_lp{{/str}}</dt>
76 <dd>{{gradename}}
5cb320c1 77 {{#cangrade}}
207136f2 78 <button class="btn btn-secondary" id="rate_{{uniqid}}">{{#str}}rate, tool_lp{{/str}}</button>
5cb320c1 79 {{/cangrade}}
0845a3a0
DW
80 </dd>
81 {{#js}}
c008e92d 82 require(['jquery', 'tool_lp/grade_user_competency_inline', 'tool_lp/user_competency_info', 'tool_lp/user_competency_workflow'], function($, mod, info, UserCompWorkflow) {
0845a3a0 83
d17cbbfb 84 var competencyElement = $('[data-region-id="{{uniqid}}"]');
0845a3a0
DW
85 var infoReloader = new info(competencyElement, '{{competency.competency.id}}', '{{user.id}}', '{{plan.id}}');
86
c008e92d
FM
87 var ucw = new UserCompWorkflow();
88 ucw.registerEvents('[data-region="user-competency-status"]');
89 ucw.on('status-changed', infoReloader.reload.bind(infoReloader));
90 ucw.on('error-occured', infoReloader.reload.bind(infoReloader));
91
5cb320c1
DW
92 {{#cangrade}}
93 var inlineGrader = new mod('#rate_{{uniqid}}', '{{competency.scaleid}}', '{{competency.competency.id}}', '{{user.id}}', '{{plan.id}}', '', '{{#str}}chooserating, tool_lp{{/str}}');
d17cbbfb 94 inlineGrader.on('competencyupdated', infoReloader.reload.bind(infoReloader));
5cb320c1 95 {{/cangrade}}
0845a3a0 96 });
0845a3a0 97 {{/js}}
0845a3a0
DW
98 {{/usercompetency}}
99 {{#usercompetencyplan}}
c008e92d 100 <dt>{{#str}}rating, tool_lp{{/str}}</dt>
0845a3a0 101 <dd>{{gradename}} - {{#str}}plancompleted, tool_lp{{/str}}</dd>
0845a3a0
DW
102 <dt>{{#str}}proficient, tool_lp{{/str}}</dt>
103 <dd>
3f2c68f1 104 <span class="badge{{^proficiency}} badge-danger{{/proficiency}} pull-left">
0845a3a0
DW
105 {{proficiencyname}}
106 </span>
107 </dd>
108 {{/usercompetencyplan}}
109 </dl>
c008e92d 110 {{#commentarea}}
47cddb9c
FM
111 {{#canpostorhascomments}}
112 {{>tool_lp/comment_area}}
113 {{/canpostorhascomments}}
c008e92d 114 {{/commentarea}}
0845a3a0
DW
115 <dl data-region="evidence-listing">
116 <dt>{{#str}}evidence, tool_lp{{/str}}</dt>
117 <dd>
118 {{#evidence}}
119 {{> tool_lp/evidence_summary }}
120 {{/evidence}}
121 {{^evidence}}
122 <p>{{#str}}noevidence, tool_lp{{/str}}</p>
123 {{/evidence}}
124 </dd>
125 </dl>
126</div>
e0820366 127</div>
0845a3a0
DW
128{{/usercompetencysummary}}
129