diff --git a/lib/templates/notification_base.mustache b/lib/templates/notification_base.mustache new file mode 100644 index 00000000000..00db2598cb6 --- /dev/null +++ b/lib/templates/notification_base.mustache @@ -0,0 +1,49 @@ +{{! + This file is part of Moodle - http://moodle.org/ + + Moodle is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Moodle is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Moodle. If not, see . +}} +{{! + @template core/notification_base + + Base Moodle notification template. + + The purpose of this template is to render an base template for alert notifications. + + Classes required for JS: + * none + + Data attributes required for JS: + * none + + Context variables required for this template: + * message A cleaned string (use clean_text()) to display. + * extraclasses Additional classes to apply to the notification. + * closebutton Whether a close button should be displayed to dismiss the message. + * announce Whether the notification should be announced to screen readers. + + Example context (json): + { "message": "Your pants are on fire!", "closebutton": 1, "announce": 1, "extraclasses": "foo bar"} +}} + diff --git a/lib/templates/notification_error.mustache b/lib/templates/notification_error.mustache index 3d05b42bde7..e237f411b6c 100644 --- a/lib/templates/notification_error.mustache +++ b/lib/templates/notification_error.mustache @@ -36,9 +36,6 @@ Example context (json): { "message": "Your pants are on fire!", "closebutton": 1, "announce": 1, "extraclasses": "foo bar"} }} - +{{< core/notification_base}} + {{$alertclass}}alert-danger{{/alertclass}} +{{/core/notification_base}} diff --git a/lib/templates/notification_info.mustache b/lib/templates/notification_info.mustache index 692751f4fa9..f5f49e7a65f 100644 --- a/lib/templates/notification_info.mustache +++ b/lib/templates/notification_info.mustache @@ -36,10 +36,6 @@ Example context (json): { "message": "Your pants are on fire!", "closebutton": 1, "announce": 1, "extraclasses": "foo bar"} }} - - +{{< core/notification_base}} + {{$alertclass}}alert-info{{/alertclass}} +{{/core/notification_base}} diff --git a/lib/templates/notification_success.mustache b/lib/templates/notification_success.mustache index b33f4aa24aa..dd664eb4181 100644 --- a/lib/templates/notification_success.mustache +++ b/lib/templates/notification_success.mustache @@ -36,9 +36,6 @@ Example context (json): { "message": "Your pants are on fire!", "closebutton": 1, "announce": 1, "extraclasses": "foo bar"} }} - +{{< core/notification_base}} + {{$alertclass}}alert-success{{/alertclass}} +{{/core/notification_base}} diff --git a/lib/templates/notification_warning.mustache b/lib/templates/notification_warning.mustache index e3f8bda8321..77be7d43624 100644 --- a/lib/templates/notification_warning.mustache +++ b/lib/templates/notification_warning.mustache @@ -36,9 +36,6 @@ Example context (json): { "message": "Your pants are on fire!", "closebutton": 1, "announce": 1, "extraclasses": "foo bar"} }} - +{{< core/notification_base}} + {{$alertclass}}alert-warning{{/alertclass}} +{{/core/notification_base}}