MDL-61899 tool_dataprivacy: Addition of plugin compliance registry.
[moodle.git] / admin / tool / dataprivacy / templates / component_status.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/component_status
20     Data registry main page.
22     Classes required for JS:
23     * none
25     Data attributes required for JS:
26     * none
28     Context variables required for this template:
29     * none
31     Example context (json):
32     {
33         "compliant" : "True",
34         "raw_component" : "core_comment",
35         "component" : "Core comment",
36         "external" : "True",
37         "metadata" : {
38             "name" : "comments",
39             "type" : "database_table",
40             "summary" : "Stores comments of users",
41             "fields" : {
42                 "field_name" : "content",
43                 "field_summary" : "Stores the text of the content."
44             }
45         }
46     }
47 }}
49 <div class="row">
50     <div class="col">
51         {{#compliant}}
52             <a class="expand" data-component="{{raw_component}}" href='#'>
53             <h4 class="d-inline p-r-1 p-l-1" id="{{raw_component}}">{{#pix}}t/collapsed, moodle, {{#str}}expandplugin, tool_dataprivacy{{/str}}{{/pix}}{{component}}</h4>
54             </a>
55             <!-- <span class="badge badge-pill badge-success">{{#str}}compliant, tool_dataprivacy{{/str}}</span> -->
56         {{/compliant}}
57         {{^compliant}}
58             <h4 class="d-inline p-r-1 p-l-1" id="{{raw_component}}">{{component}}</h4>
59             <span>{{#pix}}i/risk_xss, moodle, {{#str}}requiresattention, tool_dataprivacy{{/str}}{{/pix}}</span>
60         {{/compliant}}
61         {{#external}}
62             <span class="badge badge-pill badge-notice">{{#str}}external, tool_dataprivacy{{/str}}</span>
63         {{/external}}
64     </div>
65 </div>
67     {{#compliant}}
68         <div class="hide" data-section="{{raw_component}}" aria-expanded="false">
69         {{#metadata}}
70                 <hr />
71                 <div class="row-fluid">
72                     <div class="span2 col-xs-3">
73                         {{#link}}
74                             <a href="#{{name}}"><h5>{{name}}</h5></a>
75                         {{/link}}
76                         {{^link}}
77                             <h5>{{name}}</h5>
78                         {{/link}}
79                         <div class="p-b-1 small text-muted">{{type}}</div>
80                     </div>
81                     <div class="span10 col-xs-9">{{summary}}</div>
82                 </div>
83                 <table class="table table-sm">
84                     <tbody>
85                     {{#fields}}
86                         <tr class="row">
87                             <td class="col-xs-3">{{field_name}}</td>
88                             <td class="col-xs-9">{{field_summary}}</td>
89                         </tr>
90                     {{/fields}}
91                     </tbody>
92                 </table>
93         {{/metadata}}
94         {{#nullprovider}}
95             <hr />
96             <div>{{nullprovider}}</div>
97         {{/nullprovider}}
98         </div>
99     {{/compliant}}
100 <hr />
103 {{#js}}
104 require(['jquery', 'core/url'], function($, url) {
106     var expandedImage = $('<img alt="" src="' + url.imageUrl('t/expanded') + '"/>');
107     var collapsedImage = $('<img alt="" src="' + url.imageUrl('t/collapsed') + '"/>');
109     $('.expand').click(function(e) {
110         e.preventDefault();
111         e.stopPropagation();
112         e.stopImmediatePropagation();
113         var component = $(this).data('component');
114         var metadata = $('[data-section=\'' + component + '\']');
115         var metainfo = metadata.attr('class');
116         if (metadata.attr('class') === 'hide') {
117             metadata.attr('class', 'visible');
118             $(this).children('img').attr('src', expandedImage.attr('src'));
119             metadata.attr('aria-expanded', true);
120         } else {
121             metadata.attr('class', 'hide');
122             $(this).children('img').attr('src', collapsedImage.attr('src'));
123             metadata.attr('aria-expanded', false);
124         }
125     });
126 });
127 {{/js}}