diff --git a/pycroft/templates/mail/base.html.j2 b/pycroft/templates/mail/base.html.j2 new file mode 100644 index 000000000..3db9b0441 --- /dev/null +++ b/pycroft/templates/mail/base.html.j2 @@ -0,0 +1,11 @@ +{%- set links = [] -%} +{%- import "macros/link.html" as link with context -%} +{%- if mode == 'html' -%} +
+{%- endif -%}
+{% block body %}{% endblock %}
+
+{{ link.render_link_list(mode) }}
+{%- if mode == 'html' -%}
+
+{%- endif -%} diff --git a/pycroft/templates/mail/macros/link.html b/pycroft/templates/mail/macros/link.html index 590a03ab1..2b8571917 100644 --- a/pycroft/templates/mail/macros/link.html +++ b/pycroft/templates/mail/macros/link.html @@ -1,9 +1,3 @@ -{%- macro start_pre(mode) -%} -{%- if mode == 'html' -%} -
-{%- endif -%}
-{%- endmacro -%}
-
 {%- macro render_link(text, url, mode) -%}
 {%- if mode == 'html' -%}
 {{ text }}
@@ -19,9 +13,3 @@
 {% endfor -%}
 {%- endif -%}{{ '' if links.clear() }}
 {%- endmacro -%}
-
-{%- macro end_pre(mode) -%}
-{%- if mode == 'html' -%}
-
-{%- endif -%} -{%- endmacro -%} diff --git a/pycroft/templates/mail/member_negative_balance.html b/pycroft/templates/mail/member_negative_balance.html index 9c2c16cdc..c434b1876 100644 --- a/pycroft/templates/mail/member_negative_balance.html +++ b/pycroft/templates/mail/member_negative_balance.html @@ -1,4 +1,5 @@ -{{ link.start_pre(mode) }} +{% extends "base.html.j2" %} +{% block body %} * English version below * Hallo {{ user.name }}, @@ -97,4 +98,4 @@ [4] Office hours: https://agdsn.de/sipa/pages/support/contacts [5] Finance constitution: https://agdsn.de/sipa/documents/legal/beitragsordnung.pdf -{{ link.end_pre(mode) }} +{% endblock %} diff --git a/pycroft/templates/mail/member_request_denied.html b/pycroft/templates/mail/member_request_denied.html index 681b6c4db..c5e77a8a6 100644 --- a/pycroft/templates/mail/member_request_denied.html +++ b/pycroft/templates/mail/member_request_denied.html @@ -1,4 +1,5 @@ -{{ link.start_pre(mode) }} +{% extends "base.html.j2" %} +{% block body %} English version below! --- @@ -30,4 +31,4 @@ Best Regards Your AG DSN -{{ link.end_pre(mode) }} +{% endblock %} diff --git a/pycroft/templates/mail/member_request_merged.html b/pycroft/templates/mail/member_request_merged.html index b67f3ddc9..bf42d2d95 100644 --- a/pycroft/templates/mail/member_request_merged.html +++ b/pycroft/templates/mail/member_request_merged.html @@ -1,4 +1,5 @@ -{{ link.start_pre(mode) }} +{% extends "base.html.j2" %} +{% block body %} English version below! --- @@ -41,4 +42,4 @@ Best Regards Your AG DSN -{{ link.end_pre(mode) }} +{% endblock %} diff --git a/pycroft/templates/mail/member_request_pending.html b/pycroft/templates/mail/member_request_pending.html index cc143d710..875f66792 100644 --- a/pycroft/templates/mail/member_request_pending.html +++ b/pycroft/templates/mail/member_request_pending.html @@ -1,4 +1,5 @@ -{{ link.start_pre(mode) }} +{% extends "base.html.j2" %} +{% block body %} English version below! --- @@ -70,4 +71,4 @@ Best Regards Your AG DSN -{{ link.end_pre(mode) }} +{% endblock %} diff --git a/pycroft/templates/mail/task_failed.html b/pycroft/templates/mail/task_failed.html index dedbcb1e4..f45429d6e 100644 --- a/pycroft/templates/mail/task_failed.html +++ b/pycroft/templates/mail/task_failed.html @@ -1,4 +1,5 @@ -{{ link.start_pre(mode) }} +{% extends "base.html.j2" %} +{% block body %} Hallo Supportteam, die geplante Pycroft {{ task.type }} Aufgabe #{{ task.id }} von {{ task.creator.name }} @@ -15,4 +16,4 @@ Viele Grüße Pycroft -{{ link.end_pre(mode) }} +{% endblock %} diff --git a/pycroft/templates/mail/user_confirm_email.html b/pycroft/templates/mail/user_confirm_email.html index a31f4dfa8..07693146c 100644 --- a/pycroft/templates/mail/user_confirm_email.html +++ b/pycroft/templates/mail/user_confirm_email.html @@ -1,6 +1,6 @@ -{%- set links = [] -%} +{% extends "base.html.j2" %} {%- import "macros/link.html" as link with context -%} -{{ link.start_pre(mode) }} +{% block body %} English version below! --- @@ -29,6 +29,4 @@ Best Regards Your AG DSN - -{{ link.render_link_list(mode) }} -{{ link.end_pre(mode) }} +{% endblock %} diff --git a/pycroft/templates/mail/user_created.html b/pycroft/templates/mail/user_created.html index 15a533de2..807cdc488 100644 --- a/pycroft/templates/mail/user_created.html +++ b/pycroft/templates/mail/user_created.html @@ -1,7 +1,6 @@ -{%- set links = [] -%} +{% extends "base.html.j2" %} {%- import "macros/link.html" as link with context -%} - -{{ link.start_pre(mode) }} +{% block body %} English version below! --- @@ -83,6 +82,4 @@ Best Regards Your AG DSN - -{{ link.render_link_list(mode) }} -{{ link.end_pre(mode) }} +{% endblock %} diff --git a/pycroft/templates/mail/user_moved_in.html b/pycroft/templates/mail/user_moved_in.html index b7c25708c..1ee32a8f3 100644 --- a/pycroft/templates/mail/user_moved_in.html +++ b/pycroft/templates/mail/user_moved_in.html @@ -1,4 +1,6 @@ -{{ link.start_pre(mode) }} +{% extends "base.html.j2" %} +{%- import "macros/link.html" as link with context -%} +{% block body %} English version below! --- @@ -38,5 +40,4 @@ Best Regards Your AG DSN -{{ link.render_link_list(mode) }} -{{ link.end_pre(mode) }} +{% endblock %} diff --git a/pycroft/templates/mail/user_reset_password.html b/pycroft/templates/mail/user_reset_password.html index cf7dddd4e..9ac2d249e 100644 --- a/pycroft/templates/mail/user_reset_password.html +++ b/pycroft/templates/mail/user_reset_password.html @@ -1,6 +1,6 @@ -{%- set links = [] -%} +{% extends "base.html.j2" %} {%- import "macros/link.html" as link with context -%} -{{ link.start_pre(mode) }} +{% block body %} English version below! --- @@ -36,6 +36,4 @@ Best Regards Your AG DSN - -{{ link.render_link_list(mode) }} -{{ link.end_pre(mode) }} +{% endblock %}