MDL-54698 message: add context to preferences templates

This commit is contained in:
Ryan Wyllie 2016-07-19 06:47:24 +00:00 committed by Mark Nelson
parent 5ee31614c7
commit e48a092a40
3 changed files with 79 additions and 10 deletions

View File

@ -26,24 +26,32 @@
* None
Context variables required for this template:
* None
* userid The current user id
* blocknoncontacts If the user is blocking non contacts
* disableall If the user has disabled all notifications
* disablehelpicon HTML for the help icon
Example context (json):
{ }
{
"userid": 1,
"blocknoncontacts": 1,
"disableall": 0,
"disableallhelpicon": "<span class='helptooltip'>Help icon</span>"
}
}}
<h2 class="title-case">{{#str}} generalsettings, admin {{/str}}</h2>
<div class="general-settings-container" data-user-id="{{userid}}">
<label data-preference-key="message_blocknoncontacts">
<input type="checkbox" {{#blocknoncontacts}}checked{{/blocknoncontacts}} />
{{#str}} blocknoncontacts, message {{/str}}
<div class="loading-icon">{{> message/loading }}</div>
{{> core/loading }}
</label>
<br/>
<label data-preference-key="disableall">
<input type="checkbox" {{#disableall}}checked{{/disableall}} />
{{#str}} disableall, message {{/str}}
{{{disableallhelpicon}}}
<div class="loading-icon">{{> message/loading }}</div>
{{> core/loading }}
</label>
</div>
{{#js}}

View File

@ -26,10 +26,61 @@
* None
Context variables required for this template:
* None
* userid The logged in user id
* disableall If the user has disabled notifications
* components The list of notification components
Example context (json):
{ }
{
"userid": 1,
"disableall": 0,
"components": [
{
"displayname": "System",
"processornames": ["Popup notification"],
"notifications": [
{
"displayname": "Notices about minor problems",
"preferencekey": "message_provider_moodle_notices",
"processors": [
{
"displayname": "Popup notification",
"name": "popup",
"locked": 0,
"radioname": "popup",
"states": [
{
"name": "loggedin",
"displayname": "When I'm logged in",
"checked": 0,
"iconurl": "some url"
},
{
"name": "loggedoff",
"displayname": "When I'm offline",
"checked": 0,
"iconurl": "some url"
},
{
"name": "both",
"displayname": "Always",
"checked": 1,
"iconurl": "some url"
},
{
"name": "none",
"displayname": "Never",
"checked": 0,
"iconurl": "some url"
}
]
}
]
}
]
}
]
}
}}
<h2 class="title-case">{{#str}} messagepreferences, message {{/str}}</h2>
<div class="preferences-container {{#disableall}}disabled{{/disableall}}" data-user-id="{{userid}}">
@ -48,7 +99,7 @@
<tr class="preference-row" data-preference-key="{{preferencekey}}">
<td class="preference-name">
{{displayname}}
<div class="loading-icon">{{> message/loading }}</div>
{{> core/loading }}
</td>
{{#processors}}
<td data-processor-name="{{name}}">

View File

@ -26,10 +26,20 @@
* None
Context variables required for this template:
* None
* userid The logged in user id
* processors The list of notification processors
Example context (json):
{ }
{
"userid": 1,
"processors": [
{
"displayname": "Email",
"name": "email",
"formhtml": "<input name='test' type='text' />"
}
]
}
}}
<h2 class="title-case">{{#str}} messageprocessors, message {{/str}}</h2>
<div class="processors-container" data-user-id="{{userid}}">
@ -37,7 +47,7 @@
<div class="processor-container" data-processor-name="{{name}}">
<div class="loading-container">
<div class="vertical-align"></div>
{{> message/loading }}
{{> core/loading }}
</div>
<h3>{{displayname}}</h3>
<form>