MDL-57338 templates: add missing example context

This commit is contained in:
Dan Poltawski 2016-12-09 12:17:39 +00:00
parent b4a65796cf
commit 2d29386c44
32 changed files with 312 additions and 14 deletions

View File

@ -15,7 +15,20 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core/action_menu
Action menu.
Example context (json):
{
"classes": "",
"primary": {
"items": [{"rawhtml": "<p>Item in primary menu</p>"}]
},
"secondary": {
"items": [{"rawhtml": "<p>Item in secondary menu</p>"}]
}
}
}}
<div class="{{classes}}" {{#attributes}}{{name}}="{{value}}"{{/attributes}}>
{{#primary}}
@ -37,8 +50,6 @@
{{#items}}<li role="presentation">{{> core/action_menu_item }}</li>{{/items}}
</ul>
{{/secondary}}
</span>
</div>
{{#js}}
require(['core/yui'], function(Y) {

View File

@ -15,7 +15,14 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core/action_menu_item
Action menu item.
Example context (json):
{
"rawhtml": "<p>[rawhtml]</p>"
}
}}
{{#actionmenulink}}{{> core/action_menu_link }}{{/actionmenulink}}
{{#actionmenufiller}}<span class="filler">&nbsp;</span>{{/actionmenufiller}}

View File

@ -15,7 +15,16 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core/action_menu_link
Action menu link.
Example context (json):
{
"text": "Example link text",
"showtext": true,
"url": "http://example.com/link"
}
}}
{{^disabled}}
<a href="{{url}}" class="{{classes}}" {{#attributes}}{{name}}={{#quote}}{{value}}{{/quote}}{{/attributes}} {{#showtext}}aria-labelledby="actionmenuaction-{{instance}}"{{/showtext}}>{{#icon}}{{>core/pix_icon}}{{/icon}}{{#showtext}}<span class="menu-action-text" id="actionmenuaction-{{instance}}">{{{text}}}</span>{{/showtext}}</a>

View File

@ -15,6 +15,15 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core/action_menu_trigger
Action menu trigger.
Example context (json):
{
"instance": "1",
"title": "Trigger me!",
"menutrigger": true
}
}}
<a href="#" class="toggle-display {{#menutrigger}}textmenu{{/menutrigger}}" id="action-menu-toggle-{{instance}}" title="{{title}}" role="menuitem">{{{actiontext}}}{{{menutrigger}}}{{#icon}}{{> core/pix_icon}}{{/icon}}{{#rawicon}}{{{.}}}{{/rawicon}}{{#menutrigger}}<b class="caret"></b>{{/menutrigger}}</a>

View File

@ -15,7 +15,14 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core/actions
Actions.
Example context (json):
{
"actions": [{"event": "event", "jsfunction": "Y.log", "id": "id"}]
}
}}
{{#js}}
require(['core/yui'], function(Y) {

View File

@ -15,7 +15,26 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core/chooser
Chooser.
Example context (json):
{
"title": "Chooser title",
"method": "post",
"actionurl": "http://example.org/test",
"instructions": "Choose one:",
"paramname": "param",
"sections": [{
"id": "section-1",
"label": "Section one",
"items": [{
"label": "item one",
"description": "description one"
}]
}]
}
}}
<div class="hd choosertitle">
{{title}}

View File

@ -15,7 +15,18 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core/chooser_item
Chooser item.
Example context (json):
{
"id": "1",
"paramname": "param",
"value": "1",
"label": "item one",
"description": "description one"
}
}}
<div class="option">
<label for="item_{{id}}">

View File

@ -17,8 +17,7 @@
{{!
@template core/dataformat_selector
Template for all html emails. Note that it may wrap content formatted
elsewhere in another a module template.
Template for dataformat selection and download form.
Context variables required for this template:
* label
@ -28,6 +27,16 @@
* options
* sesskey
* submit
Example context (json):
{
"base": "http://example.org/",
"name": "test",
"label": "Download table data as",
"params": false,
"options": [{"label": "CSV", "name": "csv"}, {"label": "Excel", "name": "excel"}],
"submit": "Download"
}
}}
<form method="get" action="{{base}}" class="dataformatselector">
<div class="mdl-align">

View File

@ -15,7 +15,7 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core/email_html
@template core/email_fromname
Template for all email subjects.
@ -31,5 +31,10 @@
* fromname
* replyto
* replytoname
Example context (json):
{
"fromname": "Joe Bloggs"
}
}}
{{{fromname}}}

View File

@ -34,5 +34,10 @@
* replyto
* replytoname
* body
Example context (json):
{
"body": "Email body"
}
}}
{{{body}}}

View File

@ -15,7 +15,7 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core/email_html
@template core/email_subject
Template for all email subjects.
@ -31,5 +31,10 @@
* fromname
* replyto
* replytoname
Example context (json):
{
"subject": "Email subject"
}
}}
{{{subject}}}

View File

@ -33,5 +33,10 @@
* replyto
* replytoname
* body
Example context (json):
{
"body": "Email body"
}
}}
{{{body}}}

View File

@ -15,7 +15,23 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core/help_icon
Help icon.
Example context (json):
{
"title": "Help with something",
"url": "http://example.org/help",
"linktext": "",
"icon":{
"attributes": [
{"name": "class", "value": "iconhelp"},
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}
]
}
}
}}
<span class="helptooltip">
<a href="{{url}}" title={{#quote}}{{title}}{{/quote}} aria-haspopup="true" target="_blank">{{#icon}}{{>core/pix_icon}}{{/icon}}{{#linktext}}{{.}}{{/linktext}}</a>

View File

@ -27,6 +27,10 @@
Context variables required for this template:
* none
Example context (json):
{
}
}}
<div class="hover-tooltip-container">
{{$anchor}}{{/anchor}}

