MDL-59696 templates: Remove form-group div for url-select template
authorJun Pataleta <jun@moodle.com>
Mon, 21 Aug 2017 07:43:17 +0000 (15:43 +0800)
committerJun Pataleta <jun@moodle.com>
Mon, 4 Sep 2017 02:10:46 +0000 (10:10 +0800)
* Removed the div with the class 'form-group' that's enclosing the
select element and friends. It's not needed since the urlselect template
is an inline form.
* Also, for completeness, I added the helpicon data for the template's
context.

lib/templates/url_select.mustache

index b2ace98..0904896 100644 (file)
@@ -8,6 +8,19 @@
         "formid": "url_select_form",
         "sesskey": "sesskey",
         "label": "core/url_select",
+        "helpicon": {
+            "title": "Help with something",
+            "text": "Help with something",
+            "url": "http://example.org/help",
+            "linktext": "",
+            "icon":{
+                "extraclasses": "iconhelp",
+                "attributes": [
+                    {"name": "src", "value": "../../../pix/help.svg"},
+                    {"name": "alt", "value": "Help icon"}
+                ]
+            }
+        },
         "showbutton": "Go",
         "options": [{
             "name": "Group 1", "isgroup": true, "options":
 <div class="{{classes}}">
     <form method="post" action="{{action}}" class="form-inline" id="{{formid}}">
         <input type="hidden" name="sesskey" value="{{sesskey}}">
-        <div class="form-group">
-            {{#label}}
-                <label for="{{id}}"{{#labelattributes}} {{name}}="{{value}}"{{/labelattributes}}>
-                    {{label}}
-                </label>
-            {{/label}}
-            {{#helpicon}}
-                {{>core/help_icon}}
-            {{/helpicon}}
-            <select {{#attributes}}{{name}}="{{value}}" {{/attributes}} id="{{id}}" class="custom-select {{classes}}" name="jump">
-                {{#options}}
-                    {{#isgroup}}
-                        <optgroup label="{{name}}">
-                            {{#options}}
-                                <option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
-                            {{/options}}
-                        </optgroup>
-                    {{/isgroup}}
-                    {{^isgroup}}
-                        <option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
-                    {{/isgroup}}
-                {{/options}}
-            </select>
-        </div>
+        {{#label}}
+            <label for="{{id}}"{{#labelattributes}} {{name}}="{{value}}"{{/labelattributes}}>
+                {{label}}
+            </label>
+        {{/label}}
+        {{#helpicon}}
+            {{>core/help_icon}}
+        {{/helpicon}}
+        <select {{#attributes}}{{name}}="{{value}}" {{/attributes}} id="{{id}}" class="custom-select {{classes}}" name="jump">
+            {{#options}}
+                {{#isgroup}}
+                    <optgroup label="{{name}}">
+                        {{#options}}
+                            <option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
+                        {{/options}}
+                    </optgroup>
+                {{/isgroup}}
+                {{^isgroup}}
+                    <option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
+                {{/isgroup}}
+            {{/options}}
+        </select>
         {{#showbutton}}
             <input type="submit" class="btn btn-secondary" value="{{showbutton}}">
         {{/showbutton}}