MDL-69454 core_search: consistent admin search
[moodle.git] / lib / templates / search_input.mustache
1 {{!
2     This file is part of Moodle - http://moodle.org/
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.
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.
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/search_input
20     Simple search input.
22     Example context (json):
23     {
24         "action": "https://moodle.local/admin/search.php",
25         "extraclasses": "my-2",
26         "inputname": "search",
27         "searchstring": "Search settings",
28         "value": "policy",
29         "btnclass": "primary",
30         "query": "themedesigner",
31         "hiddenfields": [
32             {
33                 "name": "context",
34                 "value": "11"
35             }
36         ]
37     }
38 }}
39 <div class="simplesearchform {{{ extraclasses }}}">
40     <form autocomplete="off" action="{{{ action }}}" method="get" accept-charset="utf-8" class="mform form-inline simplesearchform">
41     {{#hiddenfields}}
42         <input type="hidden" name="{{ name }}" value="{{ value }}">
43     {{/hiddenfields}}
44     <div class="input-group">
45         <label for="searchinput-{{uniqid}}">
46             <span class="sr-only">{{{ searchstring }}}</span>
47         </label>
48         <input type="text"
49            id="searchinput-{{uniqid}}"
50            class="form-control"
51            placeholder="{{{ searchstring }}}"
52            aria-label="{{{ searchstring }}}"
53            name="{{{ inputname }}}"
54            data-region="input"
55            autocomplete="off"
56            value="{{{ query }}}"
57         >
58         <div class="input-group-append">
59             <button type="submit" class="btn {{^btnclass}}btn-submit{{/btnclass}} {{{ btnclass }}} search-icon">
60                 {{#pix}} a/search, core {{/pix}}
61                 <span class="sr-only">{{{ searchstring }}}</span>
62             </button>
63         </div>
64     </div>
65 </form>
66 </div>