MDL-64506 templates: Move BS2 labels to BS4 badges
[moodle.git] / admin / tool / lp / templates / plans_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     User learning plans page.
20     Classes required for JS:
21     * planactions
23     Data attributes required for JS:
24     * data-region = plans
25     * data-planid = plans.id
26     * data-userid = userid
27     * data-action = deleteplan
29     Context variables required for this template:
30     * userid - The plan user id
31     * pluginbaseurl - tool_lp base url
32     * plans - The list of learning plans
33     * navigation - array of strings containing buttons for navigation
34 }}
36 <div data-region="plans">
37 <div class="pull-left">
38     {{#navigation}}
39     {{{.}}}
40     {{/navigation}}
41 </div>
42 <table class="generaltable fullwidth">
43     <caption>{{#str}}listplanscaption, tool_lp{{/str}}</caption>
44     <thead>
45         <tr>
46             <th scope="col">{{#str}}planname, tool_lp{{/str}}</th>
47             <th scope="col">{{#str}}templatebased, tool_lp{{/str}}</th>
48             <th scope="col">{{#str}}status, tool_lp{{/str}}</th>
49             <th scope="col">{{#str}}actions, tool_lp{{/str}}</th>
50         </tr>
51     </thead>
52     <tbody>
53         {{#plans}}
54         <tr data-region="plan-node" data-id="{{id}}" data-userid="{{userid}}">
55             <td>
56                 <span><a href="{{pluginbaseurl}}/plan.php?id={{id}}">{{{name}}}</a></span>
57             </td>
58              <td>
59                {{#isbasedontemplate}}
60                <span class="badge badge-info">{{#str}}yes{{/str}}</span>
61                {{/isbasedontemplate}}
62                {{^isbasedontemplate}}
63                <span class="badge">{{#str}}no{{/str}}</span>
64                {{/isbasedontemplate}}
65             </td>
66             <td>{{statusname}}</td>
67             <td>
68             {{#canmanage}}
69                 <div style="display: inline-block;">
70                 <ul title="{{#str}}edit{{/str}}" class="planactions">
71                 <li>
72                     <a href="#">{{#str}}edit{{/str}}</a><b class="caret"></b>
73                     <ul class="dropdown dropdown-menu">
74                     <li class="{{^canbeedited}} disabled {{/canbeedited}} dropdown-item">
75                         <a href="{{#canbeedited}}
76                                     {{pluginbaseurl}}/editplan.php?id={{id}}&amp;userid={{userid}}&amp;return=plans
77                                  {{/canbeedited}}
78                                  {{^canbeedited}}
79                                     #
80                                  {{/canbeedited}}
81                                  ">
82                             {{#pix}}t/edit{{/pix}} {{#str}}editthisplan, tool_lp{{/str}}
83                         </a>
84                     </li>
85                     {{#isreopenallowed}}
86                     <li class="dropdown-item">
87                         <a data-action="plan-reopen" href="#">
88                             {{#pix}}t/edit{{/pix}} {{#str}}reopenplan, tool_lp{{/str}}
89                         </a>
90                     </li>
91                     {{/isreopenallowed}}
92                     {{#iscompleteallowed}}
93                     <li class="dropdown-item">
94                         <a data-action="plan-complete" href="#">
95                             {{#pix}}t/edit{{/pix}} {{#str}}completeplan, tool_lp{{/str}}
96                         </a>
97                     </li>
98                     {{/iscompleteallowed}}
99                     {{#isrequestreviewallowed}}
100                     <li class="dropdown-item">
101                         <a data-action="plan-request-review" href="#">{{#pix}}t/edit{{/pix}} {{#str}}requestreview, tool_lp{{/str}}</a>
102                     </li>
103                     {{/isrequestreviewallowed}}
104                     {{#iscancelreviewrequestallowed}}
105                     <li class="dropdown-item">
106                         <a data-action="plan-cancel-review-request" href="#">{{#pix}}t/edit{{/pix}} {{#str}}cancelreviewrequest, tool_lp{{/str}}</a>
107                     </li>
108                     {{/iscancelreviewrequestallowed}}
109                     {{#isstartreviewallowed}}
110                     <li class="dropdown-item">
111                         <a data-action="plan-start-review" href="#">{{#pix}}t/edit{{/pix}} {{#str}}startreview, tool_lp{{/str}}</a>
112                     </li>
113                     {{/isstartreviewallowed}}
114                     {{#isstopreviewallowed}}
115                     <li class="dropdown-item">
116                         <a data-action="plan-stop-review" href="#">{{#pix}}t/edit{{/pix}} {{#str}}stopreview, tool_lp{{/str}}</a>
117                     </li>
118                     {{/isstopreviewallowed}}
119                     {{#isapproveallowed}}
120                     <li class="dropdown-item">
121                         <a data-action="plan-approve" href="#">{{#pix}}t/edit{{/pix}} {{#str}}planapprove, tool_lp{{/str}}</a>
122                     </li>
123                     {{/isapproveallowed}}
124                     {{#isunapproveallowed}}
125                     <li class="dropdown-item">
126                         <a data-action="plan-unapprove" href="#">{{#pix}}t/edit{{/pix}} {{#str}}planunapprove, tool_lp{{/str}}</a>
127                     </li>
128                     {{/isunapproveallowed}}
129                     {{#isunlinkallowed}}
130                     <li class="dropdown-item">
131                         <a data-action="plan-unlink" href="#">
132                             {{#pix}}t/edit{{/pix}} {{#str}}unlinkplantemplate, tool_lp{{/str}}
133                         </a>
134                     </li>
135                     {{/isunlinkallowed}}
136                     <li class="dropdown-item">
137                         <a data-action="plan-delete" href="#">
138                             {{#pix}}t/delete{{/pix}} {{#str}}deletethisplan, tool_lp{{/str}}
139                         </a>
140                     </li>
141                     </ul>
142                 </ul>
143             </div>
144             {{/canmanage}}
145             </td>
146         </tr>
147         {{/plans}}
148     </tbody>
149 </table>
151 {{^plans}}
152 <p class="alert alert-info">
153     {{#str}}nouserplans, tool_lp{{/str}}
154 </p>
155 {{/plans}}
157 {{#canreaduserevidence}}
158 <div class="pull-left">
159     <a href="{{pluginbaseurl}}/user_evidence_list.php?userid={{userid}}">{{#str}}userevidence, tool_lp{{/str}}</a>
160 </div>
161 {{/canreaduserevidence}}
163 {{#js}}
164 // Initialise the JS.
165 require(['tool_lp/planactions'],
166         function(ActionsMod) {
168     var planActions = new ActionsMod('plans');
169     planActions.enhanceMenubar('.planactions');
170 });
172 {{/js}}
174 </div>