MDL-64506 templates: Move BS2 labels to BS4 badges
[moodle.git] / admin / tool / dataprivacy / templates / my_data_requests.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 comments.
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_dataprivacy/my_data_requests
20     A user's data requests page.
22     Classes required for JS:
23     * requestactions
25     Data attributes required for JS:
26     * none
28     Context variables required for this template:
29     * requests - Array of data requests.
31     Example context (json):
32     {
33         "requests": [
34             {
35                 "id": 1,
36                 "typename" : "Data export",
37                 "comments": "I would like to download all of my daughter's personal data",
38                 "statuslabelclass": "badge-secondary",
39                 "statuslabel": "Pending",
40                 "timecreated" : 1517902087,
41                 "requestedbyuser" : {
42                     "fullname": "Martha Smith",
43                     "profileurl": "#"
44                 }
45             },
46             {
47                 "id": 2,
48                 "typename" : "Data export",
49                 "comments": "Give me all of the information you have about me, or else...",
50                 "statuslabelclass": "badge-warning",
51                 "statuslabel": "Awaiting completion",
52                 "timecreated" : 1517902087,
53                 "requestedbyuser" : {
54                     "fullname": "Martha Smith",
55                     "profileurl": "#"
56                 }
57             },
58             {
59                 "id": 3,
60                 "typename" : "Data deletion",
61                 "comments": "Please delete all of my son's personal data.",
62                 "statuslabelclass": "badge-success",
63                 "statuslabel": "Deleted",
64                 "timecreated" : 1517902087,
65                 "requestedbyuser" : {
66                     "fullname": "Martha Smith",
67                     "profileurl": "#"
68                 }
69             },
70             {
71                 "id": 4,
72                 "typename" : "Data deletion",
73                 "comments": "Delete my data or I'm coming for you...",
74                 "statuslabelclass": "label-danger",
75                 "statuslabel": "Rejected",
76                 "timecreated" : 1517902087,
77                 "requestedbyuser" : {
78                     "fullname": "Martha Smith",
79                     "profileurl": "#"
80                 }
81             },
82             {
83                 "id": 5,
84                 "typename" : "Data export",
85                 "comments": "Please let me download my data",
86                 "statuslabelclass": "badge-info",
87                 "statuslabel": "Processing",
88                 "timecreated" : 1517902087,
89                 "requestedbyuser" : {
90                     "fullname": "Martha Smith",
91                     "profileurl": "#"
92                 }
93             },
94             {
95                 "id": 6,
96                 "typename" : "Data export",
97                 "comments": "Please let me download my data",
98                 "statuslabelclass": "label",
99                 "statuslabel": "Expired",
100                 "statuslabeltitle": "Download has expired. Submit a new request if you wish to export your personal data.",
101                 "timecreated" : 1517902087,
102                 "requestedbyuser" : {
103                     "fullname": "Martha Smith",
104                     "profileurl": "#"
105                 }
106             }
107         ]
108     }
109 }}
111 {{#httpsite}}
112     {{> core/notification_warning}}
113 {{/httpsite}}
115 <div data-region="datarequests">
116     <div class="m-t-1 m-b-1">
117         <a href="{{newdatarequesturl}}" class="btn btn-primary" data-action="new-request">
118             {{#str}}newrequest, tool_dataprivacy{{/str}}
119         </a>
120     </div>
121     <table class="generaltable fullwidth">
122         <thead>
123             <tr>
124                 <th scope="col">{{#str}}requesttype, tool_dataprivacy{{/str}}</th>
125                 <th scope="col">{{#str}}daterequested, tool_dataprivacy{{/str}}</th>
126                 <th scope="col">{{#str}}requestby, tool_dataprivacy{{/str}}</th>
127                 <th scope="col">{{#str}}requeststatus, tool_dataprivacy{{/str}}</th>
128                 <th scope="col" colspan="2">{{#str}}message, tool_dataprivacy{{/str}}</th>
129             </tr>
130         </thead>
131         <tbody>
132             {{#requests}}
133             <tr {{!
134               }} data-region="request-node"{{!
135               }} data-id="{{id}}"{{!
136               }} data-type="{{type}}"{{!
137               }} data-status="{{status}}"{{!
138               }}>
139                 <td>{{typename}}</td>
140                 <td>{{#userdate}} {{timecreated}}, {{#str}} strftimedatetime {{/str}} {{/userdate}}</td>
141                 <td><a href="{{requestedbyuser.profileurl}}" title="{{#str}}viewprofile{{/str}}">{{requestedbyuser.fullname}}</a></td>
142                 <td>
143                     <span class="badge {{statuslabelclass}}" title="{{statuslabeltitle}}">{{statuslabel}}</span>
144                 </td>
145                 <td>{{comments}}</td>
146                 <td>
147                     {{#actions}}
148                         {{> core/action_menu}}
149                     {{/actions}}
150                 </td>
151             </tr>
152             {{/requests}}
153             {{^requests}}
154             <tr>
155                 <td class="text-muted" colspan="5">
156                     {{#str}}nopersonaldatarequests, tool_dataprivacy{{/str}}
157                 </td>
158             </tr>
159             {{/requests}}
160         </tbody>
161     </table>
162 </div>
164 {{#js}}
165 // Initialise the JS.
166 require(['tool_dataprivacy/myrequestactions'], function(ActionsMod) {
167     ActionsMod.init();
168 });
169 {{/js}}