MDL-69453 core_form: improve form UI icons and alignment
[moodle.git] / lib / form / templates / element-radio.mustache
CommitLineData
e816b872
DP
1{{!
2 @template theme_boost/core_form/element-radio
3
4 Example context (json):
5 {
6 "element": {
c03f1de1
DM
7 "id": "id_test_radio0",
8 "name": "test_radio_button"
e816b872
DP
9 }
10 }
11
12}}
58488d0f 13<div class="form-group row {{#error}}has-danger{{/error}} fitem {{#advanced}}advanced{{/advanced}} {{{element.extraclasses}}}">
dc801cb6
MN
14 <div class="col-md-3">
15 {{#text}}
16 <label for="{{element.id}}">
17 {{{label}}}
18 </label>
19 {{/text}}
20 </div>
21 <div class="col-md-9 checkbox">
4d181caf
BB
22 <div class="form-check d-flex">
23 <label class="form-check-label">
24 {{^element.hardfrozen}}{{#element.frozen}}{{#element.checked}}
25 <input type="hidden" name="{{element.name}}" value="{{element.value}}">
26 {{/element.checked}}{{/element.frozen}}{{/element.hardfrozen}}
27 <input type="radio" class="form-check-input" {{^element.frozen}}name="{{element.name}}"{{/element.frozen}}
28 id="{{element.id}}" value="{{element.value}}"
29 {{#element.checked}}checked{{/element.checked}}
30 {{#element.frozen}}disabled{{/element.frozen}}
31 {{#error}}
32 autofocus aria-describedby="{{element.iderror}}"
33 {{/error}} {{{element.attributes}}} >
34 {{#text}}
35 {{{.}}}
36 {{/text}}
37 {{^text}}
38 {{{label}}}
39 {{/text}}
40 </label>
41 <span class="ml-2 d-flex align-items-center align-self-start">
42 {{#required}}
43 <div class="text-danger" title="{{#str}}required{{/str}}">
44 {{#pix}}req, core, {{#str}}required{{/str}}{{/pix}}
45 </div>
46 {{/required}}
47 {{{helpbutton}}}
48 </span>
fba3c3be 49 </div>
521989ec 50 <div class="form-control-feedback invalid-feedback" id="{{element.iderror}}" {{#error}} style="display: block;"{{/error}}>
344321e1
DW
51 {{{error}}}
52 </div>
53 </div>
54</div>
63e4df60 55{{^element.frozen}}
344321e1 56{{#js}}
2ede86d7 57require(['theme_boost/form-display-errors'], function(module) {
4691b2d0 58 module.enhance({{#quote}}{{element.id}}{{/quote}});
344321e1 59});
63e4df60
DW
60{{/js}}
61{{/element.frozen}}