1 |
efrain |
1 |
{{!
|
|
|
2 |
This file is part of Moodle - http://moodle.org/
|
|
|
3 |
Moodle is free software: you can redistribute it and/or modify
|
|
|
4 |
it under the terms of the GNU General Public License as published by
|
|
|
5 |
the Free Software Foundation, either version 3 of the License, or
|
|
|
6 |
(at your option) any later version.
|
|
|
7 |
Moodle is distributed in the hope that it will be useful,
|
|
|
8 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
9 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
10 |
GNU General Public License for more details.
|
|
|
11 |
You should have received a copy of the GNU General Public License
|
|
|
12 |
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
13 |
}}
|
|
|
14 |
{{!
|
|
|
15 |
@template core/local/comboboxsearch/resultset
|
|
|
16 |
|
|
|
17 |
Wrapping template for returned result items.
|
|
|
18 |
|
|
|
19 |
Context variables required for this template:
|
|
|
20 |
* results - Our returned results to render.
|
|
|
21 |
* searchterm - The entered text to find these results.
|
|
|
22 |
* hasresult - Allow the handling where no results exist for the returned search term.
|
|
|
23 |
* noresults - Our fall through case if nothing matches.
|
|
|
24 |
|
|
|
25 |
Example context (json):
|
|
|
26 |
{
|
|
|
27 |
"results": [
|
|
|
28 |
{
|
|
|
29 |
"id": 2,
|
|
|
30 |
"name": "Foo bar",
|
|
|
31 |
"link": "http://foo.bar/grade/report/grader/index.php?id=42&userid=2"
|
|
|
32 |
},
|
|
|
33 |
{
|
|
|
34 |
"id": 3,
|
|
|
35 |
"name": "Bar Foo",
|
|
|
36 |
"link": "http://foo.bar/grade/report/grader/index.php?id=42&userid=3"
|
|
|
37 |
}
|
|
|
38 |
],
|
|
|
39 |
"searchterm": "Foo",
|
|
|
40 |
"hasresults": true
|
|
|
41 |
}
|
|
|
42 |
}}
|
|
|
43 |
<div class="d-flex flex-column mh-100 h-100">
|
|
|
44 |
{{#hasresults}}
|
|
|
45 |
<ul id="{{$listid}}list{{/listid}}-result-listbox" class="searchresultitemscontainer d-flex flex-column mw-100 position-relative py-2 list-group h-100 mx-0 {{$listclasses}}{{/listclasses}}" role="listbox" data-region="search-result-items-container" tabindex="-1" aria-label="{{#cleanstr}} aria:dropdowngrades, core_grades {{/cleanstr}}">
|
|
|
46 |
{{$results}}
|
|
|
47 |
{{#results}}
|
|
|
48 |
{{>core/local/comboboxsearch/resultitem}}
|
|
|
49 |
{{/results}}
|
|
|
50 |
{{/results}}
|
|
|
51 |
{{$selectall}}{{/selectall}}
|
|
|
52 |
</ul>
|
|
|
53 |
{{/hasresults}}
|
|
|
54 |
{{^hasresults}}
|
|
|
55 |
<span class="small d-block px-2 my-2">{{#str}} noresultsfor, core, {{searchterm}}{{/str}}</span>
|
|
|
56 |
{{/hasresults}}
|
|
|
57 |
</div>
|