cdc64d90f9e8d0ad6a35f95b313ae71af9a3ea29
[moodle.git] / admin / tool / lp / templates / manage_competency_frameworks_page.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     Manage competency frameworks template.
20     Classes required for JS:
21     * drag-parentnode
22     * drag-handlecontainer
23     * drag-samenode
24     * competencyframeworkactions
26     Data attributes required for JS:
27     * data-region = managecompetencies
28     * data-frameworkid = id
29     * data-action = deletecompetencyframework
31     Context variables required for this template:
32     * competencyframeworks - array of objects containing id, shortname, idnumber, visible
33     * canmanage - true if this user has permission to manage the frameworks
34     * navigation - array of strings containing buttons for navigation
35 }}
36 <div data-region="managecompetencies">
37 <div class="btn-group pull-right">
38     {{#navigation}}
39     {{{.}}}
40     {{/navigation}}
41 </div>
42 <table class="generaltable fullwidth managecompetencies">
43     <thead>
44         <tr>
45             <th scope="col">{{#str}}competencyframeworkname, tool_lp{{/str}}</th>
46             <th scope="col">{{#str}}competencies, tool_lp{{/str}}</th>
47             <th scope="col">{{#str}}context, core_role{{/str}}</th>
48             <th scope="col">{{#str}}actions, tool_lp{{/str}}</th>
49         </tr>
50     </thead>
51     <tbody class="drag-parentnode">
52         {{#competencyframeworks}}
53         <tr class="drag-samenode" data-frameworkid="{{id}}">
54             <td><span class="drag-handlecontainer"></span><span><a href="{{pluginbaseurl}}/competencies.php?competencyframeworkid={{id}}&amp;pagecontextid={{pagecontextid}}">{{shortname}} ({{idnumber}})</a></span> {{^visible}}{{#str}}hiddenhint, tool_lp{{/str}}{{/visible}}</td>
55             <td>{{competenciescount}}</td>
56             <td>{{contextname}}</td>
57             <td>
58             {{#canmanage}}
59             <ul title="{{#str}}edit{{/str}}" class="competencyframeworkactions">
60                 <li>
61                     <a href="#">{{#str}}edit{{/str}}</a><b class="caret"></b>
62                     <ul class="dropdown-menu">
63                         <li>
64                             <a href="{{pluginbaseurl}}/editcompetencyframework.php?id={{id}}&amp;pagecontextid={{pagecontextid}}">
65                                 {{#pix}}t/edit{{/pix}} {{#str}}edit{{/str}}
66                             </a>
67                         </li>
68                         <li>
69                             <a data-action="duplicatecompetencyframework" href="#" data-frameworkid="{{id}}">
70                                 {{#pix}}t/copy{{/pix}} {{#str}}duplicate{{/str}}
71                             </a>
72                         </li>
73                         <li>
74                             <a data-action="deletecompetencyframework" href="#" data-frameworkid="{{id}}">
75                                 {{#pix}}t/delete{{/pix}} {{#str}}delete{{/str}}
76                             </a>
77                         </li>
78                     </ul>
79                 </li>
80             </ul>
81             {{/canmanage}}
82             </td>
83         </tr>
84         {{/competencyframeworks}}
85     </tbody>
86 </table>
87 {{^competencyframeworks}}
88 <p class="alert-info">
89     {{#str}}nocompetencyframeworks, tool_lp{{/str}}
90 </p>
91 {{/competencyframeworks}}
93 {{#js}}
94 // Initialise the JS.
95 require(['tool_lp/frameworkactions',
96          'tool_lp/menubar'],
97         function(actionsMod, menubar) {
99     actionsMod.init({{pagecontextid}});
101     menubar.enhance('.competencyframeworkactions', {
102         "[data-action='deletecompetencyframework']": actionsMod.deleteHandler,
103         "[data-action='duplicatecompetencyframework']": actionsMod.duplicateHandler,
104     });
105 });
107 {{/js}}
109 </div>