View File

@ -29,5 +29,8 @@
Context variables required for this template:
*
Example context (json):
{}
}}
<span class="loading-icon">{{#pix}} y/loading, core, {{#str}} loading {{/str}} {{/pix}}</span>

View File

@ -18,6 +18,25 @@
@template core/login
Moodle template for the login page.
Example context (json):
{
"autofocusform": false,
"canloginasguest": true,
"canloginbyemail": true,
"cansignup": true,
"error": "testerror",
"errorformatted": "Test error formatted",
"forgotpasswordurl": "http://example.com/login/forgot_password.php",
"hasidentityproviders": false,
"hasinstructions": true,
"instructions": "For full access to this site, you first need to create an account.",
"loginurl": "http://example.com/stable_master/login/index.php",
"rememberusername": true,
"passwordautocomplete": false,
"signupurl": "http://localhost/stable_master/login/signup.php",
"cookieshelpiconformatted": ""
}
}}
{{#hasinstructions}}
<div class="loginbox clearfix twocolumns">
@ -155,5 +174,5 @@
});
{{/autofocusform}}
{{/error}}
})
});
{{/js}}

View File

@ -33,8 +33,9 @@
Example context (json):
{
"attributes": [
{ "name": "src", "value": "http://moodle.com/wp-content/themes/moodle/images/logo-hat2.png" },
{ "name": "class", "value": "iconsmall" }
{ "name": "src", "value": "https://moodle.org/logo/moodle-logo.svg" },
{ "name": "class", "value": "iconsmall" },
{"name": "alt", "value": "Alt text for icon"}
]
}

View File

@ -15,12 +15,14 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core/progress_bar
Progress bar.
Example context (json):
{
id: 'progressbar_test',
width: '500'
"id": "progressbar_test",
"width": "500"
}
}}
<div class="progressbar_container" style="width: {{width}}px;" id="{{id}}">

View File

