MDL-64506 templates: BS2 pull-x -> BS4 float-x
[moodle.git] / admin / tool / lp / templates / manage_templates_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 learning plan templates template.
20     Classes required for JS:
21     * drag-parentnode
22     * drag-samenode
23     * templateactions
25     Data attibutes required for JS:
26     * data-region = managetemplates
27     * data-templateid = id
28     * data-action = deletetemplate
30     Context variables required for this template:
31     * templates - array of objects containing id, shortname, visible, canmanage, contextname
32     * navigation - array of strings containing buttons for navigation
33 }}
34 <div data-region="managetemplates">
35 <div class="float-left">
36     {{#navigation}}
37     {{{.}}}
38     {{/navigation}}
39 </div>
40 <table class="generaltable fullwidth managetemplates">
41     <caption>{{#str}}listtemplatescaption, tool_lp{{/str}}</caption>
42     <thead>
43         <tr>
44             <th scope="col">{{#str}}templatename, tool_lp{{/str}}</th>
45             <th scope="col">{{#str}}category, tool_lp{{/str}}</th>
46             <th scope="col">{{#str}}cohorts, core_cohort{{/str}}</th>
47             <th scope="col">{{#str}}userplans, core_competency{{/str}}</th>
48             {{#canmanage}}
49             <th scope="col">{{#str}}actions, tool_lp{{/str}}</th>
50             {{/canmanage}}
51         </tr>
52     </thead>
53     <tbody class="drag-parentnode">
54         {{#templates}}
55         <tr class="drag-samenode" data-templateid="{{id}}">
56             <td><a href="{{pluginbaseurl}}/templatecompetencies.php?templateid={{id}}&amp;pagecontextid={{pagecontextid}}">{{{shortname}}}</a></span> {{^visible}}{{#str}}hiddenhint, tool_lp{{/str}}{{/visible}}</td>
57             <td>{{contextnamenoprefix}}</td>
58             <td><a class="template-cohorts" href="{{pluginbaseurl}}/template_cohorts.php?id={{id}}&amp;pagecontextid={{pagecontextid}}">{{cohortscount}}</a></td>
59             <td><a class="template-userplans" href="{{pluginbaseurl}}/template_plans.php?id={{id}}&amp;pagecontextid={{pagecontextid}}">{{planscount}}</a></td>
60             <td>
61             {{#canmanage}}
62             <ul class="templateactions">
63                 <li>
64                     <a href="#">{{#str}}edit{{/str}}</a><b class="caret"></b>
65                     <ul class="dropdown dropdown-menu">
66                         <li class="dropdown-item">
67                             <a href="{{pluginbaseurl}}/edittemplate.php?id={{id}}&amp;pagecontextid={{pagecontextid}}&amp;return=templates">
68                                 {{#pix}}t/edit{{/pix}} {{#str}}edit{{/str}}
69                             </a>
70                         </li>
71                         <li class="dropdown-item">
72                             <a data-action="duplicatetemplate" data-templateid="{{id}}" href="#">
73                                 {{#pix}}t/copy{{/pix}} {{#str}}duplicate{{/str}}
74                             </a>
75                         </li>
76                         <li class="dropdown-item">
77                             <a href="{{pluginbaseurl}}/template_plans.php?id={{id}}&amp;pagecontextid={{pagecontextid}}">
78                                 {{#pix}}t/add{{/pix}} {{#str}}createlearningplans, tool_lp{{/str}}
79                             </a>
80                         </li>
81                         <li class="dropdown-item">
82                             <a href="{{pluginbaseurl}}/template_cohorts.php?id={{id}}&amp;pagecontextid={{pagecontextid}}">
83                                 {{#pix}}t/add{{/pix}} {{#str}}addcohortstosync, tool_lp{{/str}}
84                             </a>
85                         </li>
86                         <li class="dropdown-item">
87                             <a data-action="deletetemplate" data-templateid="{{id}}" href="#">
88                                 {{#pix}}t/delete{{/pix}} {{#str}}delete{{/str}}
89                             </a>
90                         </li>
91                     </ul>
92                 </li>
93             </ul>
94             {{/canmanage}}
95             </td>
96         </tr>
97         {{/templates}}
98     </tbody>
99 </table>
100 {{^templates}}
101 <p class="alert alert-info">
102     {{#str}}notemplates, tool_lp{{/str}}
103 </p>
104 {{/templates}}
106 {{#js}}
107 // Initialise the JS.
108 require(['tool_lp/templateactions',
109          'tool_lp/menubar'],
110         function(actionsMod, menubar) {
112     actionsMod.init({{pagecontextid}});
114     menubar.enhance('.templateactions', {
115         '[data-action="deletetemplate"]': actionsMod.deleteHandler,
116         '[data-action="duplicatetemplate"]': actionsMod.duplicateHandler
117     });
118 });
120 {{/js}}
122 </div>