MDL-64506 templates: Move BS2 labels to BS4 badges
[moodle.git] / admin / tool / lp / templates / user_competency_summary.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 tool_lp/user_competency_page
20     Moodle template for the the summary of a user competency
22     Classes required for JS:
23     * none
25     Data attributes required for JS:
26     * none
28     Context variables required for this template:
29     * usercompetencysummary - object containing:
30         * showrelatedcompetencies - boolean
31         * cangrade - boolean
32         * competency - competency summary record
33         * user - user record
34         * usercompetency - user competency record
35         * evidence - array of evidence
37     This template does not have an example context because it includes ajax functionality.
38 }}
39 <div data-region="user-competency-full-info" data-node="user-competency" data-competencyid="{{usercompetency.competencyid}}" data-userid="{{usercompetency.userid}}" data-region-id="{{uniqid}}">
40 <div data-region="competency-summary">
41     {{#competency}}
42         {{> tool_lp/competency_summary }}
43     {{/competency}}
44     <dl>
45         {{#usercompetency}}
46         <dt>{{#str}}reviewstatus, tool_lp{{/str}}</dt>
47         <dd data-region="user-competency-status">{{statusname}}
49             {{#isstatusinreview}}
50                 - {{reviewer.fullname}}
51             {{/isstatusinreview}}
53             {{#isrequestreviewallowed}}<button class="btn btn-secondary" data-action="request-review">{{#str}}requestreview, tool_lp{{/str}}</button>{{/isrequestreviewallowed}}
54             {{#iscancelreviewrequestallowed}}<button class="btn btn-secondary" data-action="cancel-review-request">{{#str}}cancelreviewrequest, tool_lp{{/str}}</button>{{/iscancelreviewrequestallowed}}
55             {{#isstartreviewallowed}}<button class="btn btn-secondary" data-action="start-review">{{#str}}startreview, tool_lp{{/str}}</button>{{/isstartreviewallowed}}
56             {{#isstopreviewallowed}}<button class="btn btn-secondary" data-action="stop-review">{{#str}}stopreview, tool_lp{{/str}}</button>{{/isstopreviewallowed}}
57         </dd>
58         <dt>{{#str}}proficient, tool_lp{{/str}}</dt>
59         <dd>
60             <span class="badge{{^proficiency}} badge-danger{{/proficiency}} pull-left">
61                 {{proficiencyname}}
62             </span>
63         </dd>
64         <dt>{{#str}}rating, tool_lp{{/str}}</dt>
65         <dd>{{gradename}}
66             {{#cangrade}}
67                 <button class="btn btn-secondary" id="rate_{{uniqid}}">{{#str}}rate, tool_lp{{/str}}</button>
68             {{/cangrade}}
69         </dd>
70         {{#js}}
71         require(['jquery', 'tool_lp/grade_user_competency_inline', 'tool_lp/user_competency_info', 'tool_lp/user_competency_workflow'], function($, mod, info, UserCompWorkflow) {
73             var competencyElement = $('[data-region-id="{{uniqid}}"]');
74             var infoReloader = new info(competencyElement, '{{competency.competency.id}}', '{{user.id}}');
76             var ucw = new UserCompWorkflow();
77             ucw.registerEvents('[data-region="user-competency-status"]');
78             ucw.on('status-changed', infoReloader.reload.bind(infoReloader));
79             ucw.on('error-occured', infoReloader.reload.bind(infoReloader));
81             var inlineGrader = new mod('#rate_{{uniqid}}', '{{competency.scaleid}}', '{{competency.competency.id}}', '{{user.id}}', '{{plan.id}}', '', '{{#str}}chooserating, tool_lp{{/str}}');
82             inlineGrader.on('competencyupdated', infoReloader.reload.bind(infoReloader));
83         });
84         {{/js}}
85         {{/usercompetency}}
86     </dl>
87     {{#commentarea}}
88         {{#canpostorhascomments}}
89             {{>tool_lp/comment_area}}
90         {{/canpostorhascomments}}
91     {{/commentarea}}
92     <dl data-region="evidence-listing">
93         <dt>{{#str}}evidence, tool_lp{{/str}}</dt>
94         <dd>
95             {{#evidence}}
96                 {{> tool_lp/evidence_summary }}
97             {{/evidence}}
98             {{^evidence}}
99                 <p>{{#str}}noevidence, tool_lp{{/str}}</p>
100             {{/evidence}}
101         </dd>
102     </dl>
103 </div>