Skip to content

Commit

Permalink
MDL-58428 theme: Move templates from admin
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocolate-lightning authored and sarjona committed Feb 26, 2019
1 parent b13a453 commit 56cc669
Show file tree
Hide file tree
Showing 40 changed files with 631 additions and 615 deletions.
43 changes: 9 additions & 34 deletions admin/templates/setting.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,6 @@
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}{{!
@template core_admin/setting
Admin setting template.
Context variables required for this template:
* labelfor - id of the form element
* title - Setting title
* override - Overridden message
* warning - Warning message
* name - Setting name
* error - Error message
* element - The Element HTML
* forceltr - Force this element to be displayed LTR
* default - Default value
Example context (json):
{
"title": "Setting title",
"labelfor": "id0",
"override": "Overidden",
"warning": "Warning",
"name": "Name",
"error": "Error",
"element": "Raw HTML",
"forceltr": false,
"default": "Default value"
}
}}
{{!
@template core_admin/setting
Expand Down Expand Up @@ -71,8 +43,11 @@
"default": "Default value"
}
}}
<div class="form-item clearfix" id="{{id}}">
<div class="form-label">
{{!
Setting.
}}
<div class="form-item row" id="{{id}}">
<div class="form-label col-sm-3 text-sm-right">
<label {{#labelfor}}for="{{labelfor}}"{{/labelfor}}>
{{{title}}}
{{#override}}
Expand All @@ -82,16 +57,16 @@
<div class="form-warning">{{warning}}</div>
{{/warning}}
</label>
<span class="form-shortname">{{{name}}}</span>
<span class="form-shortname d-block small text-muted">{{{name}}}</span>
</div>
<div class="form-setting">
<div class="form-setting col-sm-9">
{{#error}}
<div><span class="error">{{error}}</span></div>
{{/error}}
{{{element}}}
{{#default}}
<div class="form-defaultinfo {{#forceltr}}text-ltr{{/forceltr}}">{{{default}}}</div>
<div class="form-defaultinfo text-muted {{#forceltr}}text-ltr{{/forceltr}}">{{{default}}}</div>
{{/default}}
<div class="form-description mt-3">{{{description}}}</div>
</div>
<div class="form-description">{{{description}}}</div>
</div>
25 changes: 4 additions & 21 deletions admin/templates/setting_configcolourpicker.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,6 @@
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}{{!
@template core_admin/setting_configcolourpicker
Admin setting colour picker template.
Context variables required for this template:
* icon - optional icon context (see pix_icon)
* name - element name
* id - element id
* value - element value
* haspreviewconfig - show preview of selected color
Example context (json):
{
"icon": false,
"name": "name0",
"id": "id0",
"value": "#555655",
"haspreviewconfig": false
}
}}
{{!
@template core_admin/setting_configcolourpicker
Expand All @@ -55,13 +35,16 @@
"haspreviewconfig": false
}
}}
{{!
Setting configcolourpicker.
}}
<div class="form-colourpicker defaultsnext">
<div class="admin_colourpicker clearfix">
{{#icon}}
{{>core/pix_icon}}
{{/icon}}
</div>
<input type="text" name="{{name}}" id="{{id}}" value="{{value}}" size="12" class="text-ltr">
<input type="text" name="{{name}}" id="{{id}}" value="{{value}}" size="12" class="form-control text-ltr">
{{#haspreviewconfig}}
<input type="button" id="{{id}}_preview" value={{#quote}}{{#str}}preview{{/str}}{{/quote}} class="admin_colourpicker_preview">
{{/haspreviewconfig}}
Expand Down
37 changes: 12 additions & 25 deletions admin/templates/setting_configduration.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,6 @@
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}{{!
@template core_admin/setting_configduration
Admin duration setting template.
Context variables required for this template:
* name - form element name
* options - list of options for units containing name, value, selected
* value - yes
* id - element id
Example context (json):
{
"name": "test",
"value": "5",
"id": "test0",
"options": [ { "name": "Minutes", "value": "mins", "selected": true } ]
}
}}
{{!
@template core_admin/setting_configduration
Expand All @@ -51,13 +33,18 @@
"options": [ { "name": "Minutes", "value": "mins", "selected": true } ]
}
}}
{{!
Setting configduration.
}}
<div class="form-duration defaultsnext">
<input type="text" size="5" id="{{id}}v" name="{{name}}[v]" value="{{value}}" class="text-ltr">
<label class="accesshide" for="{{id}}u">{{#str}}durationunits, admin{{/str}}</label>
<select id="{{id}}u" name="{{name}}[u]">
{{#options}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
{{/options}}
</select>
<div class="form-inline">
<input type="text" size="5" id="{{id}}v" name="{{name}}[v]" value="{{value}}" class="form-control text-ltr">
<label class="sr-only" for="{{id}}u">{{#str}}durationunits, admin{{/str}}</label>
<select id="{{id}}u" name="{{name}}[u]" class="form-control">
{{#options}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
{{/options}}
</select>
</div>
</div>

46 changes: 14 additions & 32 deletions admin/templates/setting_configfile.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,6 @@
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}{{!
@template core_admin/setting_configfile
Admin file setting template.
Context variables required for this template:
* name - form element name
* id - element id
* size - size of the field
* readonly - Make the field readonly
* value - value
* showvalidity - Show a green check if the path is readable
* valid - True if the path is readable
Example context (json):
{
"name": "test",
"value": "/my-super-secret-path/file",
"id": "test0",
"readonly": true,
"showvalidity": true,
"valid": false
}
}}
{{!
@template core_admin/setting_configfile
Expand All @@ -61,15 +38,20 @@
"valid": false
}
}}
{{!
Setting configfile.
}}
<div class="form-file defaultsnext">
<input type="text" name="{{name}}" id="{{id}}" size="{{size}}" value="{{value}}" class="text-ltr" {{#readonly}}readonly{{/readonly}}>
{{#showvalidity}}
{{#valid}}
<span class="pathok">&#x2714;</span>
{{/valid}}
{{^valid}}
<span class="patherror">&#x2718;</span>
{{/valid}}
{{/showvalidity}}
<div class="form-inline">
<input type="text" name="{{name}}" id="{{id}}" size="{{size}}" value="{{value}}" class="form-control text-ltr" {{#readonly}}readonly{{/readonly}}>
{{#showvalidity}}
{{#valid}}
<span class="text-success">&#x2714;</span>
{{/valid}}
{{^valid}}
<span class="text-danger">&#x2718;</span>
{{/valid}}
{{/showvalidity}}
</div>
</div>

24 changes: 4 additions & 20 deletions admin/templates/setting_configmultiselect.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,6 @@
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}{{!
@template core_admin/setting_configmultiselect
Admin multiselect setting template.
Context variables required for this template:
* name - form element name
* id - element id
* size - element size
* options - list of options containing name, value, selected
Example context (json):
{
"name": "test",
"id": "test0",
"size": "3",
"options": [ { "name": "Option 1", "value": "V", "selected": true },
{ "name": "Option 2", "value": "V", "selected": true } ]
}
}}
{{!
@template core_admin/setting_configmultiselect
Expand All @@ -53,9 +34,12 @@
{ "name": "Option 2", "value": "V", "selected": true } ]
}
}}
{{!
Setting configmultiselect.
}}
<div class="form-select">
<input type="hidden" name="{{name}}[xxxxx]" value="1">
<select id="{{id}}" name="{{name}}[]" size="{{size}}" multiple>
<select id="{{id}}" name="{{name}}[]" size="{{size}}" class="form-control" multiple>
{{#options}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
{{/options}}
Expand Down
51 changes: 8 additions & 43 deletions admin/templates/setting_configmultiselect_optgroup.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -13,44 +13,6 @@
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}{{!
@template core_admin/setting_configmultiselect_optgroup
Admin multiselect setting template with optgroup support.
Context variables required for this template:
* name - form element name
* id - element id
* size - element size
* options - list of options not grouped
* optgroups - list of options grouped containing the group label and for each option: name, value, selected
Example context (json):
{
"name": "test",
"id": "test0",
"size": "3",
"options": [
{ "name": "Option 1", "value": "V", "selected": false },
{ "name": "Option 2", "value": "V", "selected": true }
],
"optgroups": [
{
"label": "Group 1",
"options": [
{ "name": "Option 3", "value": "V", "selected": false },
{ "name": "Option 4", "value": "V", "selected": true }
]
},
{
"label": "Group 2",
"options": [
{ "name": "Option 5", "value": "V", "selected": false },
{ "name": "Option 6", "value": "V", "selected": true }
]
}
]
}
}}
{{!
@template core_admin/setting_configmultiselect_optgroup
Expand Down Expand Up @@ -91,13 +53,16 @@
]
}
}}
{{!
Setting configmultiselect with optgroup support.
}}
<div class="form-select">
<input type="hidden" name="{{name}}[xxxxx]" value="1">
<select id="{{id}}" name="{{name}}[]" size="{{size}}" multiple>
{{#options}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
{{/options}}
{{#optgroups}}
<select id="{{id}}" name="{{name}}[]" size="{{size}}" class="form-control" multiple>
{{#options}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
{{/options}}
{{#optgroups}}
<optgroup label="{{label}}">
{{#options}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
Expand Down
24 changes: 4 additions & 20 deletions admin/templates/setting_configselect.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,6 @@
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}{{!
@template core_admin/setting_configselect
Admin select setting template.
Context variables required for this template:
* name - form element name
* id - element id
* options - list of options containing name, value, selected
Example context (json):
{
"name": "test",
"id": "test0",
"options": [
{ "name": "Option 1", "value": "V", "selected": true },
{ "name": "Option 2", "value": "V", "selected": true }
]
}
}}
{{!
@template core_admin/setting_configselect
Expand All @@ -53,8 +34,11 @@
]
}
}}
{{!
Setting configselect.
}}
<div class="form-select defaultsnext">
<select id="{{id}}" name="{{name}}">
<select id="{{id}}" name="{{name}}" class="custom-select">
{{#options}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
{{/options}}
Expand Down
Loading

0 comments on commit 56cc669

Please sign in to comment.