1441 |
ariadna |
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 |
Context variables required for this template:
|
|
|
19 |
* sitename - The name of the site
|
|
|
20 |
* output - The core renderer for the page
|
|
|
21 |
* bodyattributes - attributes for the body tag as a string of html attributes
|
|
|
22 |
* sidepreblocks - HTML for the blocks
|
|
|
23 |
* hasblocks - true if there are blocks on this page
|
|
|
24 |
* navdraweropen - true if the nav drawer should be open on page load
|
|
|
25 |
* regionmainsettingsmenu - HTML for the region main settings menu
|
|
|
26 |
* hasregionmainsettingsmenu - There is a region main settings menu on this page.
|
|
|
27 |
|
|
|
28 |
Example context (json):
|
|
|
29 |
{
|
|
|
30 |
"sitename": "Moodle",
|
|
|
31 |
"output": {
|
|
|
32 |
"doctype": "<!DOCTYPE html>",
|
|
|
33 |
"page_title": "Test page",
|
|
|
34 |
"favicon": "favicon.ico",
|
|
|
35 |
"main_content": "<h1>Headings make html validators happier</h1>"
|
|
|
36 |
},
|
|
|
37 |
"bodyattributes":"",
|
|
|
38 |
"sidepreblocks": "<h2>Blocks html goes here</h2>",
|
|
|
39 |
"hasblocks":true,
|
|
|
40 |
"navdraweropen":true,
|
|
|
41 |
"regionmainsettingsmenu": "",
|
|
|
42 |
"hasregionmainsettingsmenu": false
|
|
|
43 |
}
|
|
|
44 |
}}
|
|
|
45 |
{{> theme_universe/head }}
|
|
|
46 |
|
|
|
47 |
<body {{{ bodyattributes }}}>
|
|
|
48 |
{{> core/local/toast/wrapper}}
|
|
|
49 |
|
|
|
50 |
<div id="page-wrapper" class="d-print-block {{#output.courseheadermenu}}rui--course-with-nav{{/output.courseheadermenu}} {{^output.courseheadermenu}}rui--course-witout-nav{{/output.courseheadermenu}}">
|
|
|
51 |
|
|
|
52 |
{{{ output.standard_top_of_body_html }}}
|
|
|
53 |
|
|
|
54 |
|
|
|
55 |
|
|
|
56 |
{{> theme_universe/navbar }}
|
|
|
57 |
<div id="page" data-region="mainpage" data-usertour="scroller" class="drawers {{#topbarcustomhtml}}topbar--ext{{/topbarcustomhtml}} {{#output.show_course_filter}}{{#blockfilteropen}}show-drawer-left{{/blockfilteropen}}{{/output.show_course_filter}} {{#blockdraweropen}}show-hidden-drawer show-drawer-right{{/blockdraweropen}} drag-container">
|
|
|
58 |
|
|
|
59 |
<div id="topofscroll" class="main-inner">
|
|
|
60 |
<div id="page-content" class="page-content wrapper-fw">
|
|
|
61 |
|
|
|
62 |
<div class="drawer-toggles d-flex">
|
|
|
63 |
{{#hasblocks}}
|
|
|
64 |
<div id="sidepreopen-control" class="drawer-toggler drawer-right-toggle ml-auto d-print-none">
|
|
|
65 |
<button
|
|
|
66 |
class="btn border-0 icon-no-margin drawertoggle btn-close-drawer--right"
|
|
|
67 |
data-toggler="drawers"
|
|
|
68 |
data-action="toggle"
|
|
|
69 |
data-target="universe-drawers-blocks"
|
|
|
70 |
data-bs-toggle="tooltip"
|
|
|
71 |
data-bs-placement="right"
|
|
|
72 |
title="{{#str}}opendrawerblocks, core{{/str}}"
|
|
|
73 |
>
|
|
|
74 |
<span class="sr-only">{{#str}}opendrawerblocks, core{{/str}}</span>
|
|
|
75 |
<span class="dir-rtl-hide">
|
|
|
76 |
<svg width="20" height="20" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;">
|
|
|
77 |
<g transform="matrix(1,0,0,1,-2,0)">
|
|
|
78 |
<path d="M18.333,15L18.333,5C18.333,3.629 17.205,2.5 15.833,2.5L14.167,2.5C12.795,2.5 11.667,3.629 11.667,5L11.667,15C11.667,16.371 12.795,17.5 14.167,17.5L15.833,17.5C17.205,17.5 18.333,16.371 18.333,15Z" style="fill:none;fill-rule:nonzero;stroke:currentColor;stroke-width:1.67px;" />
|
|
|
79 |
</g>
|
|
|
80 |
<g transform="matrix(1,0,0,1,-2,0)">
|
|
|
81 |
<path d="M11.667,10L5,10M5,10L7.5,7.5M5,10L7.5,12.5" style="fill:none;fill-rule:nonzero;stroke:currentColor;stroke-width:1.25px;stroke-linecap:round;stroke-linejoin:round;" />
|
|
|
82 |
</g>
|
|
|
83 |
</svg>
|
|
|
84 |
</span>
|
|
|
85 |
<span class="dir-ltr-hide">
|
|
|
86 |
<svg width="20" height="20" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;">
|
|
|
87 |
<g transform="matrix(1,0,0,1,-2,0)">
|
|
|
88 |
<path d="M18.333,15L18.333,5C18.333,3.629 17.205,2.5 15.833,2.5L14.167,2.5C12.795,2.5 11.667,3.629 11.667,5L11.667,15C11.667,16.371 12.795,17.5 14.167,17.5L15.833,17.5C17.205,17.5 18.333,16.371 18.333,15Z" style="fill:none;fill-rule:nonzero;stroke:currentColor;stroke-width:1.67px;" />
|
|
|
89 |
</g>
|
|
|
90 |
<g transform="matrix(1,0,0,1,-2,0)">
|
|
|
91 |
<path d="M11.667,10L5,10M5,10L7.5,7.5M5,10L7.5,12.5" style="fill:none;fill-rule:nonzero;stroke:currentColor;stroke-width:1.25px;stroke-linecap:round;stroke-linejoin:round;" />
|
|
|
92 |
</g>
|
|
|
93 |
</svg>
|
|
|
94 |
</span>
|
|
|
95 |
</button>
|
|
|
96 |
</div>
|
|
|
97 |
{{/hasblocks}}
|
|
|
98 |
{{#output.show_course_filter}}
|
|
|
99 |
{{#showcoursefilter}}
|
|
|
100 |
<div class="drawer-toggler drawer-left-toggle ml-auto d-print-none">
|
|
|
101 |
<button
|
|
|
102 |
class="btn btn-dark drawertoggle btn-close-drawer--left"
|
|
|
103 |
data-toggler="drawers"
|
|
|
104 |
data-action="toggle"
|
|
|
105 |
data-target="theme-drawers-filter"
|
|
|
106 |
data-bs-toggle="tooltip"
|
|
|
107 |
data-bs-placement="left"
|
|
|
108 |
title="{{#str}}opendrawerblocks, core{{/str}}"
|
|
|
109 |
>
|
|
|
110 |
<span class="sr-only">{{#str}}opendrawerblocks, core{{/str}}</span>
|
|
|
111 |
<svg width="24px" height="24px" viewBox="0 0 24 24" stroke-width="1.5" fill="none" xmlns="http://www.w3.org/2000/svg" color="currentColor"><path d="M3 6H21" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M7 12L17 12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11 18L13 18" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg>
|
|
|
112 |
</button>
|
|
|
113 |
</div>
|
|
|
114 |
{{/showcoursefilter}}
|
|
|
115 |
{{/output.show_course_filter}}
|
|
|
116 |
</div>
|
|
|
117 |
|
|
|
118 |
<div id="region-main-box" class="region-main-course-wrapper">
|
|
|
119 |
|
|
|
120 |
<section id="region-main" aria-label="{{#str}}content{{/str}}">
|
|
|
121 |
|
|
|
122 |
<div class="rui-blocks-wrapper wrapper--with-margin wrapper-xl">
|
|
|
123 |
|
|
|
124 |
<div class="wrapper-page-withblocks">
|
|
|
125 |
{{{ output.breadcrumbs }}}
|
|
|
126 |
|
|
|
127 |
{{{coursepageinformationbanners}}}
|
|
|
128 |
|
|
|
129 |
<div class="wrapper-header">
|
|
|
130 |
{{#secondarymoremenu}}
|
|
|
131 |
<div class="secondary-navigation d-print-none">
|
|
|
132 |
{{> core/moremenu}}
|
|
|
133 |
</div>
|
|
|
134 |
{{/secondarymoremenu}}
|
|
|
135 |
{{{ output.simple_header }}}
|
|
|
136 |
</div>
|
|
|
137 |
|
|
|
138 |
{{#hasregionmainsettingsmenu}}
|
|
|
139 |
<div class="region_main_settings_menu_proxy"></div>
|
|
|
140 |
{{/hasregionmainsettingsmenu}}
|
|
|
141 |
{{{ output.course_content_header }}}
|
|
|
142 |
{{#headercontent}}
|
|
|
143 |
{{> core/activity_header }}
|
|
|
144 |
{{/headercontent}}
|
|
|
145 |
{{#overflow}}
|
|
|
146 |
<div class="tertiary-navigation d-inline-flex flex-wrap w-100">
|
|
|
147 |
<div class="navitem">
|
|
|
148 |
{{> core/url_select}}
|
|
|
149 |
</div>
|
|
|
150 |
</div>
|
|
|
151 |
{{/overflow}}
|
|
|
152 |
|
|
|
153 |
<div id="root" class="d-flex w-100">
|
|
|
154 |
{{#output.show_course_filter}}
|
|
|
155 |
{{< theme_universe/drawer }}
|
|
|
156 |
{{$id}}theme-drawers-filter{{/id}}
|
|
|
157 |
{{$drawerclasses}}drawer drawer-left{{#blockfilteropen}} show{{/blockfilteropen}}{{/drawerclasses}}
|
|
|
158 |
{{$drawercontent}}
|
|
|
159 |
<div id="courseFilter" class="rui-course-filter-wrapper p-2">
|
|
|
160 |
|
|
|
161 |
<div class="search-input-group d-inline-flex justify-content-between w-100" role="search">
|
|
|
162 |
<span class="search-input-icon">
|
|
|
163 |
<svg width="22" height="22" fill="none" viewBox="0 0 24 24">
|
|
|
164 |
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19.25 19.25L15.5 15.5M4.75 11C4.75 7.54822 7.54822 4.75 11 4.75C14.4518 4.75 17.25 7.54822 17.25 11C17.25 14.4518 14.4518 17.25 11 17.25C7.54822 17.25 4.75 14.4518 4.75 11Z"></path>
|
|
|
165 |
</svg>
|
|
|
166 |
</span>
|
|
|
167 |
<input
|
|
|
168 |
type="text"
|
|
|
169 |
data-region="input"
|
|
|
170 |
data-action="search"
|
|
|
171 |
id="filter-search-input"
|
|
|
172 |
class="search-input w-100 withclear"
|
|
|
173 |
placeholder="{{$placeholder}}{{#str}} search, core {{/str}}{{/placeholder}}"
|
|
|
174 |
name="search"
|
|
|
175 |
>
|
|
|
176 |
</div>
|
|
|
177 |
|
|
|
178 |
<div class="rui-course-filter-content">
|
|
|
179 |
{{#showlangfilter}}
|
|
|
180 |
<div class="filtering-group mt-2 rounded border" data-group-name="lang">
|
|
|
181 |
<h4 class="filtering-title">{{#str}} language, moodle {{/str}}</h4>
|
|
|
182 |
{{{ output.course_lang_list }}}
|
|
|
183 |
</div>
|
|
|
184 |
{{/showlangfilter}}
|
|
|
185 |
|
|
|
186 |
{{#showteachersfilter}}
|
|
|
187 |
<div class="filtering-group mt-2 rounded border" data-group-name="teachers">
|
|
|
188 |
<h4 class="filtering-title">{{#str}} teachers, moodle {{/str}}</h4>
|
|
|
189 |
{{{ output.course_teachers_list }}}
|
|
|
190 |
</div>
|
|
|
191 |
{{/showteachersfilter}}
|
|
|
192 |
|
|
|
193 |
{{{ output.course_customfilter1_list }}}
|
|
|
194 |
{{{ output.course_customfilter2_list }}}
|
|
|
195 |
{{{ output.course_customfilter3_list }}}
|
|
|
196 |
{{{ output.course_customfilter4_list }}}
|
|
|
197 |
{{{ output.course_customfilter5_list }}}
|
|
|
198 |
{{{ output.course_customfilter6_list }}}
|
|
|
199 |
|
|
|
200 |
</div>
|
|
|
201 |
|
|
|
202 |
</div>
|
|
|
203 |
{{/drawercontent}}
|
|
|
204 |
{{$drawerpreferencename}}coursefilter-on{{/drawerpreferencename}}
|
|
|
205 |
{{$forceopen}}{{#forceblockdraweropen}}1{{/forceblockdraweropen}}{{/forceopen}}
|
|
|
206 |
{{$drawerstate}}show-drawer-left{{/drawerstate}}
|
|
|
207 |
{{$tooltipplacement}}left{{/tooltipplacement}}
|
|
|
208 |
{{$drawercloseonresize}}1{{/drawercloseonresize}}
|
|
|
209 |
{{$closebuttontext}}{{#str}}closeblockdrawer, core{{/str}}{{/closebuttontext}}
|
|
|
210 |
{{/ theme_universe/drawer}}
|
|
|
211 |
{{/output.show_course_filter}}
|
|
|
212 |
<div class="col px-0">
|
|
|
213 |
{{{ output.main_content }}}
|
|
|
214 |
</div>
|
|
|
215 |
|
|
|
216 |
</div>
|
|
|
217 |
|
|
|
218 |
</div>
|
|
|
219 |
|
|
|
220 |
{{{ output.activity_navigation }}}
|
|
|
221 |
{{{ output.course_content_footer }}}
|
|
|
222 |
</section>
|
|
|
223 |
</div>
|
|
|
224 |
</div>
|
|
|
225 |
{{> theme_universe/footer }}
|
|
|
226 |
</div>
|
|
|
227 |
</div>
|
|
|
228 |
|
|
|
229 |
{{{ output.standard_after_main_region_html }}}
|
|
|
230 |
|
|
|
231 |
</div>
|
|
|
232 |
|
|
|
233 |
{{#js}}
|
|
|
234 |
{{#output.show_course_filter}}
|
|
|
235 |
const {FilteringFlow} = filteringjs;
|
|
|
236 |
|
|
|
237 |
const searchElement = document.querySelector('#filter-search-input');
|
|
|
238 |
searchElement.addEventListener('input', (event) => {
|
|
|
239 |
flow.filter();
|
|
|
240 |
});
|
|
|
241 |
|
|
|
242 |
class MyFlow extends FilteringFlow {
|
|
|
243 |
|
|
|
244 |
handleFilterResult(result) {
|
|
|
245 |
super.handleFilterResult(result);
|
|
|
246 |
for (const group of result.groups) {
|
|
|
247 |
for (const filter of group.filters) {
|
|
|
248 |
const filterElement = filter.schemaFilter.data.element;
|
|
|
249 |
// Update the number next to the filter to indicate how many items are or would be filtered
|
|
|
250 |
filterElement.querySelector('.total').innerText = `${filter.possibleItems.length}`;
|
|
|
251 |
}
|
|
|
252 |
}
|
|
|
253 |
}
|
|
|
254 |
|
|
|
255 |
getAllFilterNames(item) {
|
|
|
256 |
// Since we want to filter the entered search text by filftered name,
|
|
|
257 |
// this is the helper method used for the example only.
|
|
|
258 |
const result = [];
|
|
|
259 |
for (const groupName of item.getGroupNames()) {
|
|
|
260 |
for (const filterName of item.getFilterNames(groupName)) {
|
|
|
261 |
result.push(filterName);
|
|
|
262 |
}
|
|
|
263 |
}
|
|
|
264 |
return result;
|
|
|
265 |
}
|
|
|
266 |
|
|
|
267 |
get filteringOptions() {
|
|
|
268 |
return {
|
|
|
269 |
// The callback to prefilter items before actually filtering
|
|
|
270 |
filterItem: (item, schema, filterData) => {
|
|
|
271 |
for (const filterName of this.getAllFilterNames(item)) {
|
|
|
272 |
if (filterName.toLowerCase().includes(searchElement.value.toLowerCase())) {
|
|
|
273 |
// Return true if the item should be currently considered for filtering
|
|
|
274 |
return true;
|
|
|
275 |
}
|
|
|
276 |
}
|
|
|
277 |
return false;
|
|
|
278 |
}
|
|
|
279 |
};
|
|
|
280 |
}
|
|
|
281 |
}
|
|
|
282 |
|
|
|
283 |
const flow = new MyFlow(document.querySelector('#root'));
|
|
|
284 |
{{/output.show_course_filter}}
|
|
|
285 |
{{/js}}
|
|
|
286 |
|
|
|
287 |
</body>
|
|
|
288 |
</html>
|
|
|
289 |
{{#js}}
|
|
|
290 |
M.util.js_pending('theme_boost/loader');
|
|
|
291 |
require(['theme_boost/loader', 'theme_universe/drawer'], function(Loader, Drawer) {
|
|
|
292 |
Drawer.init();
|
|
|
293 |
M.util.js_complete('theme_boost/loader');
|
|
|
294 |
});
|
|
|
295 |
{{/js}}
|