MDL-64506 templates: Move BS2 labels to BS4 badges
[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 33 "hasonbehalfagreements": true,
461b1931 34 "canrevoke": true,
cf398020 35 "policies": [
7d0fcb5c
AN
36 {
37 "versions": [
38 {
39 "isfirst": true,
40 "policyid": 1,
41 "viewurl": "/",
42 "name": "Terms &amp; conditions",
43 "revision": "2.0",
44 "hasarchived": true,
45 "timeaccepted": "1 Mar 2018",
ad5e2135
DM
46 "iscurrent": true,
47 "isoptional": false,
7d0fcb5c
AN
48 "agreement": {
49 "onbehalf": false,
50 "status": false,
51 "canaccept": true,
52 "acceptlink": "#"
53 }
54 },
55 {
56 "isfirst": false,
57 "policyid": 1,
58 "viewurl": "/",
59 "name": "Terms &amp; conditions",
60 "revision": "1.0-beta",
61 "acceptedby": "<a href=\"#\">Mary Smith</a>",
62 "note": "Based on parent's agreement via email",
63 "hasarchived": false,
64 "timeaccepted": "15 Feb 2018",
ad5e2135
DM
65 "iscurrent": true,
66 "isoptional": false,
7d0fcb5c
AN
67 "agreement": {
68 "onbehalf": true,
69 "status": true,
70 "canaccept": false
71 }
72 }
73 ]
74 }
75 ]
76 }
cf398020 77}}
461b1931
SA
78{{^canrevoke}}
79 <div class="alert alert-info">{{#str}} contactdpo, tool_policy {{/str}}</div>
80{{/canrevoke}}
81
cf398020
MG
82<table class="generaltable fullwidth">
83 <thead>
84 <tr>
7d0fcb5c
AN
85 <th>{{#str}} policydocname, tool_policy {{/str}}</th>
86 <th>{{#str}} policydocrevision, tool_policy {{/str}}</th>
4a742e4f
DM
87 <th>{{#str}} response, tool_policy {{/str}}</th>
88 <th>{{#str}} responseon, tool_policy {{/str}}</th>
7d0fcb5c 89 {{#hasonbehalfagreements}}
4a742e4f 90 <th>{{#str}} responseby, tool_policy {{/str}}</th>
7d0fcb5c
AN
91 <th>{{#str}} acceptancenote, tool_policy {{/str}}</th>
92 {{/hasonbehalfagreements}}
93 <th></th>
94 </tr>
cf398020
MG
95 </thead>
96 <tbody>
97 {{#policies}}
98 {{#versions}}
a22f7bbb
SA
99 {{#agreement}}
100 <tr {{^isfirst}}class="archived{{policyid}}" style="display:none"{{/isfirst}}>
101 <td>
102 {{^isfirst}}
103 <div style="float:left">
104 {{#pix}} level, tool_policy {{/pix}}
105 </div>
106 {{/isfirst}}
107 <div {{^isfirst}}style="margin-left: 24px" {{/isfirst}}>
108 <div><a href="{{viewurl}}">{{{name}}}</a></div>
cf398020 109 </div>
a22f7bbb
SA
110 </td>
111 <td>
112 <a href="{{viewurl}}">{{{revision}}}</a>
3f2c68f1
MM
113 {{#iscurrent}}<span class="badge badge-success">{{#str}} status1, tool_policy {{/str}}</span>{{/iscurrent}}
114 {{#isoptional}}<span class="badge badge-info">{{#str}} policydocoptionalyes, tool_policy {{/str}}</span>{{/isoptional}}
a22f7bbb
SA
115 </td>
116 <td>
cf398020 117 {{>tool_policy/user_agreement}}
a22f7bbb
SA
118 </td>
119 <td>{{timeaccepted}}</td>
120 {{#hasonbehalfagreements}}
121 <td>{{{acceptedby}}}</td>
122 <td>{{{note}}}</td>
123 {{/hasonbehalfagreements}}
124 <td>
125 {{#hasarchived}}<a class="showarchived" data-target=".archived{{policyid}}" data-status="hidden" href="#">
126 <div class="toggleoff" style="display:none">{{#pix}}t/less, moodle, {{#str}}detailedless, moodle{{/str}}{{/pix}}</div>
127 <div class="toggleon">{{#pix}}t/more, moodle, {{#str}}detailedmore, moodle{{/str}}{{/pix}}</div>
128 </a>{{/hasarchived}}
129 </td>
130 </tr>
131 {{/agreement}}
cf398020
MG
132 {{/versions}}
133 {{/policies}}
134 </tbody>
135</table>
136{{#returnurl}}
137 <div><a role="button" href="{{returnurl}}" class="btn btn-primary">{{#str}} back {{/str}}</a></div>
138{{/returnurl}}
139{{#js}}
140 require(['jquery'], function($) {
141 $('body').on('click', '.showarchived', function(e) {
142 e.preventDefault();
143 var target = $(this).attr('data-target'),
144 status = $(this).attr('data-status');
145 if (status === 'hidden') {
146 $(target).show();
147 $(this).attr('data-status', 'shown');
148 $(this).find('.toggleoff').show();
149 $(this).find('.toggleon').hide();
150 } else {
151 $(target).hide();
152 $(this).attr('data-status', 'hidden');
153 $(this).find('.toggleon').show();
154 $(this).find('.toggleoff').hide();
155 }
156 });
157 });
158{{/js}}