Merge branch 'MDL-70789-311' of git://github.com/paulholden/moodle into MOODLE_311_STABLE
[moodle.git] / lib / templates / search_input.mustache
blob400a62e37c0d1814fba8c41934582b0d720b643f
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/>.
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         "inform": false,
28         "searchstring": "Search settings",
29         "value": "policy",
30         "btnclass": "primary",
31         "query": "themedesigner",
32         "hiddenfields": [
33             {
34                 "name": "context",
35                 "value": "11"
36             }
37         ]
38     }
40 <div class="simplesearchform {{ extraclasses }}">
41     {{^inform}}
42     <form autocomplete="off" action="{{ action }}" method="get" accept-charset="utf-8" class="mform form-inline simplesearchform">
43     {{/inform}}
44     {{#hiddenfields}}
45         <input type="hidden" name="{{ name }}" value="{{ value }}">
46     {{/hiddenfields}}
47     <div class="input-group">
48         <label for="searchinput-{{uniqid}}">
49             <span class="sr-only">{{{ searchstring }}}</span>
50         </label>
51         <input type="text"
52            id="searchinput-{{uniqid}}"
53            class="form-control"
54            placeholder="{{ searchstring }}"
55            aria-label="{{ searchstring }}"
56            name="{{ inputname }}"
57            data-region="input"
58            autocomplete="off"
59            value="{{ query }}"
60         >
61         <div class="input-group-append">
62             <button type="submit" class="btn {{^btnclass}}btn-submit{{/btnclass}} {{ btnclass }} search-icon">
63                 {{#pix}} a/search, core {{/pix}}
64                 <span class="sr-only">{{ searchstring }}</span>
65             </button>
66         </div>
68     </div>
69     {{#otherfields}}
70         <div  class="ml-2">{{{ otherfields }}}</div>
71     {{/otherfields}}
72 {{^inform}}
73     </form>
74 {{/inform}}
75 </div>