MDL-78258 libraries: upgrade lti1p3 to v5.4.1
[moodle.git] / message / templates / default_notification_preferences.mustache
blob17095853ac4aa675eb2460daa06a65720b7bd3e5
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/>.
17 {{!
18     @template core_message/default_notification_preferences
20     This template will render the default notification preferences for admin settings.
22     Classes required for JS:
23     * none
25     Data attributes required for JS:
26     * All data attributes are required
28     Context variables required for this template:
29     * providers Message providers
30     * components Provider components
31     * processors Message processors
32     * preferences Saved preferences
34     Example context (json):
35     {
36         "processors": [
37             {
38                 "displayname": "Web",
39                 "name": "popup"
40             }
41         ],
42         "components": [
43             {
44                 "displayname": "Assignment",
45                 "name": "mod_assign",
46                 "colspan": 3,
47                 "providers": [
48                     {
49                         "name": "assign_notification",
50                         "component": "mod_assign",
51                         "displayname": "Assignment notifications",
52                         "enabledsetting": "mod_assign_assign_notification_disable",
53                         "enabledlabel": "Sending Assignment enabled status",
54                         "enabled": 1,
55                         "settings": [
56                             {
57                                 "lockedsetting": "mod_assign_assign_notification_locked[popup]",
58                                 "locked": 1,
59                                 "lockedlabel": "Sending Assignment via Web locked status",
60                                 "enabledsetting": "mod_assign_assign_notification_enabled[popup]",
61                                 "enabled": 1,
62                                 "enabledlabel": "Sending Assignment via Web enabled status"
63                             }
64                         ]
65                     }
66                 ]
67             }
68         ]
69     }
71 <div class="preferences-page-container">
72     <h2>{{#str}} managemessageoutputs, message {{/str}}</h2>
74     <div class="preferences-container">
75         <table class="table table-hover preference-table">
76             <thead>
77                 <tr>
78                     <th></th>
79                     <th>{{#str}} enabled, core_message {{/str}}</th>
80                     {{#processors}}
81                         <th data-processor-name="{{name}}">{{{displayname}}}</th>
82                     {{/processors}}
83                 </tr>
84             </thead>
85             <tbody>
86                 {{#components}}
87                     <tr class="preference-row"><th colspan="{{{colspan}}}">{{{displayname}}}</th></tr>
88                     {{#providers}}
89                         <tr class="defaultmessageoutputs">
90                             <td>{{{displayname}}}</td>
91                             <td>
92                                 <div data-preference="{{{enabledsetting}}}">
93                                     <div class="custom-control custom-switch">
94                                         <input type="checkbox"
95                                             id="{{{enabledsetting}}}"
96                                             name="{{{enabledsetting}}}"
97                                             class="custom-control-input provider_enabled"
98                                             {{#enabled}}checked{{/enabled}}
99                                         >
100                                         <label for="{{{enabledsetting}}}" class="custom-control-label"
101                                             title="{{enabledlabel}}">
102                                             <span class="accesshide">{{enabledlabel}}</span>
103                                         </label>
104                                     </div>
105                                 </div>
106                             </td>
107                             {{#settings}}
108                                 <td class="text-left">
109                                     <div data-preference="{{{enabledsetting}}}">
110                                         <div class="custom-control custom-switch {{#locked}} dimmed_text{{/locked}} pb-1">
111                                             <input type="checkbox"
112                                                 id="{{{enabledsetting}}}"
113                                                 name="{{{enabledsetting}}}"
114                                                 class="custom-control-input enabled_message_setting"
115                                                 {{#enabled}}checked{{/enabled}}
116                                             >
117                                             <label for="{{{enabledsetting}}}" class="custom-control-label"
118                                                 title="{{enabledlabel}}">
119                                                 {{#str}} enabled, core_message {{/str}}
120                                             </label>
121                                         </div>
122                                     </div>
123                                     <div data-preference="{{{lockedsetting}}}">
124                                         <div class="custom-control custom-switch pt-1">
125                                             <input type="checkbox"
126                                                 id="{{{lockedsetting}}}"
127                                                 name="{{{lockedsetting}}}"
128                                                 class="custom-control-input locked_message_setting"
129                                                 {{#locked}}checked{{/locked}}
130                                             >
131                                             <label for="{{{lockedsetting}}}" class="custom-control-label"
132                                                 title="{{lockedlabel}}">
133                                                 {{#str}} forced, core_message {{/str}}
134                                             </label>
135                                         </div>
136                                     </div>
137                                 </td>
138                             {{/settings}}
139                         </tr>
140                     {{/providers}}
141                 {{/components}}
142             </tbody>
143         </table>
144     </div>
145 </div>
146 {{#js}}
147 require(['core_message/default_notification_preferences'], function(NotificationPreferences) {
148         NotificationPreferences.init();
149     });
150 {{/js}}