Merge branch 'MDL-78543' of https://github.com/skodak/moodle
[moodle.git] / mod / bigbluebuttonbn / templates / participant_single_select.mustache
blob064505c7b657995495668175b63920461ff2e7e0
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 mod_bigbluebuttonbn/participant_single_select
20     Moodle template for a single select without the form and autosubmit
21     @see template core/single_select
23     The original select form produced two embedded form tags and would produce random
24     bugs (https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#form-owner)
27     Context variables required for this template:
28     * name - Element name.
29     * method - get or post.
30     * action - the action url to submit to.
31     * classes - Element classes.
32     * label - Element label.
33     * disabled - true if this element is disabled.
34     * title - Element title.
35     * formid - optional id value for the form.
36     * id - id for the element.
37     * params - array of params with name and value attributes.
38     * options - Array of options for the select with value, name , slected and optgroup properites.
39     * labelattributes - Label attributes.
40     * helpicon - Help icon.
42     Example context (json):
43     {
44         "name": "lang",
45         "method": "get",
46         "action": "http://localhost/stable_master/mod/scorm/player.php",
47         "classes": "langmenu",
48         "label": "Zombies are coming...",
49         "disabled": false,
50         "title": null,
51         "formid": "randomid",
52         "id": "single_select5833dd4f4b08d108",
53         "params": [
54             {
55                 "name": "scoid",
56                 "value": "12"
57             },
58             {
59                 "name": "cm",
60                 "value": "15"
61             },
62             {
63                 "name": "mode",
64                 "value": "review"
65             },
66             {
67                 "name": "currentorg",
68                 "value": "eXeMapADrive4823c6301cf72b22b72"
69             }
70         ],
71         "options": [
72             {
73                 "value": "en",
74                 "name": "English ‎(en)‎",
75                 "selected": true,
76                 "optgroup": false
77             },
78             {
79                 "value": "ar",
80                 "name": "Muhaaaa..",
81                 "selected": false,
82                 "optgroup": false
83             }
84         ],
85         "labelattributes": [],
86         "helpicon": false
87     }
90 <div class="{{classes}} d-inline-block">
91     {{#params}}
92         <input type="hidden" name="{{name}}" value="{{value}}">
93     {{/params}}
94     {{#label}}
95         <label for="{{id}}"{{#labelattributes}} {{name}}="{{value}}"{{/labelattributes}}>
96         {{{label}}}
97         </label>
98     {{/label}}
99     {{#helpicon}}
100         {{>core/help_icon}}
101     {{/helpicon}}
102     <select {{#attributes}}{{name}}="{{value}}" {{/attributes}} id="{{id}}" class="custom-select {{classes}}" name="{{name}}"
103     {{#title}}title="{{.}}"{{/title}} {{#disabled}}disabled{{/disabled}}>
104     {{#options}}
105         {{#optgroup}}
106             <optgroup label="{{name}}">
107                 {{#options}}
108                     <option value="{{value}}" {{#selected}}selected{{/selected}}>{{{name}}}</option>
109                 {{/options}}
110             </optgroup>
111         {{/optgroup}}
112         {{^optgroup}}
113             <option {{ignore}} value="{{value}}" {{#selected}}selected{{/selected}}>{{{name}}}</option>
114         {{/optgroup}}
115     {{/options}}
116     </select>
117     <noscript>
118         <input type="submit" class="btn btn-secondary ml-1" value="{{#str}}go, core{{/str}}">
119     </noscript>
120 </div>