MDL-64506 templates: BS2 pull-x -> BS4 float-x
[moodle.git] / admin / tool / lp / templates / user_competency_summary_in_plan.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_summary_in_plan
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         * usercompetencyplan - user competency plan record
36         * evidence - array of evidence
37         * commentarea - comment block
38     * plan - plan summary record
39         * iscompleted - is completed
41     This template does not have an example context because it includes ajax functionality.
42 }}
43 {{#usercompetencysummary}}
44 <div data-region="user-competency-full-info" data-node="user-competency" data-competencyid="{{usercompetency.competencyid}}" data-userid="{{usercompetency.userid}}" data-region-id="{{uniqid}}">
45 <div>{{{plan.description}}}</div>
46 {{#plan.iscompleted}}
47 <div class="alert alert-info" role="alert">
48     {{#str}} usercompetencyfrozen, tool_lp {{/str}}
49 </div>
50 {{/plan.iscompleted}}
51 <div data-region="competency-summary">
52     {{#competency}}
53         {{> tool_lp/competency_summary }}
54     {{/competency}}
55     <dl>
56         {{#usercompetency}}
57         <dt>{{#str}}reviewstatus, tool_lp{{/str}}</dt>
58         <dd data-region="user-competency-status">{{statusname}}
60             {{#isstatusinreview}}
61                 - {{reviewer.fullname}}
62             {{/isstatusinreview}}
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}}
68         </dd>
69         <dt>{{#str}}proficient, tool_lp{{/str}}</dt>
70         <dd>
71             <span class="badge{{^proficiency}} badge-danger{{/proficiency}} float-left">
72                 {{proficiencyname}}
73             </span>
74         </dd>
75         <dt>{{#str}}rating, tool_lp{{/str}}</dt>
76         <dd>{{gradename}}
77             {{#cangrade}}
78                 <button class="btn btn-secondary" id="rate_{{uniqid}}">{{#str}}rate, tool_lp{{/str}}</button>
79             {{/cangrade}}
80         </dd>
81         {{#js}}
82         require(['jquery', 'tool_lp/grade_user_competency_inline', 'tool_lp/user_competency_info', 'tool_lp/user_competency_workflow'], function($, mod, info, UserCompWorkflow) {
84             var competencyElement = $('[data-region-id="{{uniqid}}"]');
85             var infoReloader = new info(competencyElement, '{{competency.competency.id}}', '{{user.id}}', '{{plan.id}}');
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));
92             {{#cangrade}}
93                 var inlineGrader = new mod('#rate_{{uniqid}}', '{{competency.scaleid}}', '{{competency.competency.id}}', '{{user.id}}', '{{plan.id}}', '', '{{#str}}chooserating, tool_lp{{/str}}');
94                 inlineGrader.on('competencyupdated', infoReloader.reload.bind(infoReloader));
95             {{/cangrade}}
96         });
97         {{/js}}
98         {{/usercompetency}}
99         {{#usercompetencyplan}}
100         <dt>{{#str}}rating, tool_lp{{/str}}</dt>
101         <dd>{{gradename}} - {{#str}}plancompleted, tool_lp{{/str}}</dd>
102         <dt>{{#str}}proficient, tool_lp{{/str}}</dt>
103         <dd>
104             <span class="badge{{^proficiency}} badge-danger{{/proficiency}} float-left">
105                 {{proficiencyname}}
106             </span>
107         </dd>
108         {{/usercompetencyplan}}
109     </dl>
110     {{#commentarea}}
111         {{#canpostorhascomments}}
112             {{>tool_lp/comment_area}}
113         {{/canpostorhascomments}}
114     {{/commentarea}}
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>
127 </div>
128 {{/usercompetencysummary}}