MDL-64506 templates: Remove BS2 spans from elements.
[moodle.git] / group / templates / index.mustache
CommitLineData
3b586539
JP
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 core_group/index
19
20 Template for the Groups page.
21
22 Classes required for JS:
23 * none
24
25 Data attributes required for JS:
26 * none
27
28 Context variables required for this template:
29 * courseid int The course ID.
30 * selectedgroup string The initially selected group.
31 * editgroupsettingsdisabled bool Whether to disable the "Edit group settings" button on load.
32 * deletegroupdisabled bool Whether to disable the "Delete selected group" button on load.
33 * addmembersdisabled bool Whether to disable the "Add/remove users" button on load.
34 * groups array The list of groups.
35 * members array The list of members, grouped based on roles.
36 * undeletablegroups string A JSON string containing an array of group IDs that a user cannot delete.
37
38 Example context (json):
39 {
40 "courseid": "1",
41 "selectedgroup": "Group 1 (3)",
42 "editgroupsettingsdisabled": false,
43 "deletegroupdisabled": false,
44 "addmembersdisabled": false,
45 "groups": [
46 {
47 "value": "1",
48 "text": "Group 1 (3)",
49 "selected": true
50 },
51 {
52 "value": "2",
53 "text": "Group 2 (2)"
54 }
55 ],
56 "members": [
57 {
58 "role": "Student",
59 "rolemembers": [
60 {
61 "value": "1",
62 "text": "John Doe"
63 },
64 {
65 "value": "2",
66 "text": "Jane Doe"
67 },
68 {
69 "value": "3",
70 "text": "John Smith"
71 }
72 ]
73 }
74 ],
75 "undeletablegroups": "[1: true, 3: true]"
76 }
77}}
78<form id="groupeditform" action="index.php" method="post">
79 <div class="container-fluid groupmanagementtable">
80 <div class="row row-fluid rtl-compatible">
6ecc4459 81 <div class="col-md-6 m-b-1">
a7184670 82 <input type="hidden" name="id" value="{{courseid}}">
3b586539
JP
83 <div class="form-group">
84 <label for="groups">
85 <span id="groupslabel">{{#str}}groups{{/str}}</span>
86 <span id="thegrouping">&nbsp;</span>
87 </label>
88 <select name="groups[]" multiple="multiple" id="groups" size="15" class="form-control input-block-level">
89 {{#groups}}
90 <option value="{{value}}" {{#selected}}selected="selected"{{/selected}} title="{{{text}}}">{{{text}}}</option>
91 {{/groups}}
92 </select>
93 </div>
94 <div class="form-group">
95 <input type="submit" name="act_updatemembers" id="updatemembers" value="{{#str}}showmembersforgroup, group{{/str}}" class="btn btn-default" />
96 </div>
97 <div class="form-group">
98 <input type="submit" name="act_showgroupsettingsform" id="showeditgroupsettingsform" value="{{#str}}editgroupsettings, group{{/str}}" {{#editgroupsettingsdisabled}}disabled="disabled"{{/editgroupsettingsdisabled}} class="btn btn-default" />
99 </div>
100 <div class="form-group">
101 <input type="submit" name="act_deletegroup" id="deletegroup" value="{{#str}}deleteselectedgroup, group{{/str}}" {{#deletegroupdisabled}}disabled="disabled"{{/deletegroupdisabled}} class="btn btn-default" />
102 </div>
103 <div class="form-group">
104 <input type="submit" name="act_showcreateorphangroupform" id="showcreateorphangroupform" value="{{#str}}creategroup, group{{/str}}" class="btn btn-default" />
105 </div>
106 <div class="form-group">
107 <input type="submit" name="act_showautocreategroupsform" id="showautocreategroupsform" value="{{#str}}autocreategroups, group{{/str}}" class="btn btn-default" />
108 </div>
109 <div class="form-group">
110 <input type="submit" name="act_showimportgroups" id="showimportgroups" value="{{#str}}importgroups, group{{/str}}" class="btn btn-default" />
111 </div>
112 </div>
6ecc4459 113 <div class="col-md-6 m-b-1">
3b586539
JP
114 <div class="form-group">
115 <label for="members">
116 <span id="memberslabel">{{#str}}membersofselectedgroup, group{{/str}}</span>
117 <span id="thegroup">{{{selectedgroup}}}</span>
118 </label>
119 <select size="15" multiple="multiple" class="form-control input-block-level" id="members" name="user">
120 {{#members}}
121 <optgroup label="{{role}}">
122 {{#rolemembers}}
123 <option value="{{value}}">{{{text}}}‎</option>
124 {{/rolemembers}}
125 </optgroup>
126 {{/members}}
127 </select>
128 </div>
129 <div class="form-group">
130 <input type="submit" value="{{#str}}adduserstogroup, group{{/str}}" class="btn btn-default" {{#addmembersdisabled}}disabled="disabled"{{/addmembersdisabled}} name="act_showaddmembersform" id="showaddmembersform"/>
131 </div>
132 </div>
133 </div>
134 </div>
135</form>
136{{#js}}
137 require(['jquery', 'core/yui'], function($) {
138 $("#groups").change(function() {
139 M.core_group.membersCombo.refreshMembers();
140 });
141 M.core_group.init_index(Y, "{{wwwroot}}", {{courseid}});
142 var undeletableGroups = JSON.parse('{{{undeletablegroups}}}');
143 M.core_group.groupslist(Y, undeletableGroups);
144 });
145{{/js}}