weekly release 3.7dev
[moodle.git] / theme / boost / templates / core_form / element-template.mustache
CommitLineData
a1f95d48
JD
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 @template core_form/element-template
19
20 Template for the form element wrapper template.
21
22 Context variables required for this template:
23 * label
24 * required
25 * advanced
26 * helpbutton
27 * error
28 * element
29 * id
30 * name
31
32 Example context (json):
33 {
34 "label": "Course full name",
35 "required": true,
36 "advanced": false,
37 "error": null,
38 "element": {
39 "id": "id_fullname",
40 "name": "fullname"
41 }
42 }
43}}
032674ee 44<div class="form-group row {{#error}}has-danger{{/error}} fitem {{#element.emptylabel}}femptylabel{{/element.emptylabel}} {{#advanced}}advanced{{/advanced}} {{{element.extraclasses}}}" {{#element.groupname}}data-groupname="{{.}}"{{/element.groupname}}>
63e4df60 45 <div class="col-md-3">
3ec69c2e 46 <span class="float-sm-right text-nowrap">
348aed80 47 {{#required}}<abbr class="initialism text-danger" title="{{#str}}required{{/str}}">{{#pix}}req, core, {{#str}}required{{/str}}{{/pix}}</abbr>{{/required}}
d91cbe1e 48 {{#advanced}}<abbr class="initialism text-info" title="{{#str}}advanced{{/str}}">!</abbr>{{/advanced}}
ebdd54f4
DP
49 {{{helpbutton}}}
50 </span>
9e2f1312 51 {{^element.staticlabel}}
ebdd54f4 52 <label class="col-form-label d-inline {{#element.hiddenlabel}}sr-only{{/element.hiddenlabel}}" for="{{element.id}}">
63e4df60
DW
53 {{{label}}}
54 </label>
9e2f1312
DW
55 {{/element.staticlabel}}
56 {{#element.staticlabel}}
57 <span class="col-form-label d-inline-block {{#element.hiddenlabel}}sr-only{{/element.hiddenlabel}}">
58 {{{label}}}
59 </span>
60 {{/element.staticlabel}}
63e4df60
DW
61 </div>
62 <div class="col-md-9 form-inline felement" data-fieldtype="{{element.type}}">
344321e1
DW
63 {{$ element }}
64 <!-- Element goes here -->
65 {{/ element }}
3ec69c2e 66 <div class="form-control-feedback invalid-feedback" id="id_error_{{element.name}}" {{#error}} style="display: block;"{{/error}}>
344321e1
DW
67 {{{error}}}
68 </div>
69 </div>
70</div>
71{{#js}}
2ede86d7 72require(['theme_boost/form-display-errors'], function(module) {
4691b2d0 73 module.enhance({{#quote}}{{element.id}}{{/quote}});
344321e1 74});
bffc0ef1 75{{/js}}