MDL-56640 templates: add example content
authorDan Poltawski <dan@moodle.com>
Fri, 28 Oct 2016 16:38:35 +0000 (17:38 +0100)
committerDan Poltawski <dan@moodle.com>
Tue, 20 Dec 2016 10:02:06 +0000 (10:02 +0000)
lib/templates/url_select.mustache

index 9a163a4..807b36a 100644 (file)
@@ -1,3 +1,27 @@
+{{!
+    @template core/url_select
+
+    Example context (json):
+    {
+        "id": "url_select_test",
+        "action": "https://example.com/post",
+        "formid": "url_select_form",
+        "sesskey": "sesskey",
+        "label": "core/url_select",
+        "showbutton": "Go",
+        "options": [{
+            "name": "Group 1", "isgroup": true, "options":
+            [
+                {"name": "Item 1", "isgroup": false, "value": "1"},
+                {"name": "Item 2", "isgroup": false, "value": "2"}
+            ]},
+            {"name": "Group 2", "isgroup": true, "options":
+            [
+                {"name": "Item 3", "isgroup": false, "value": "3"},
+                {"name": "Item 4", "isgroup": false, "value": "4"}
+            ]}]
+    }
+}}
 <div class="{{classes}}">
     <form method="post" action="{{action}}" class="form-inline" id="{{formid}}">
         <input type="hidden" name="sesskey" value="{{sesskey}}">