From f549b4d3c09264e1ef4ac34f5a71382b6c0316e0 Mon Sep 17 00:00:00 2001 From: MarkLark86 Date: Tue, 22 Feb 2022 21:46:52 +1100 Subject: [PATCH] [CPNHUB-24] Update agenda/company_expiry email templates (#43) * [CPNHUB-24] Update agenda/company_expiry email templates * Update CoverageRequest email * fix: Add `if` statement --- server/data/email_templates.json | 30 +++++++++++--- server/settings.py | 40 +++++++++++++++++++ server/theme/agenda_status_text.txt | 9 +++++ server/theme/agenda_updated_email.fr_ca.html | 12 ++++++ server/theme/agenda_updated_email.fr_ca.txt | 13 ++++++ .../company_expiry_alert_user.fr_ca.html | 2 + .../theme/company_expiry_alert_user.fr_ca.txt | 2 + server/theme/company_expiry_alert_user.html | 3 ++ server/theme/company_expiry_alert_user.txt | 2 + server/theme/company_expiry_email.fr_ca.html | 5 +++ server/theme/company_expiry_email.fr_ca.txt | 5 +++ .../theme/coverage_request_content.fr_ca.html | 7 ++++ .../theme/coverage_request_content.fr_ca.txt | 5 +++ .../theme/coverage_request_email.fr_ca.html | 4 ++ server/theme/coverage_request_email.fr_ca.txt | 2 + server/theme/coverage_status_text.fr_ca.txt | 15 +++++++ server/theme/email_watched_agenda.fr_ca.html | 35 ++++++++++++++++ server/theme/email_watched_agenda.fr_ca.txt | 27 +++++++++++++ 18 files changed, 212 insertions(+), 6 deletions(-) create mode 100644 server/theme/agenda_status_text.txt create mode 100644 server/theme/agenda_updated_email.fr_ca.html create mode 100644 server/theme/agenda_updated_email.fr_ca.txt create mode 100644 server/theme/company_expiry_alert_user.fr_ca.html create mode 100644 server/theme/company_expiry_alert_user.fr_ca.txt create mode 100644 server/theme/company_expiry_alert_user.html create mode 100644 server/theme/company_expiry_alert_user.txt create mode 100644 server/theme/company_expiry_email.fr_ca.html create mode 100644 server/theme/company_expiry_email.fr_ca.txt create mode 100644 server/theme/coverage_request_content.fr_ca.html create mode 100644 server/theme/coverage_request_content.fr_ca.txt create mode 100644 server/theme/coverage_request_email.fr_ca.html create mode 100644 server/theme/coverage_request_email.fr_ca.txt create mode 100644 server/theme/coverage_status_text.fr_ca.txt create mode 100644 server/theme/email_watched_agenda.fr_ca.html create mode 100644 server/theme/email_watched_agenda.fr_ca.txt diff --git a/server/data/email_templates.json b/server/data/email_templates.json index c1caf64..5bfcd9a 100644 --- a/server/data/email_templates.json +++ b/server/data/email_templates.json @@ -36,20 +36,20 @@ } }, { "_id": "share_items", - "init_version": 1, + "init_version": 2, "subject": { - "default": "{{ subject_name }}", + "default": "{% if items | length is gt 1 %} {{ items | length }} items shared with you{% else %}{{ subject_name }}{% endif %}", "translations": { - "fr_ca": "{{ subject_name }}" + "fr_ca": "{% if items | length is gt 1 %} {{ items | length }} éléments partagés avec vous{% else %}{{ subject_name }}{% endif %}" } } }, { "_id": "share_agenda", - "init_version": 1, + "init_version": 2, "subject": { - "default": "{{ subject_name }}", + "default": "{% if items | length is gt 1 %} {{ items | length }} items shared with you{% else %}{{ subject_name }}{% endif %}", "translations": { - "fr_ca": "{{ subject_name }}" + "fr_ca": "{% if items | length is gt 1 %} {{ items | length }} éléments partagés avec vous{% else %}{{ subject_name }}{% endif %}" } } }, { @@ -61,4 +61,22 @@ "fr_ca": "Sujet partagé: {{ topic.label }}" } } +}, { + "_id": "agenda_updated_email", + "init_version": 1, + "subject": { + "default": "{{ agenda.name or agenda.headline or agenda.slugline }} -{{ ' Coverage' if coverage_modified else '' }} updated", + "translations": { + "fr_ca": "{{ agenda.name or agenda.headline or agenda.slugline }} -{{ ' Couverture' if coverage_modified else '' }} mise à jour" + } + } +}, { + "_id": "coverage_request_email", + "init_version": 1, + "subject": { + "default": "Coverage inquiry: {{ item.name or item.slugline }}", + "translations": { + "fr_ca": "Requête de couverture: {{ item.name or item.slugline }}" + } + } }] \ No newline at end of file diff --git a/server/settings.py b/server/settings.py index 1f2e708..c12c895 100644 --- a/server/settings.py +++ b/server/settings.py @@ -24,8 +24,48 @@ LANGUAGES = ["en", "fr_CA"] DEFAULT_LANGUAGE = "en" +# Copied from Superdesk CV +COVERAGE_TYPES = { + "text": { + "name": "Text", + "icon": "text", + "translations": {"fr_ca": "Texte"}, + }, + "picture": { + "name": "Picture", + "icon": "photo", + "translations": {"fr_ca": "Photo"}, + }, + "video": { + "name": "Video", + "icon": "video", + "translations": {"fr_ca": "Vidéo"}, + }, + "audio": { + "name": "Audio", + "icon": "audio", + "translations": {"fr_ca": "Audio"}, + }, + "infographics": { + "name": "Infographics", + "icon": "infographics", + "translations": {"fr_ca": "Infographie"}, + }, + "live_video": { + "name": "Live Video", + "icon": "live-video", + "translations": {"fr_ca": "Vidéo en direct"}, + }, + "live_blog": { + "name": "Live Blog", + "icon": "live-blog", + "translations": {"fr_ca": "Blogue en direct"}, + }, +} + CLIENT_CONFIG.update( { + "coverage_types": COVERAGE_TYPES, "display_news_only": True, # Displays news only switch in wire "time_format": "HH:mm", "date_format": "MMM Do, YYYY", diff --git a/server/theme/agenda_status_text.txt b/server/theme/agenda_status_text.txt new file mode 100644 index 0000000..bc155da --- /dev/null +++ b/server/theme/agenda_status_text.txt @@ -0,0 +1,9 @@ +{%- if agenda.state == 'cancelled' -%} + a été annulé +{%- elif agenda.state == 'rescheduled' -%} + a été reprogrammé +{%- elif agenda.state == 'postponed' -%} + a été reporté +{%- else -%} + a été mis à jour +{%- endif -%} \ No newline at end of file diff --git a/server/theme/agenda_updated_email.fr_ca.html b/server/theme/agenda_updated_email.fr_ca.html new file mode 100644 index 0000000..f607c6f --- /dev/null +++ b/server/theme/agenda_updated_email.fr_ca.html @@ -0,0 +1,12 @@ +{% extends "email_layout.fr_ca.html" %} + +{% block content %} +{%- if agenda.event -%} +

L’événement que vous suivez {% include "agenda_status_text.txt" %}.

+{%- else -%} +

Le plan de couverture que vous suivez {% include "agenda_status_text.txt" %}.

+{%- endif -%} + +{% include "email_watched_agenda.fr_ca.html" %} + +{% endblock %} \ No newline at end of file diff --git a/server/theme/agenda_updated_email.fr_ca.txt b/server/theme/agenda_updated_email.fr_ca.txt new file mode 100644 index 0000000..06fb224 --- /dev/null +++ b/server/theme/agenda_updated_email.fr_ca.txt @@ -0,0 +1,13 @@ +{% extends "email_layout.fr_ca.txt" %} + +{% block content %} + +{%- if agenda.event -%} +L’événement que vous suivez {% include "agenda_status_text.txt" %}. +{%- else -%} +Le plan de couverture que vous suivez {% include "agenda_status_text.txt" %}. +{%- endif -%} + +{% include "email_watched_agenda.fr_ca.txt" %} + +{% endblock %} \ No newline at end of file diff --git a/server/theme/company_expiry_alert_user.fr_ca.html b/server/theme/company_expiry_alert_user.fr_ca.html new file mode 100644 index 0000000..aab7be8 --- /dev/null +++ b/server/theme/company_expiry_alert_user.fr_ca.html @@ -0,0 +1,2 @@ +

Le compte de votre entreprise expirera le {{expiry_date.strftime('%d-%m-%Y')}}


+

Veuillez contacter La Presse Canadienne pour obtenir plus de détails.

diff --git a/server/theme/company_expiry_alert_user.fr_ca.txt b/server/theme/company_expiry_alert_user.fr_ca.txt new file mode 100644 index 0000000..af61bca --- /dev/null +++ b/server/theme/company_expiry_alert_user.fr_ca.txt @@ -0,0 +1,2 @@ +Le compte de votre entreprise expirera le {{expiry_date.strftime('%d-%m-%Y')}} +Veuillez contacter La Presse Canadienne pour obtenir plus de détails. diff --git a/server/theme/company_expiry_alert_user.html b/server/theme/company_expiry_alert_user.html new file mode 100644 index 0000000..94e8fb9 --- /dev/null +++ b/server/theme/company_expiry_alert_user.html @@ -0,0 +1,3 @@ +

Your company's account is expiring on {{expiry_date.strftime('%d-%m-%Y')}}


+

Please contact The Canadian Press for further details.

+ diff --git a/server/theme/company_expiry_alert_user.txt b/server/theme/company_expiry_alert_user.txt new file mode 100644 index 0000000..dc6e40e --- /dev/null +++ b/server/theme/company_expiry_alert_user.txt @@ -0,0 +1,2 @@ +Your company's account is expiring on {{expiry_date.strftime('%d-%m-%Y')}} +Please contact The Canadian Press for further details. diff --git a/server/theme/company_expiry_email.fr_ca.html b/server/theme/company_expiry_email.fr_ca.html new file mode 100644 index 0000000..897c526 --- /dev/null +++ b/server/theme/company_expiry_email.fr_ca.html @@ -0,0 +1,5 @@ +

Les comptes d’entreprise suivants ont expiré ou doivent expirer dans les sept prochains jours (avant le {{expiry_date.strftime('%d-%m-%Y')}}):

+ +{% for company in companies %} +

{{ company.get('name') }} (Courriel: {{ company.contact_email if company.contact_email else '-'}}), (Gestionnaire de compte: {{ company.account_manager if company.account_manager else '-' }}) expirant le {{ company.expiry_date.strftime('%d-%m-%Y')}}

+{% endfor %} diff --git a/server/theme/company_expiry_email.fr_ca.txt b/server/theme/company_expiry_email.fr_ca.txt new file mode 100644 index 0000000..c0aca6b --- /dev/null +++ b/server/theme/company_expiry_email.fr_ca.txt @@ -0,0 +1,5 @@ +Les comptes d’entreprise suivants ont expiré ou doivent expirer dans les sept prochains jours (avant le {{expiry_date.strftime('%d-%m-%Y')}}): + +{% for company in companies %} + {{ company.get('name') }} (Courriel: {{ company.contact_email if company.contact_email else '-'}}), (Gestionnaire de compte: {{ company.account_manager if company.account_manager else '-' }}) expirant le {{ company.expiry_date.strftime('%d-%m-%Y')}} +{% endfor %} diff --git a/server/theme/coverage_request_content.fr_ca.html b/server/theme/coverage_request_content.fr_ca.html new file mode 100644 index 0000000..f4da92b --- /dev/null +++ b/server/theme/coverage_request_content.fr_ca.html @@ -0,0 +1,7 @@ +{% block content %} +

Une requête de couverture a été soumise par {{ name }} ({{ email }}) de {{ company }} au sujet de {{ item_name }}

+ +Message: +{% include "message.html" %} +Cliquez pour répondre +{% endblock %} diff --git a/server/theme/coverage_request_content.fr_ca.txt b/server/theme/coverage_request_content.fr_ca.txt new file mode 100644 index 0000000..66acf64 --- /dev/null +++ b/server/theme/coverage_request_content.fr_ca.txt @@ -0,0 +1,5 @@ +{% block content %} +Une requête de couverture a été soumise par {{ name }} ({{ email }}) de {{ company }} au sujet de "{{ item_name }}" ({{ url }}) +Message: +{{ get_multi_line_message(message) }} +{% endblock %} diff --git a/server/theme/coverage_request_email.fr_ca.html b/server/theme/coverage_request_email.fr_ca.html new file mode 100644 index 0000000..4d27b65 --- /dev/null +++ b/server/theme/coverage_request_email.fr_ca.html @@ -0,0 +1,4 @@ +{% extends "email_layout.fr_ca.html" %} +{% include "coverage_request_content.fr_ca.html" %} +{% block name %}{% endblock %} +{% block footer %}{% endblock %} diff --git a/server/theme/coverage_request_email.fr_ca.txt b/server/theme/coverage_request_email.fr_ca.txt new file mode 100644 index 0000000..19fbf0c --- /dev/null +++ b/server/theme/coverage_request_email.fr_ca.txt @@ -0,0 +1,2 @@ +{% extends "email_layout.fr_ca.txt" %} +{% include "coverage_request_content.fr_ca.txt" %} diff --git a/server/theme/coverage_status_text.fr_ca.txt b/server/theme/coverage_status_text.fr_ca.txt new file mode 100644 index 0000000..22b7305 --- /dev/null +++ b/server/theme/coverage_status_text.fr_ca.txt @@ -0,0 +1,15 @@ +{%- if cov.workflow_status == 'cancelled' -%} + a été annulé +{%- elif cov.workflow_status == 'draft' -%} + attendue à {{ get_coverage_date(cov) }} +{%- elif cov.workflow_status == 'assigned' -%} + attendue à {{ get_coverage_date(cov) }} +{%- elif cov.workflow_status == 'active' -%} + en cours à {{ get_coverage_date(cov) }} +{%- elif cov.workflow_status == 'completed' -%} + {%- if cov.deliveries | length is gt 1 -%} + mis à jour à {{ get_coverage_publish_time(cov) }} + {%- else -%} + disponible à {{ get_coverage_publish_time(cov) }} + {%- endif -%} +{%- endif -%} \ No newline at end of file diff --git a/server/theme/email_watched_agenda.fr_ca.html b/server/theme/email_watched_agenda.fr_ca.html new file mode 100644 index 0000000..481264a --- /dev/null +++ b/server/theme/email_watched_agenda.fr_ca.html @@ -0,0 +1,35 @@ +

{{ agenda.name or agenda.definition_short }}

+{{ url_for_agenda(agenda) }} +
+
+ {% if time_updated %}! {% endif %}{{ dateString }}{% if agenda.definition_short %} - {{ agenda.definition_short }}{% endif %} +
+ +{% if agenda.get('ednote') %} +
+ Note: {{ agenda.get('ednote') }} +
+{% endif %} +
+ +{% for cov in coverage_updates.cancelled_coverages %} +
+ ! Couverture {{ get_coverage_content_type(cov, 'fr_ca') }} '{{ cov.slugline or cov.planning.slugline }}' {% include 'coverage_status_text.fr_ca.txt' %} +
+ {% if cov.get('planning', {}).get('ednote') %}{{ "\r\n" }}
Note de la rédaction: {{ cov['planning']['ednote'] }}
{% endif %} +
+{% endfor %} +{% for cov in coverage_updates.modified_coverages %} +
+ ! Couverture {{ get_coverage_content_type(cov, 'fr_ca') }} '{{ cov.slugline or cov.planning.slugline }}' {% include 'coverage_status_text.fr_ca.txt' %} +
+ {% if cov.get('planning', {}).get('ednote') %}{{ "\r\n" }}
Note de la rédaction: {{ cov['planning']['ednote'] }}
{% endif %} +
+{% endfor %} +{% for cov in coverage_updates.unaltered_coverages %} +
+ Couverture {{ get_coverage_content_type(cov, 'fr_ca') }} '{{ cov.slugline or cov.planning.slugline }}' {% include 'coverage_status_text.fr_ca.txt' %} +
+ {% if cov.get('planning', {}).get('ednote') %}{{ "\r\n" }}
Note de la rédaction: {{ cov['planning']['ednote'] }}
{% endif %} +
+{% endfor %} diff --git a/server/theme/email_watched_agenda.fr_ca.txt b/server/theme/email_watched_agenda.fr_ca.txt new file mode 100644 index 0000000..7f474b8 --- /dev/null +++ b/server/theme/email_watched_agenda.fr_ca.txt @@ -0,0 +1,27 @@ +{{ agenda.name or agenda.definition_short }} + +{{ url_for_agenda(agenda) }} + +{% if time_updated %}! {% endif %}{{ dateString }}{% if agenda.definition_short %} - {{ agenda.definition_short }}{% endif %} +{% if agenda.ednote %}Note: {{ agenda.ednote }}{% endif %} + +{% for cov in coverage_updates.cancelled_coverages -%} + ! Couverture {{ get_coverage_content_type(cov, 'fr_ca') }} '{{ cov.slugline or cov.planning.slugline }}' {% include 'coverage_status_text.fr_ca.txt' %} + {%- if cov.get('planning', {}).get('ednote') %} + Note de la rédaction: {{ cov['planning']['ednote'] }} + {%- endif %} +{%- endfor %} + +{% for cov in coverage_updates.modified_coverages -%} + Couverture {{ get_coverage_content_type(cov, 'fr_ca') }} '{{ cov.slugline or cov.planning.slugline }}' {% include 'coverage_status_text.fr_ca.txt' %} + {%- if cov.get('planning', {}).get('ednote') %} + Note de la rédaction: {{ cov['planning']['ednote'] }} + {%- endif %} +{%- endfor %} + +{% for cov in coverage_updates.unaltered_coverages -%} + Couverture {{ get_coverage_content_type(cov, 'fr_ca') }} '{{ cov.slugline or cov.planning.slugline }}' {% include 'coverage_status_text.fr_ca.txt' %} + {%- if cov.get('planning', {}).get('ednote') %} + Note de la rédaction: {{ cov['planning']['ednote'] }} + {%- endif %} +{%- endfor %}