Skip to content

Commit

Permalink
[CPNHUB-24] Update agenda/company_expiry email templates (#43)
Browse files Browse the repository at this point in the history
* [CPNHUB-24] Update agenda/company_expiry email templates

* Update CoverageRequest email

* fix: Add `if` statement
  • Loading branch information
MarkLark86 authored Feb 22, 2022
1 parent 7edf5fe commit f549b4d
Show file tree
Hide file tree
Showing 18 changed files with 212 additions and 6 deletions.
30 changes: 24 additions & 6 deletions server/data/email_templates.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}"
}
}
}, {
Expand All @@ -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 }}"
}
}
}]
40 changes: 40 additions & 0 deletions server/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 9 additions & 0 deletions server/theme/agenda_status_text.txt
Original file line number Diff line number Diff line change
@@ -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 -%}
12 changes: 12 additions & 0 deletions server/theme/agenda_updated_email.fr_ca.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% extends "email_layout.fr_ca.html" %}

{% block content %}
{%- if agenda.event -%}
<p>L’événement que vous suivez {% include "agenda_status_text.txt" %}.</p>
{%- else -%}
<p>Le plan de couverture que vous suivez {% include "agenda_status_text.txt" %}.</p>
{%- endif -%}

{% include "email_watched_agenda.fr_ca.html" %}

{% endblock %}
13 changes: 13 additions & 0 deletions server/theme/agenda_updated_email.fr_ca.txt
Original file line number Diff line number Diff line change
@@ -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 %}
2 changes: 2 additions & 0 deletions server/theme/company_expiry_alert_user.fr_ca.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h3>Le compte de votre entreprise expirera le {{expiry_date.strftime('%d-%m-%Y')}}</h3></br>
<h3>Veuillez contacter La Presse Canadienne pour obtenir plus de détails.</h3>
2 changes: 2 additions & 0 deletions server/theme/company_expiry_alert_user.fr_ca.txt
Original file line number Diff line number Diff line change
@@ -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.
3 changes: 3 additions & 0 deletions server/theme/company_expiry_alert_user.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<h3>Your company's account is expiring on {{expiry_date.strftime('%d-%m-%Y')}}</h3></br>
<h3>Please contact The Canadian Press for further details.</h3>

2 changes: 2 additions & 0 deletions server/theme/company_expiry_alert_user.txt
Original file line number Diff line number Diff line change
@@ -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.
5 changes: 5 additions & 0 deletions server/theme/company_expiry_email.fr_ca.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<h3>Les comptes d’entreprise suivants ont expiré ou doivent expirer dans les sept prochains jours (avant le {{expiry_date.strftime('%d-%m-%Y')}}):</h3>

{% for company in companies %}
<h3><pre>{{ 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')}}</pre></h3>
{% endfor %}
5 changes: 5 additions & 0 deletions server/theme/company_expiry_email.fr_ca.txt
Original file line number Diff line number Diff line change
@@ -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 %}
7 changes: 7 additions & 0 deletions server/theme/coverage_request_content.fr_ca.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% block content %}
<p>Une requête de couverture a été soumise par {{ name }} (<a href="mailto:{{ email }}?cc={{ recipients|join(',') }}&subject={{ subject }}">{{ email }}</a>) de {{ company }} au sujet de <a href="{{url}}">{{ item_name }}</a></p>

Message:
{% include "message.html" %}
<a href="mailto:{{ email }}?cc={{ recipients|join(',') }}&subject={{ subject }}">Cliquez pour répondre</a>
{% endblock %}
5 changes: 5 additions & 0 deletions server/theme/coverage_request_content.fr_ca.txt
Original file line number Diff line number Diff line change
@@ -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 %}
4 changes: 4 additions & 0 deletions server/theme/coverage_request_email.fr_ca.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{% extends "email_layout.fr_ca.html" %}
{% include "coverage_request_content.fr_ca.html" %}
{% block name %}{% endblock %}
{% block footer %}{% endblock %}
2 changes: 2 additions & 0 deletions server/theme/coverage_request_email.fr_ca.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{% extends "email_layout.fr_ca.txt" %}
{% include "coverage_request_content.fr_ca.txt" %}
15 changes: 15 additions & 0 deletions server/theme/coverage_status_text.fr_ca.txt
Original file line number Diff line number Diff line change
@@ -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 -%}
35 changes: 35 additions & 0 deletions server/theme/email_watched_agenda.fr_ca.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<h2>{{ agenda.name or agenda.definition_short }}</h2>
<a href="{{ url_for_agenda(agenda) }}">{{ url_for_agenda(agenda) }}</a>
<div>
<br>
{% if time_updated %}<span style="color:red">!</span> {% endif %}<strong>{{ dateString }}</strong>{% if agenda.definition_short %} - {{ agenda.definition_short }}{% endif %}
</div>

{% if agenda.get('ednote') %}
<div>
<i>Note: {{ agenda.get('ednote') }}</i>
</div>
{% endif %}
<br>

{% for cov in coverage_updates.cancelled_coverages %}
<div>
<span style="color:red">!</span> Couverture {{ get_coverage_content_type(cov, 'fr_ca') }} '{{ cov.slugline or cov.planning.slugline }}' {% include 'coverage_status_text.fr_ca.txt' %}
</div>
{% if cov.get('planning', {}).get('ednote') %}{{ "\r\n" }}<div><i> Note de la rédaction: {{ cov['planning']['ednote'] }}</i></div>{% endif %}
<br>
{% endfor %}
{% for cov in coverage_updates.modified_coverages %}
<div>
<span style="color:red">!</span> Couverture {{ get_coverage_content_type(cov, 'fr_ca') }} '{{ cov.slugline or cov.planning.slugline }}' {% include 'coverage_status_text.fr_ca.txt' %}
</div>
{% if cov.get('planning', {}).get('ednote') %}{{ "\r\n" }}<div><i> Note de la rédaction: {{ cov['planning']['ednote'] }}</i></div>{% endif %}
<br>
{% endfor %}
{% for cov in coverage_updates.unaltered_coverages %}
<div>
Couverture {{ get_coverage_content_type(cov, 'fr_ca') }} '{{ cov.slugline or cov.planning.slugline }}' {% include 'coverage_status_text.fr_ca.txt' %}
</div>
{% if cov.get('planning', {}).get('ednote') %}{{ "\r\n" }}<div><i> Note de la rédaction: {{ cov['planning']['ednote'] }}</i></div>{% endif %}
<br>
{% endfor %}
27 changes: 27 additions & 0 deletions server/theme/email_watched_agenda.fr_ca.txt
Original file line number Diff line number Diff line change
@@ -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 %}

0 comments on commit f549b4d

Please sign in to comment.