Changes to make subclassing notifications for Wagtail Review simpler

pull/6257/head
jacobtoppm 2020-03-19 16:33:25 +00:00 zatwierdzone przez Matt Westcott
rodzic 2bd0026d49
commit 05fafff317
3 zmienionych plików z 13 dodań i 7 usunięć

Wyświetl plik

@ -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,

Wyświetl plik

@ -113,8 +113,12 @@ 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>

Wyświetl plik

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