MDL-64506 templates: replace spans where and col-x appears
[moodle.git] / admin / tool / analytics / templates / models_list.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 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/>.
16 }}
17 {{!
18     @template tool_analytics/models_list
20     Template for models list.
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         "models": [
34             {
35                 "target": "Prevent devs at risk",
36                 "targethelp": [
37                     {
38                         "title": "Help with something",
39                         "url": "http://example.org/help",
40                         "linktext": "",
41                         "icon":{
42                             "extraclasses": "iconhelp",
43                             "attributes": [
44                                 {"name": "src", "value": "../../../pix/help.svg"},
45                                 {"name": "alt", "value": "Help icon"}
46                             ]
47                         }
48                     }
49                 ],
50                 "enabled": 1,
51                 "indicators": [{
52                     "name": "Indicator 1",
53                     "help": [{
54                             "title": "Help with something",
55                             "url": "http://example.org/help",
56                             "linktext": "",
57                             "icon":{
58                                 "extraclasses": "iconhelp",
59                                 "attributes": [
60                                     {"name": "src", "value": "../../../pix/help.svg"},
61                                     {"name": "alt", "value": "Help icon"}
62                                 ]
63                             }
64                         }]
65                     },
66                     {
67                     "name": "Indicator 2",
68                     "help": [{
69                             "title": "Help with something",
70                             "url": "http://example.org/help",
71                             "linktext": "",
72                             "icon":{
73                                 "extraclasses": "iconhelp",
74                                 "attributes": [
75                                     {"name": "src", "value": "../../../pix/help.svg"},
76                                     {"name": "alt", "value": "Help icon"}
77                                 ]
78                             }
79                         }]
80                     }],
81                 "timesplitting": "Quarters",
82                 "timesplittinghelp": [
83                     {
84                         "title": "Help with something",
85                         "url": "http://example.org/help",
86                         "linktext": "",
87                         "icon":{
88                             "extraclasses": "iconhelp",
89                             "attributes": [
90                                 {"name": "src", "value": "../../../pix/help.svg"},
91                                 {"name": "alt", "value": "Help icon"}
92                             ]
93                         }
94                     }
95                 ],
96                 "noinsights": "No insights available yet"
97             }
98         ],
99         "warnings": {
100             "message": "Hey, this is a warning"
101         }
102     }
103 }}
105 {{#warnings}}
106     {{> core/notification_warning}}
107 {{/warnings}}
108 {{#infos}}
109     {{> core/notification_info}}
110 {{/infos}}
112 <div class="box">
113     <div class="top-nav d-flex">
114         <a href="{{createmodelurl}}" class="btn btn-secondary mr-2">{{#str}}createmodel, tool_analytics{{/str}}</a>
115         <a href="{{importmodelurl}}" class="btn btn-secondary">{{#str}}importmodel, tool_analytics{{/str}}</a>
116     </div>
117     <table class="generaltable fullwidth">
118         <caption>{{#str}}analyticmodels, tool_analytics{{/str}}</caption>
119         <thead>
120             <tr>
121                 <th scope="col">{{#str}}target, tool_analytics{{/str}}</th>
122                 <th scope="col">{{#str}}enabled, tool_analytics{{/str}}</th>
123                 <th scope="col">{{#str}}indicators, tool_analytics{{/str}}</th>
124                 <th scope="col">{{#str}}modeltimesplitting, tool_analytics{{/str}}</th>
125                 <th scope="col">{{#str}}insights, tool_analytics{{/str}}</th>
126                 <th scope="col">{{#str}}actions{{/str}}</th>
127             </tr>
128         </thead>
129         <tbody>
130         {{#models}}
131             <tr>
132                 <td>
133                     <span class="target-name">{{target}}</span>
134                     {{#targethelp}}
135                         {{>core/help_icon}}
136                     {{/targethelp}}
137                 </td>
138                 <td>
139                     {{#enabled}}
140                         {{#pix}}i/checked, core, {{#str}}yes{{/str}}{{/pix}}
141                     {{/enabled}}
142                     {{^enabled}}
143                         {{#str}}no{{/str}}
144                     {{/enabled}}
145                 </td>
146                 <td>
147                     <ul>
148                     {{#indicators}}
149                         <li>
150                             {{name}}
151                             {{#help}}
152                                 {{>core/help_icon}}
153                             {{/help}}
154                         </li>
155                     {{/indicators}}
156                     </ul>
157                 </td>
158                 <td>
159                     {{#timesplitting}}
160                         {{timesplitting}}
161                         {{#timesplittinghelp}}
162                             {{>core/help_icon}}
163                         {{/timesplittinghelp}}
164                     {{/timesplitting}}
165                     {{^timesplitting}}
166                         {{#str}}notdefined, tool_analytics{{/str}}
167                         {{#timesplittinghelp}}
168                             {{>core/help_icon}}
169                         {{/timesplittinghelp}}
170                     {{/timesplitting}}
171                 </td>
172                 <td>
173                     {{! models_list renderer is responsible of sending one or the other}}
174                     {{#insights}}
175                         {{> core/single_select }}
176                     {{/insights}}
177                     {{#noinsights}}
178                         {{.}}
179                     {{/noinsights}}
180                 </td>
181                 <td>
182                     {{#actions}}
183                         {{> core/action_menu}}
184                     {{/actions}}
185                 </td>
186             </tr>
187         {{/models}}
188         </tbody>
189     </table>
190 </div>