Skip to content

Commit

Permalink
update email alerts template for agenda items [CPCN-523] (#158)
Browse files Browse the repository at this point in the history
* update email alerts template for agenda items [CPCN-523]

* minor change

* refactore templates
  • Loading branch information
devketanpro authored Jan 15, 2024
1 parent 24643e8 commit 0f32d4b
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 21 deletions.
26 changes: 15 additions & 11 deletions server/theme/email_agenda.fr_ca.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h1>{{ get_highlighted_field(item, ["headline", "name"]) | safe }}</h1>
<a href="{{ url_for_agenda(item) }}">{{ url_for_agenda(item) }}</a>
<a href="{{ url_for_agenda(item) }}"><b>Voir cet élément dans votre compte: </b>{{ url_for_agenda(item) }}</a>

{% if item.event %}<p class="h3">{{ dateString }}</p>{% endif %}
{% if item.event %}<p class="h3"><b>Quand: </b>{{ dateString }}</p>{% endif %}

{% if location and location != '' %}
<p class="h3"><b>Où:</b> {{ location }}</p>
Expand Down Expand Up @@ -32,6 +32,7 @@ <h1>{{ get_highlighted_field(item, ["headline", "name"]) | safe }}</h1>
{% endif %}

{% if item.definition_long or item.definition_short %}
<b>Description de l’événement: </b>
<p>
{{ get_highlighted_field(item, ["definition_long", "definition_short"]) | safe }}
</p>
Expand All @@ -43,7 +44,7 @@ <h1>{{ get_highlighted_field(item, ["headline", "name"]) | safe }}</h1>
<h3>Élément de couverture:</h3>
{% if (planning_item.get('description_text') or planning_item.get('name') or '') != (item.definition_long or item.definition_short) %}
<p>
{{ planning_item.get('description_text') or planning_item.get('name') or '' }}
<b>Description de l’élément de planification: </b>{{ planning_item.get('description_text') or planning_item.get('name') or '' }}
</p>
{% endif %}
</div>
Expand All @@ -62,14 +63,17 @@ <h3>Élément de couverture:</h3>
</div>

{% for cov in get_planning_coverages(item, planning_item._id) %}
<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') %}
<div><i> Note de la rédaction: {{ cov['planning']['ednote'] }}</i></div>
{% endif %}
{% if is_admin and cov.get('planning', {}).get('internal_note') %}
<div><i>Note interne: {{ cov['planning']['internal_note'] }}</i></div>
{% endif %}
<br><br>
<div>
<p><b>Type de couverture: </b>{{get_coverage_content_type(cov,recipient_language)}}</p>
<p><b>Statut de couverture: </b>{{get_coverage_status(cov)}}</p>
<p><b>Date et heure d’échéance de la couverture: </b>{{get_coverage_date(cov)}}</p>
<p><b>Affecté à: </b>
{% if cov.get('assigned_desk_name') %}{{cov['assigned_desk_name']}}{% endif %}
{% if cov.get('assigned_desk_email') %}<a href="mailto:{{cov['assigned_desk_email']}}?subject=Demande de couverture d’une utilisatrice de PC NouvellesPro: {{item.headline or item.name}}">{{cov['assigned_desk_email']}}</a>{% endif %}
{% if cov.get('assigned_user_name') %}{{cov['assigned_user_name']}}{% endif %}
{% if cov.get('assigned_user_email') %}<a href="mailto:{{cov['assigned_desk_email']}}?subject=Demande de couverture d’une utilisatrice de PC NouvellesPro: {{item.headline or item.name}}">{{cov['assigned_user_email']}}</a>{% endif %}
</p>
</div>
{% endfor %}
</p>
{% endif %}
Expand Down
22 changes: 12 additions & 10 deletions server/theme/email_agenda.fr_ca.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
{{ item.headline or item.name }}
{{ url_for_agenda(item) }}
{% if item.event %}{{ dateString }}{% endif %}
Voir cet élément dans votre compte: {{ url_for_agenda(item) }}
{% if item.event %}Quand: {{ dateString }}{% endif %}
{% if location and location != '' %}Où: {{ location }}
{% endif %}{% if contacts | length is gt 1 %}Contact: {% for contact in contacts %}{{ contact.name or contact.organisation }} {{ contact.phone }} {{ contact.mobile }} {{ contact.email }}
{% endfor %}
{% endif %}{% if links | length is gt 1 %}Web: {% for link in links %}{{ link }}
{% endfor %}
{% endif %}
{% if item.definition_long or item.definition_short %}{{ item.definition_long or item.definition_short }}
{% if item.definition_long or item.definition_short %}Description de l’événement: {{ item.definition_long or item.definition_short }}
{% endif %}
{% for planning_item in item.get('planning_items', []) or [] %}
Élément de couverture:
{%- if (planning_item.get('description_text') or planning_item.get('name') or '') != (item.definition_long or item.definition_short) %}
{{ planning_item.get('description_text') or planning_item.get('name') or '' }}
Description de l’élément de planification: {{ planning_item.get('description_text') or planning_item.get('name') or '' }}
{% endif -%}
{% if planning_item.get('ednote') %}Note de la rédaction: {{ planning_item.get('ednote') }}{% endif %}
{% if planning_item.get('coverages', []) | length is gt 0 %}
Couverture:
{% for cov in get_planning_coverages(item, planning_item._id) %}
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 %}
{%- if is_admin and cov.get('planning', {}).get('internal_note') %}
Note interne: {{ cov['planning']['internal_note'] }}
{% endif %}
Type de couverture: {{get_coverage_content_type(cov,recipient_language)}}
Statut de couverture: {{get_coverage_status(cov)}}
Date et heure d’échéance de la couverture: {{get_coverage_date(cov)}}
Affecté à:
{% if cov.get('assigned_desk_name')%}{{cov['assigned_desk_name']}}{% endif %}
{% if cov.get('assigned_desk_email') %}{{cov['assigned_desk_email']}}{% endif %}
{% if cov.get('assigned_user_name') %}{{cov['assigned_user_name']}}{% endif %}
{% if cov.get('assigned_user_email') %}{{cov['assigned_user_email']}}{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
82 changes: 82 additions & 0 deletions server/theme/email_agenda.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<h1>{{ get_highlighted_field(item, ["headline", "name"]) | safe }}</h1>
<a href="{{ url_for_agenda(item) }}"><b>View this item in your account: </b>{{ url_for_agenda(item) }}</a>
{% if item.event %}<p class="h3"><b>When:</b>{{ dateString }}</p>{% endif %}

{% if location and location != '' %}
<p class="h3"><b>Where:</b> {{ location }}</p>
{% endif %}

{% if map and map != '' %}
<div><img style="height: auto!important; max-width: 700px!important; width: 100%!important"
src={{ map | safe }} ></div>
{% endif %}

{% if contacts | length is gt 1 %}
<p><b>Contact: </b>
{% for contact in contacts %}
<div>{{ contact.name or contact.organisation }}
{{ contact.phone }}
{{ contact.mobile }}
{{ contact.email }}</div>
{% endfor %}
</p>
{% endif %}

{% if links | length is gt 1 %}
<p><b>Web: </b>
{% for link in links %}
<div><a href={{ link | safe }}>{{ link }}</a></div>
{% endfor %}
</p>
{% endif %}

{% if item.definition_long or item.definition_short %}
<b>Event description: </b>
<p>
{{ get_highlighted_field(item, ["definition_long", "definition_short"]) | safe }}
</p>
{% endif %}

{% for planning_item in item.get('planning_items', []) or [] %}
<div>
<div>
<h3>Planning item:</h3>
{% if (planning_item.get('description_text') or planning_item.get('name') or '') != (item.definition_long or item.definition_short) %}
<p>
<b>Planning item description:</b> {{ planning_item.get('description_text') or planning_item.get('name') or '' }}
</p>
{% endif %}
</div>

{% if planning_item.get('ednote') %}
<div>
<strong>Editorial Note:</strong>
{{ planning_item.get('ednote') }}
</div>
{% endif %}

{% if planning_item.get('coverages', []) %}
<p>
<div>
<p><strong>Coverage:</strong></p>
</div>

{% for cov in get_planning_coverages(item, planning_item._id) %}
<div>
<p><b>Type of coverage: </b>{{get_coverage_content_type(cov,recipient_language)}}</p>
<p><b>Coverage status: </b>{{get_coverage_status(cov)}}</p>
<p><b>Coverage due date & time: </b>{{get_coverage_date(cov)}}</p>
{% if cov.get('assigned_desk_name') or cov.get('assigned_desk_email') or cov.get('assigned_user_name') or cov.get('assigned_user_email') %}
<p><b>Assigned to:</b>
{% if cov.get('assigned_desk_name') %}{{cov['assigned_desk_name']}}{% endif %}
{% if cov.get('assigned_desk_email') %}<a href="mailto:{{cov['assigned_desk_email']}}?subject=Coverage inquiry from CP NewsPro user: {{item.headline or item.name}}">{{cov['assigned_desk_email']}}</a>{% endif %}
{% if cov.get('assigned_user_name') %}{{cov['assigned_user_name']}}{% endif %}
{% if cov.get('assigned_user_email') %}<a href="mailto:{{cov['assigned_desk_email']}}?subject=Coverage inquiry from CP NewsPro user: {{item.headline or item.name}}">{{cov['assigned_user_email']}}</a>{% endif %}
</p>
{% endif %}
</div>
{% endfor %}
</p>
{% endif %}
</div>
{% endfor %}
32 changes: 32 additions & 0 deletions server/theme/email_agenda.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{ item.headline or item.name }}
View this item in your account: {{ url_for_agenda(item) }}
{% if item.event %} When: {{ dateString }}{% endif %}
{% if location and location != '' %}Where: {{ location }}
{% endif %}{% if contacts | length is gt 1 %}Contact: {% for contact in contacts %}{{ contact.name or contact.organisation }} {{ contact.phone }} {{ contact.mobile }} {{ contact.email }}
{% endfor %}
{% endif %}{% if links | length is gt 1 %}Web: {% for link in links %}{{ link }}
{% endfor %}
{% endif %}
{% if item.definition_long or item.definition_short %}Event description: {{ item.definition_long or item.definition_short }}
{% endif %}
{% for planning_item in item.get('planning_items', []) or [] %}
Planning Item:
{%- if (planning_item.get('description_text') or planning_item.get('name') or '') != (item.definition_long or item.definition_short) %}
Planning item description: {{ planning_item.get('description_text') or planning_item.get('name') or '' }}
{% endif -%}
{% if planning_item.get('ednote') %}Editorial Note: {{ planning_item.get('ednote') }}
{% endif -%}
{% if planning_item.get('coverages', []) | length is gt 0 %}
Coverages:
{% for cov in get_planning_coverages(item, planning_item._id) %}
Type of coverage:{{get_coverage_content_type(cov,recipient_language)}}
Coverage status: {{get_coverage_status(cov)}}
Coverage due date & time: {{get_coverage_date(cov)}}
Assigned to:
{% if cov.get('assigned_desk_name') %}{{cov['assigned_desk_name']}}{% endif %}
{% if cov.get('assigned_desk_email') %}{{cov['assigned_desk_email']}}{% endif %}
{% if cov.get('assigned_user_name') %}{{cov['assigned_user_name']}}{% endif %}
{% if cov.get('assigned_user_email') %}{{cov['assigned_user_email']}}{% endif %}
{% endfor %}
{% endif %}
{% endfor %}

0 comments on commit 0f32d4b

Please sign in to comment.