From e48a092a406cc60daa16bc06969adc6eea8268ff Mon Sep 17 00:00:00 2001 From: Ryan Wyllie Date: Tue, 19 Jul 2016 06:47:24 +0000 Subject: [PATCH] MDL-54698 message: add context to preferences templates --- .../preferences_general_settings.mustache | 16 ++++-- .../preferences_notifications_list.mustache | 57 ++++++++++++++++++- .../templates/preferences_processors.mustache | 16 +++++- 3 files changed, 79 insertions(+), 10 deletions(-) diff --git a/message/templates/preferences_general_settings.mustache b/message/templates/preferences_general_settings.mustache index f4afa06a417..dd8fcae9c8a 100644 --- a/message/templates/preferences_general_settings.mustache +++ b/message/templates/preferences_general_settings.mustache @@ -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": "Help icon" + } }}

{{#str}} generalsettings, admin {{/str}}


{{#js}} diff --git a/message/templates/preferences_notifications_list.mustache b/message/templates/preferences_notifications_list.mustache index 9461bd11046..1e897134132 100644 --- a/message/templates/preferences_notifications_list.mustache +++ b/message/templates/preferences_notifications_list.mustache @@ -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" + } + ] + } + ] + } + ] + } + ] + } }}

{{#str}} messagepreferences, message {{/str}}

@@ -48,7 +99,7 @@ {{displayname}} -
{{> message/loading }}
+ {{> core/loading }} {{#processors}} diff --git a/message/templates/preferences_processors.mustache b/message/templates/preferences_processors.mustache index 5dec028a361..c076cf6213d 100644 --- a/message/templates/preferences_processors.mustache +++ b/message/templates/preferences_processors.mustache @@ -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": "" + } + ] + } }}

{{#str}} messageprocessors, message {{/str}}

@@ -37,7 +47,7 @@
- {{> message/loading }} + {{> core/loading }}

{{displayname}}