62 lines
2.2 KiB
Plaintext
62 lines
2.2 KiB
Plaintext
{{!
|
|
This file is part of Moodle - http://moodle.org/
|
|
Moodle is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
Moodle is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
You should have received a copy of the GNU General Public License
|
|
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
}}
|
|
{{!
|
|
@template core/local/comboboxsearch/resultset
|
|
|
|
Wrapping template for returned result items.
|
|
|
|
Context variables required for this template:
|
|
* instance - The instance ID of the combo box.
|
|
* results - Our returned results to render.
|
|
* searchterm - The entered text to find these results.
|
|
* hasresult - Allow the handling where no results exist for the returned search term.
|
|
|
|
Example context (json):
|
|
{
|
|
"instance": 25,
|
|
"results": [
|
|
{
|
|
"id": 2,
|
|
"name": "Foo bar"
|
|
},
|
|
{
|
|
"id": 3,
|
|
"name": "Bar Foo"
|
|
}
|
|
],
|
|
"searchterm": "Foo",
|
|
"hasresults": true
|
|
}
|
|
}}
|
|
<div class="d-flex flex-column mh-100 h-100">
|
|
<ul
|
|
id="{{$listid}}list{{/listid}}-{{instance}}-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"
|
|
>
|
|
{{#hasresults}}
|
|
{{$results}}
|
|
{{#results}}
|
|
{{>core/local/comboboxsearch/resultitem}}
|
|
{{/results}}
|
|
{{/results}}
|
|
{{$selectall}}{{/selectall}}
|
|
{{/hasresults}}
|
|
</ul>
|
|
{{^hasresults}}
|
|
<span class="small d-block px-4 mt-2 mb-4">{{#str}} noresultsfor, core, {{searchterm}}{{/str}}</span>
|
|
{{/hasresults}}
|
|
</div>
|