0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-30 01:46:24 +01:00

Changes to make subclassing notifications for Wagtail Review simpler

This commit is contained in:
jacobtoppm 2020-03-19 16:33:25 +00:00 committed by Matt Westcott
parent 2bd0026d49
commit 05fafff317
3 changed files with 13 additions and 7 deletions

View File

@ -139,6 +139,7 @@ class Notifier:
notifications using rendered templates. """
notification = ''
template_directory = 'wagtailadmin/notifications/'
def __init__(self, valid_classes):
# the classes of the calling instance that the notifier can handle
@ -162,7 +163,7 @@ class Notifier:
"""Return a dictionary of template paths for the templates: by default, a text message"""
template_base = self.get_template_base_prefix(instance) + self.notification
template_text = 'wagtailadmin/notifications/' + template_base + '.txt'
template_text = self.template_directory + template_base + '.txt'
return {
'text': template_text,
@ -213,9 +214,9 @@ class EmailNotifier(Notifier):
alternatives"""
template_base = self.get_template_base_prefix(instance) + self.notification
template_subject = 'wagtailadmin/notifications/' + template_base + '_subject.txt'
template_text = 'wagtailadmin/notifications/' + template_base + '.txt'
template_html = 'wagtailadmin/notifications/' + template_base + '.html'
template_subject = self.template_directory + template_base + '_subject.txt'
template_text = self.template_directory + template_base + '.txt'
template_html = self.template_directory + template_base + '.html'
return {
'subject': template_subject,

View File

@ -114,7 +114,11 @@ body[yahoo] .text {
{% block content %}
{% endblock %}
<div style="font-size: 10px; margin-top: 20px;">{% trans "Edit your notification preferences here:" %} <a href="{{ settings.BASE_URL }}{% url 'wagtailadmin_account_notification_preferences' %}">{{ settings.BASE_URL }}{% url 'wagtailadmin_account_notification_preferences' %}</a></div>
<div style="font-size: 10px; margin-top: 20px;">
{% block preferences %}
{% trans "Edit your notification preferences here:" %} <a href="{{ settings.BASE_URL }}{% url 'wagtailadmin_account_notification_preferences' %}">{{ settings.BASE_URL }}{% url 'wagtailadmin_account_notification_preferences' %}</a>
{% endblock %}
</div>
</td>
</tr>
</table></td>

View File

@ -7,5 +7,6 @@
{% block content %}
{% endblock %}
{% block preferences %}
{% trans "Edit your notification preferences here:" %} {{ settings.BASE_URL }}{% url 'wagtailadmin_account_notification_preferences' %}
{% endblock %}