@ -15,7 +15,20 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core/select_time
Select time.
Example context (json):
{
"id": "test-id",
"name": "test-name",
"label": "Test label",
"options": [
{"name": "Option 1", "value": "1"},
{"name": "Option 2", "value": "2"}
]
}
}}
<label for="{{id}}" class="accesshide">{{label}}</label>
<select name="{{name}}" id="{{id}}" {{#attributes}} {{name}}="{{value}}"{{/attributes}}>

View File

@ -1,2 +1,10 @@
{{!
@template core/signup_form_layout
Example context (json):
{
"formhtml": "<p>(Form html would go here)</p>"
}
}}
<h3>{{#str}}newaccount{{/str}}</h3>
{{{formhtml}}}

View File

@ -1,3 +1,14 @@
{{!
@template core/skip_links
Example context (json):
{
"links": [
{"url": "http://example.com/link1", "text": "Link 1"},
{"url": "http://example.com/link2", "text": "Link 2"}
]
}
}}
<div class="skiplinks">
{{#links}}
<a href="#{{{url}}}" class="skip">{{{text}}}</a>

View File

@ -15,7 +15,20 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core/action_menu
Action menu.
Example context (json):
{
"classes": "",
"primary": {
"items": [{"rawhtml": "<p>Item in primary menu</p>"}]
},
"secondary": {
"items": [{"rawhtml": "<p>Item in secondary menu</p>"}]
}
}
}}
<div class="action-menu {{classes}}" {{#attributes}}{{name}}="{{value}}"{{/attributes}}>
{{#primary}}

View File

@ -15,7 +15,14 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core/action_menu_item
Action menu item.
Example context (json):
{
"rawhtml": "<p>[rawhtml]</p>"
}
}}
{{#actionmenulink}}{{> core/action_menu_link }}{{/actionmenulink}}
{{#actionmenufiller}}<span class="filler">&nbsp;</span>{{/actionmenufiller}}

View File

@ -15,7 +15,16 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core/action_menu_link
Action menu link.
Example context (json):
{
"text": "Example link text",
"showtext": true,
"url": "http://example.com/link"
}
}}
{{^disabled}}
<a href="{{url}}" class="{{classes}}" {{#attributes}}{{name}}={{#quote}}{{value}}{{/quote}}{{/attributes}} {{#showtext}}aria-labelledby="actionmenuaction-{{instance}}"{{/showtext}}>{{#icon}}{{>core/pix_icon}}{{/icon}}{{#showtext}}<span class="menu-action-text" id="actionmenuaction-{{instance}}">{{{text}}}</span>{{/showtext}}</a>

View File

@ -15,7 +15,26 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core/chooser
Chooser.
Example context (json):
{
"title": "Chooser title",
"method": "post",
"actionurl": "http://example.org/test",
"instructions": "Choose one:",
"paramname": "param",
"sections": [{
"id": "section-1",
"label": "Section one",
"items": [{
"label": "item one",
"description": "description one"
}]
}]
}
}}
<div class="hd choosertitle">
{{title}}

View File

@ -25,6 +25,16 @@
* options
* sesskey
* submit
Example context (json):
{
"base": "http://example.org/",
"name": "test",
"label": "Download table data as",
"params": false,
"options": [{"label": "CSV", "name": "csv"}, {"label": "Excel", "name": "excel"}],
"submit": "Download"
}
}}
<form method="get" action="{{base}}" class="dataformatselector m-a-1">
<div class="form-inline text-xs-right">

View File

@ -1,3 +1,22 @@
{{!
@template core/help_icon
Help icon.
Example context (json):
{
"title": "Help with something",
"url": "http://example.org/help",
"linktext": "",
"icon":{
"attributes": [
{"name": "class", "value": "iconhelp"},
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}
]
}
}
}}
<a class="btn btn-link p-a-0" role="button"
data-container="body" data-toggle="popover"
data-placement="{{#ltr}}right{{/ltr}}{{^ltr}}left{{/ltr}}" data-content="{{text}} {{completedoclink}}"

View File

@ -15,15 +15,17 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core/progress_bar
Progress bar.
Example context (json):
{
id: 'progressbar_test',
width: '500'
"id": "progressbar_test",
"width": "500"
}
}}
<div class="row" id="{{id}}" class="progressbar_container">
<div id="{{id}}" class="row progressbar_container">
<div class="col-md-6 push-md-3">
<p id="{{id}}_status" class="text-xs-center"></p>
<progress id="{{id}}_bar" class="progress progress-striped progress-animated" value="0" max="100"></progress>

View File

@ -15,7 +15,20 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core/select_time
Select time.
Example context (json):
{
"id": "test-id",
"name": "test-name",
"label": "Test label",
"options": [
{"name": "Option 1", "value": "1"},
{"name": "Option 2", "value": "2"}
]
}
}}
<label for="{{id}}" class="sr-only">{{label}}</label>
<select name="{{name}}" id="{{id}}" {{#attributes}} {{name}}="{{value}}"{{/attributes}} class="form-control">

View File

@ -1,3 +1,13 @@
{{!
@template core/signup_form_layout
Example context (json):
{
"logourl": "https://moodle.org/logo/moodle-logo.svg",
"sitename": "Site name",
"formhtml": "<p>(Form html would go here)</p>"
}
}}
<div class="container-fluid">
<div class="row">
<div class="col-md-8 push-md-2 col-xl-6 push-xl-3">

View File

@ -1,3 +1,14 @@
{{!
@template core/skip_links
Example context (json):
{
"links": [
{"url": "http://example.com/link1", "text": "Link 1"},
{"url": "http://example.com/link2", "text": "Link 2"}
]
}
}}
<div>
{{#links}}
<a class="sr-only sr-only-focusable" href="#{{{url}}}">{{{text}}}</a>

View File

@ -1,3 +1,9 @@
{{!
@template theme_boost/nav-drawer
Example context (json): {}
}}
<div id="nav-drawer" data-region="drawer" class="hidden-print moodle-has-zindex {{^navdraweropen}}closed{{/navdraweropen}}" aria-hidden="{{#navdraweropen}}false{{/navdraweropen}}{{^navdraweropen}}true{{/navdraweropen}}" tabindex="-1">
{{> theme_boost/flat_navigation }}
</div>