MDL-61864 tool_policy: Fix whitespace issues
[moodle.git] / admin / tool / policy / templates / acceptances.mustache
CommitLineData
cf398020
MG
1{{!
2 This file is part of Moodle - http://moodle.org/
3
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.
8
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.
13
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_policy/acceptances
19
20 Template for the user acceptances page.
21
22 Classes required for JS:
23 -
24
25 Data attributes required for JS:
26 -
27
28 Context variables required for this template:
29 * policies
30
31 Example context (json):
7d0fcb5c 32 {
cf398020
MG
33 "hasonbehalfagreements": true,
34 "policies": [
7d0fcb5c
AN
35 {
36 "versions": [
37 {
38 "isfirst": true,
39 "policyid": 1,
40 "viewurl": "/",
41 "name": "Terms &amp; conditions",
42 "revision": "2.0",
43 "hasarchived": true,
44 "timeaccepted": "1 Mar 2018",
45 "agreement": {
46 "onbehalf": false,
47 "status": false,
48 "canaccept": true,
49 "acceptlink": "#"
50 }
51 },
52 {
53 "isfirst": false,
54 "policyid": 1,
55 "viewurl": "/",
56 "name": "Terms &amp; conditions",
57 "revision": "1.0-beta",
58 "acceptedby": "<a href=\"#\">Mary Smith</a>",
59 "note": "Based on parent's agreement via email",
60 "hasarchived": false,
61 "timeaccepted": "15 Feb 2018",
62 "agreement": {
63 "onbehalf": true,
64 "status": true,
65 "canaccept": false
66 }
67 }
68 ]
69 }
70 ]
71 }
cf398020
MG
72}}
73<table class="generaltable fullwidth">
74 <thead>
75 <tr>
7d0fcb5c
AN
76 <th>{{#str}} policydocname, tool_policy {{/str}}</th>
77 <th>{{#str}} policydocrevision, tool_policy {{/str}}</th>
78 <th>{{#str}} agreed, tool_policy {{/str}}</th>
79 <th>{{#str}} agreedon, tool_policy {{/str}}</th>
80 {{#hasonbehalfagreements}}
81 <th>{{#str}} agreedby, tool_policy {{/str}}</th>
82 <th>{{#str}} acceptancenote, tool_policy {{/str}}</th>
83 {{/hasonbehalfagreements}}
84 <th></th>
85 </tr>
cf398020
MG
86 </thead>
87 <tbody>
88 {{#policies}}
89 {{#versions}}
90 <tr {{^isfirst}}class="archived{{policyid}}" style="display:none"{{/isfirst}}>
91 <td>
92 {{^isfirst}}
93 <div style="float:left">
94 {{#pix}} level, tool_policy {{/pix}}
95 </div>
96 {{/isfirst}}
97 <div {{^isfirst}}style="margin-left: 24px" {{/isfirst}}>
98 <div><a href="{{viewurl}}">{{{name}}}</a></div>
99 </div>
100 </td>
101 <td>
102 <a href="{{viewurl}}">{{{revision}}}</a>
103 {{#iscurrent}}<span class="label label-success">{{#str}} status1, tool_policy {{/str}}{{/iscurrent}}
104 </td>
105 <td>
106 {{#agreement}}
107 {{>tool_policy/user_agreement}}
108 {{/agreement}}
109
110 </td>
111 <td>{{timeaccepted}}</td>
112 {{#hasonbehalfagreements}}
113 <td>{{{acceptedby}}}</td>
114 <td>{{{note}}}</td>
115 {{/hasonbehalfagreements}}
116 <td>
117 {{#hasarchived}}<a class="showarchived" data-target=".archived{{policyid}}" data-status="hidden" href="#">
118 <div class="toggleoff" style="display:none">{{#pix}}t/less, moodle, {{#str}}detailedless, moodle{{/str}}{{/pix}}</div>
119 <div class="toggleon">{{#pix}}t/more, moodle, {{#str}}detailedmore, moodle{{/str}}{{/pix}}</div>
120 </a>{{/hasarchived}}
121 </td>
122 </tr>
123 {{/versions}}
124 {{/policies}}
125 </tbody>
126</table>
127{{#returnurl}}
128 <div><a role="button" href="{{returnurl}}" class="btn btn-primary">{{#str}} back {{/str}}</a></div>
129{{/returnurl}}
130{{#js}}
131 require(['jquery'], function($) {
132 $('body').on('click', '.showarchived', function(e) {
133 e.preventDefault();
134 var target = $(this).attr('data-target'),
135 status = $(this).attr('data-status');
136 if (status === 'hidden') {
137 $(target).show();
138 $(this).attr('data-status', 'shown');
139 $(this).find('.toggleoff').show();
140 $(this).find('.toggleon').hide();
141 } else {
142 $(target).hide();
143 $(this).attr('data-status', 'hidden');
144 $(this).find('.toggleon').show();
145 $(this).find('.toggleoff').hide();
146 }
147 });
148 });
149{{/js}}