MDL-66076 forumreport_summary: Groups filter made accessible
[moodle.git] / mod / forum / report / summary / templates / filters.mustache
CommitLineData
b29de56d
MH
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 forumreport_summary/filters
19
20 Summary report filters.
21
22 Example context (json):
23 {
24 "actionurl": "https://mymoodlesite.com/mod/forum/report/summary/index.php?courseid=2&forumid=2&perpage=50",
25 "hasgroups": true,
26 "filtergroupsname" : "Groups (all)",
27 "filtergroups": [
28 {
29 "gropuid": "1",
30 "groupname": "Group A",
31 "checked": true
32 },
33 {
34 "gropuid": "3",
35 "groupname": "Group C",
36 "checked": false
37 }
38 ]
39 }
40}}
41
42<div class="p-b-3" data-report-id="{{uniqid}}">
43 <form id="filtersform" name="filtersform" method="post" action="{{actionurl}}">
44 <input type="hidden" name="submitted" value="true">
45 <div id="filtersbuttons">
46 {{#hasgroups}}
cc15134c
MH
47 <button type="button" id="filter-groups-button" class="btn btn-primary rounded p-1" aria-expanded="false"
48 aria-haspopup="true" aria-label="{{# str}} filter:groupsbuttonlabel, forumreport_summary {{/ str}}">
b29de56d
MH
49 {{filtergroupsname}}
50 </button>
51
52 {{! Start groups filter popover}}
53 <div id="filter-groups-popover" class="popover m-t-1 hidden">
54 <h3 class="filter-header">{{# str}} filter:groupsname, forumreport_summary {{/ str}}</h3>
55 <div class="filter-body">
56 <div class="form-check filter-scrollable">
57 {{#filtergroups}}
58 <input id="filtergroups{{groupid}}" class="form-check-input" type="checkbox" name="filtergroups[]"
59 value="{{groupid}}" {{#checked}} checked="checked" {{/checked}}>
60 <label class="form-check-label pt-1" for="filtergroups{{groupid}}">{{groupname}}</label>
61 <br>
62 {{/filtergroups}}
63 <br>
64 </div>
cc15134c
MH
65 <div class="filter-actions">
66 <button type="button" class="select-all btn btn-link p-0 p-r-1" aria-label="{{# str}} selectall {{/ str}}">{{# str}} selectall {{/ str}}</button>
67 <div class="float-right">
68 <button type="button" class="filter-clear btn btn-link p-0 p-r-1" aria-label="{{# str}} clear {{/ str}}">{{# str}} clear {{/ str}}</button>
69 <button type="button" class="filter-save btn btn-link p-0" aria-label="{{# str}} save {{/ str}}">
70 <strong>{{# str}} save {{/ str}}</strong></button>
71 </div>
b29de56d
MH
72 </div>
73 </div>
74 </div>
75 {{! End groups filter popover}}
76 {{/hasgroups}}
77 </div>
78 </form>
79</div>
80
81{{#js}}
82require(['forumreport_summary/filters'], function(Filters) {
83 Filters.init(document.querySelector("[data-report-id='{{uniqid}}']"));
84});
85{{/js}}