Les trigger warning sont signalés

Fix #201
This commit is contained in:
Jean-Marie Favreau 2024-11-17 23:59:25 +01:00
parent 5a6f33f8e2
commit 956ec7210c
13 changed files with 103 additions and 52 deletions

View File

@ -232,7 +232,7 @@ class EventModerateForm(ModelForm):
new_tags = MultipleChoiceFieldAcceptAll( new_tags = MultipleChoiceFieldAcceptAll(
label=_("New tags"), label=_("New tags"),
help_text=_('Create new labels (sparingly).'), help_text=_('Create new labels (sparingly). Note: by starting your tag with the characters “TW:”, you''ll create a “trigger warning” tag, and the associated events will be announced as such.'),
widget=DynamicArrayWidget(), widget=DynamicArrayWidget(),
required=False required=False
) )

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: agenda_culturel\n" "Project-Id-Version: agenda_culturel\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-11-17 22:38+0100\n" "POT-Creation-Date: 2024-11-17 23:43+0100\n"
"PO-Revision-Date: 2023-10-29 14:16+0000\n" "PO-Revision-Date: 2023-10-29 14:16+0000\n"
"Last-Translator: Jean-Marie Favreau <jeanmarie.favreau@free.fr>\n" "Last-Translator: Jean-Marie Favreau <jeanmarie.favreau@free.fr>\n"
"Language-Team: Jean-Marie Favreau <jeanmarie.favreau@free.fr>\n" "Language-Team: Jean-Marie Favreau <jeanmarie.favreau@free.fr>\n"
@ -182,8 +182,15 @@ msgid "New tags"
msgstr "Nouvelles étiquettes" msgstr "Nouvelles étiquettes"
#: agenda_culturel/forms.py:235 #: agenda_culturel/forms.py:235
msgid "Create new labels (sparingly)." msgid ""
msgstr "Créer (avec parcimonie) de nouvelles étiquettes." "Create new labels (sparingly). Note: by starting your tag with the "
"characters “TW:”, youll create a “trigger warning” tag, and the associated "
"events will be announced as such."
msgstr ""
"Créer (avec parcimonie) de nouvelles étiquettes. "
"Remarque: en faisant commencer votre étiquette par les caractères “TW:”, "
"vous créerez une étiquette “trigger warning”, et les événements associés "
"seront annoncés comme tels."
#: agenda_culturel/forms.py:275 #: agenda_culturel/forms.py:275
msgid "JSON in the format expected for the import." msgid "JSON in the format expected for the import."
@ -1007,44 +1014,44 @@ msgstr "Les propriétés du message de contact ont été modifié avec succès."
msgid "Spam has been successfully deleted." msgid "Spam has been successfully deleted."
msgstr "Le spam a été supprimé avec succès" msgstr "Le spam a été supprimé avec succès"
#: agenda_culturel/views.py:1000 #: agenda_culturel/views.py:1004
msgid "The import has been run successfully." msgid "The import has been run successfully."
msgstr "L'import a été lancé avec succès" msgstr "L'import a été lancé avec succès"
#: agenda_culturel/views.py:1019 #: agenda_culturel/views.py:1023
msgid "The import has been canceled." msgid "The import has been canceled."
msgstr "L'import a été annulé" msgstr "L'import a été annulé"
#: agenda_culturel/views.py:1093 #: agenda_culturel/views.py:1097
msgid "The recurrent import has been successfully modified." msgid "The recurrent import has been successfully modified."
msgstr "L'import récurrent a été modifié avec succès." msgstr "L'import récurrent a été modifié avec succès."
#: agenda_culturel/views.py:1102 #: agenda_culturel/views.py:1106
msgid "The recurrent import has been successfully deleted." msgid "The recurrent import has been successfully deleted."
msgstr "L'import récurrent a été supprimé avec succès" msgstr "L'import récurrent a été supprimé avec succès"
#: agenda_culturel/views.py:1142 #: agenda_culturel/views.py:1146
msgid "The import has been launched." msgid "The import has been launched."
msgstr "L'import a été lancé" msgstr "L'import a été lancé"
#: agenda_culturel/views.py:1164 #: agenda_culturel/views.py:1168
msgid "Imports has been launched." msgid "Imports has been launched."
msgstr "Les imports ont été lancés" msgstr "Les imports ont été lancés"
#: agenda_culturel/views.py:1223 #: agenda_culturel/views.py:1227
msgid "Update successfully completed." msgid "Update successfully completed."
msgstr "Mise à jour réalisée avec succès." msgstr "Mise à jour réalisée avec succès."
#: agenda_culturel/views.py:1281 #: agenda_culturel/views.py:1285
msgid "Creation of a merged event has been successfully completed." msgid "Creation of a merged event has been successfully completed."
msgstr "Création d'un événement fusionné réalisée avec succès." msgstr "Création d'un événement fusionné réalisée avec succès."
#: agenda_culturel/views.py:1317 #: agenda_culturel/views.py:1321
msgid "Events have been marked as unduplicated." msgid "Events have been marked as unduplicated."
msgstr "Les événements ont été marqués comme non dupliqués." msgstr "Les événements ont été marqués comme non dupliqués."
#: agenda_culturel/views.py:1331 agenda_culturel/views.py:1340 #: agenda_culturel/views.py:1335 agenda_culturel/views.py:1344
#: agenda_culturel/views.py:1358 #: agenda_culturel/views.py:1362
msgid "" msgid ""
"The selected item is no longer included in the list of duplicates. Someone " "The selected item is no longer included in the list of duplicates. Someone "
"else has probably modified the list in the meantime." "else has probably modified the list in the meantime."
@ -1052,23 +1059,23 @@ msgstr ""
"L'élément sélectionné ne fait plus partie de la liste des dupliqués. Une " "L'élément sélectionné ne fait plus partie de la liste des dupliqués. Une "
"autre personne a probablement modifié la liste entre temps." "autre personne a probablement modifié la liste entre temps."
#: agenda_culturel/views.py:1334 #: agenda_culturel/views.py:1338
msgid "The selected event has been set as representative" msgid "The selected event has been set as representative"
msgstr "L'événement sélectionné a été défini comme representatif." msgstr "L'événement sélectionné a été défini comme representatif."
#: agenda_culturel/views.py:1349 #: agenda_culturel/views.py:1353
msgid "The event has been withdrawn from the group and made independent." msgid "The event has been withdrawn from the group and made independent."
msgstr "L'événement a été retiré du groupe et rendu indépendant." msgstr "L'événement a été retiré du groupe et rendu indépendant."
#: agenda_culturel/views.py:1393 #: agenda_culturel/views.py:1397
msgid "Cleaning up duplicates: {} item(s) fixed." msgid "Cleaning up duplicates: {} item(s) fixed."
msgstr "Nettoyage des dupliqués: {} élément(s) corrigé(s)." msgstr "Nettoyage des dupliqués: {} élément(s) corrigé(s)."
#: agenda_culturel/views.py:1442 #: agenda_culturel/views.py:1446
msgid "The event was successfully duplicated." msgid "The event was successfully duplicated."
msgstr "L'événement a été marqué dupliqué avec succès." msgstr "L'événement a été marqué dupliqué avec succès."
#: agenda_culturel/views.py:1450 #: agenda_culturel/views.py:1454
msgid "" msgid ""
"The event has been successfully flagged as a duplicate. The moderation team " "The event has been successfully flagged as a duplicate. The moderation team "
"will deal with your suggestion shortly." "will deal with your suggestion shortly."
@ -1076,32 +1083,32 @@ msgstr ""
"L'événement a été signalé comme dupliqué avec succès. Votre suggestion sera " "L'événement a été signalé comme dupliqué avec succès. Votre suggestion sera "
"prochainement prise en charge par l'équipe de modération." "prochainement prise en charge par l'équipe de modération."
#: agenda_culturel/views.py:1503 #: agenda_culturel/views.py:1507
msgid "The categorisation rule has been successfully modified." msgid "The categorisation rule has been successfully modified."
msgstr "La règle de catégorisation a été modifiée avec succès." msgstr "La règle de catégorisation a été modifiée avec succès."
#: agenda_culturel/views.py:1512 #: agenda_culturel/views.py:1516
msgid "The categorisation rule has been successfully deleted." msgid "The categorisation rule has been successfully deleted."
msgstr "La règle de catégorisation a été supprimée avec succès" msgstr "La règle de catégorisation a été supprimée avec succès"
#: agenda_culturel/views.py:1534 #: agenda_culturel/views.py:1538
msgid "The rules were successfully applied and 1 event was categorised." msgid "The rules were successfully applied and 1 event was categorised."
msgstr "" msgstr ""
"Les règles ont été appliquées avec succès et 1 événement a été catégorisé" "Les règles ont été appliquées avec succès et 1 événement a été catégorisé"
#: agenda_culturel/views.py:1541 #: agenda_culturel/views.py:1545
msgid "The rules were successfully applied and {} events were categorised." msgid "The rules were successfully applied and {} events were categorised."
msgstr "" msgstr ""
"Les règles ont été appliquées avec succès et {} événements ont été " "Les règles ont été appliquées avec succès et {} événements ont été "
"catégorisés" "catégorisés"
#: agenda_culturel/views.py:1548 agenda_culturel/views.py:1601 #: agenda_culturel/views.py:1552 agenda_culturel/views.py:1605
msgid "The rules were successfully applied and no events were categorised." msgid "The rules were successfully applied and no events were categorised."
msgstr "" msgstr ""
"Les règles ont été appliquées avec succès et aucun événement n'a été " "Les règles ont été appliquées avec succès et aucun événement n'a été "
"catégorisé" "catégorisé"
#: agenda_culturel/views.py:1587 #: agenda_culturel/views.py:1591
msgid "" msgid ""
"The rules were successfully applied and 1 event with default category was " "The rules were successfully applied and 1 event with default category was "
"categorised." "categorised."
@ -1109,7 +1116,7 @@ msgstr ""
"Les règles ont été appliquées avec succès et 1 événement avec catégorie par " "Les règles ont été appliquées avec succès et 1 événement avec catégorie par "
"défaut a été catégorisé" "défaut a été catégorisé"
#: agenda_culturel/views.py:1594 #: agenda_culturel/views.py:1598
msgid "" msgid ""
"The rules were successfully applied and {} events with default category were " "The rules were successfully applied and {} events with default category were "
"categorised." "categorised."
@ -1117,50 +1124,50 @@ msgstr ""
"Les règles ont été appliquées avec succès et {} événements avec catégorie " "Les règles ont été appliquées avec succès et {} événements avec catégorie "
"par défaut ont été catégorisés" "par défaut ont été catégorisés"
#: agenda_culturel/views.py:1683 agenda_culturel/views.py:1745 #: agenda_culturel/views.py:1687 agenda_culturel/views.py:1749
#: agenda_culturel/views.py:1783 #: agenda_culturel/views.py:1787
msgid "{} events have been updated." msgid "{} events have been updated."
msgstr "{} événements ont été mis à jour." msgstr "{} événements ont été mis à jour."
#: agenda_culturel/views.py:1686 agenda_culturel/views.py:1747 #: agenda_culturel/views.py:1690 agenda_culturel/views.py:1751
#: agenda_culturel/views.py:1786 #: agenda_culturel/views.py:1790
msgid "1 event has been updated." msgid "1 event has been updated."
msgstr "1 événement a été mis à jour" msgstr "1 événement a été mis à jour"
#: agenda_culturel/views.py:1688 agenda_culturel/views.py:1749 #: agenda_culturel/views.py:1692 agenda_culturel/views.py:1753
#: agenda_culturel/views.py:1788 #: agenda_culturel/views.py:1792
msgid "No events have been modified." msgid "No events have been modified."
msgstr "Aucun événement n'a été modifié." msgstr "Aucun événement n'a été modifié."
#: agenda_culturel/views.py:1697 #: agenda_culturel/views.py:1701
msgid "The place has been successfully updated." msgid "The place has been successfully updated."
msgstr "Le lieu a été modifié avec succès." msgstr "Le lieu a été modifié avec succès."
#: agenda_culturel/views.py:1706 #: agenda_culturel/views.py:1710
msgid "The place has been successfully created." msgid "The place has been successfully created."
msgstr "Le lieu a été créé avec succès." msgstr "Le lieu a été créé avec succès."
#: agenda_culturel/views.py:1771 #: agenda_culturel/views.py:1775
msgid "The selected place has been assigned to the event." msgid "The selected place has been assigned to the event."
msgstr "Le lieu sélectionné a été assigné à l'événement." msgstr "Le lieu sélectionné a été assigné à l'événement."
#: agenda_culturel/views.py:1775 #: agenda_culturel/views.py:1779
msgid "A new alias has been added to the selected place." msgid "A new alias has been added to the selected place."
msgstr "Un nouvel alias a été créé pour le lieu sélectionné." msgstr "Un nouvel alias a été créé pour le lieu sélectionné."
#: agenda_culturel/views.py:1831 #: agenda_culturel/views.py:1835
msgid "The tag has been successfully updated." msgid "The tag has been successfully updated."
msgstr "L'étiquette a été modifiée avec succès." msgstr "L'étiquette a été modifiée avec succès."
#: agenda_culturel/views.py:1838 #: agenda_culturel/views.py:1842
msgid "The tag has been successfully created." msgid "The tag has been successfully created."
msgstr "L'étiquette a été créée avec succès." msgstr "L'étiquette a été créée avec succès."
#: agenda_culturel/views.py:1901 #: agenda_culturel/views.py:1906
msgid "You have not modified the tag name." msgid "You have not modified the tag name."
msgstr "Vous n'avez pas modifié le nom de l'étiquette." msgstr "Vous n'avez pas modifié le nom de l'étiquette."
#: agenda_culturel/views.py:1911 #: agenda_culturel/views.py:1916
msgid "" msgid ""
"This tag {} is already in use, and is described by different information " "This tag {} is already in use, and is described by different information "
"from the current tag. You can force renaming by checking the corresponding " "from the current tag. You can force renaming by checking the corresponding "
@ -1173,7 +1180,7 @@ msgstr ""
"sera supprimée, et tous les événements associés à l'étiquette {} seront " "sera supprimée, et tous les événements associés à l'étiquette {} seront "
"associés à l'étiquette {}." "associés à l'étiquette {}."
#: agenda_culturel/views.py:1918 #: agenda_culturel/views.py:1923
msgid "" msgid ""
"This tag {} is already in use. You can force renaming by checking the " "This tag {} is already in use. You can force renaming by checking the "
"corresponding option." "corresponding option."
@ -1181,6 +1188,11 @@ msgstr ""
"Cette étiquette {} est déjà utilisée. Vous pouvez forcer le renommage en " "Cette étiquette {} est déjà utilisée. Vous pouvez forcer le renommage en "
"cochant l'option correspondante." "cochant l'option correspondante."
#: agenda_culturel/views.py:1941 #: agenda_culturel/views.py:1946
msgid "The tag {} has been successfully renamed to {}." msgid "The tag {} has been successfully renamed to {}."
msgstr "L'étiquette {} a été renommée avec succès en {}." msgstr "L'étiquette {} a été renommée avec succès en {}."
#: agenda_culturel/views.py:1980
msgid "The tag {} has been successfully deleted."
msgstr "L'événement {} a été supprimé avec succès."

View File

@ -198,6 +198,7 @@ details[role="list"] summary + ul li.selected>a:hover {
@extend .outline; @extend .outline;
font-size: 90%; font-size: 90%;
padding: 0.15em 0.4em 0.3em 0.4em; padding: 0.15em 0.4em 0.3em 0.4em;
overflow: hidden;
} }
@ -871,6 +872,7 @@ nav>div {
} }
.badge.error { .badge.error {
background: #b71c1c; background: #b71c1c;
border-color: #cb1b1b; border-color: #cb1b1b;
@ -882,6 +884,25 @@ nav>div {
color: var(--secondary-inverse); color: var(--secondary-inverse);
} }
.tw-badge {
background: black;
border-color: black;
color: #f2f207;
font-weight: bold;
padding: 0.2em 0.4em;
font-size: 60%;
opacity: 80%;
}
.tw-prefix {
background: black;
color: #f2f207;
height: 2.1em;
margin: -0.5em 0 -0.5em -0.5em;
padding: 0.3em;
display: inline-block;
}
form [role="button"], form button { form [role="button"], form button {
margin: var(--spacing) 0 var(--spacing) 0; margin: var(--spacing) 0 var(--spacing) 0;
} }

View File

@ -44,7 +44,7 @@
{% if event.start_day == day.date and event.start_time %} {% if event.start_day == day.date and event.start_time %}
{{ event.start_time }} {{ event.start_time }}
{% endif %} {% endif %}
<a href="{{ event.get_absolute_url }}">{{ event|picto_status }} {{ event.title }}</a> <a href="{{ event.get_absolute_url }}">{{ event|picto_status }} {{ event.title }} {{ event|tw_badge }}</a>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
@ -67,6 +67,7 @@
{{ event.start_time }} {{ event.start_time }}
{% endif %} {% endif %}
{{ event|picto_status }} <a href="{{ event.get_absolute_url }}" data-target="event-{{ event.id }}" onClick="toggleModal(event)">{{ event.title }}</a> {{ event|picto_status }} <a href="{{ event.get_absolute_url }}" data-target="event-{{ event.id }}" onClick="toggleModal(event)">{{ event.title }}</a>
{{ event|tw_badge }}
<dialog id="event-{{ event.id }}"> <dialog id="event-{{ event.id }}">
{% include "agenda_culturel/single-event/event-modal-inc.html" with event=event filter=filter %} {% include "agenda_culturel/single-event/event-modal-inc.html" with event=event filter=filter %}
</dialog> </dialog>

View File

@ -4,6 +4,7 @@
{% load cat_extra %} {% load cat_extra %}
{% load utils_extra %} {% load utils_extra %}
{% load tag_extra %}
{% block entete_header %} {% block entete_header %}
{% css_categories %} {% css_categories %}
@ -43,7 +44,7 @@
<li><strong>Catégorie&nbsp;:</strong> {{ object.defaultCategory }}</li> <li><strong>Catégorie&nbsp;:</strong> {{ object.defaultCategory }}</li>
<li><strong>Étiquettes&nbsp;:</strong> <li><strong>Étiquettes&nbsp;:</strong>
{% for tag in object.defaultTags %} {% for tag in object.defaultTags %}
{{ tag }}{% if not forloop.last %}, {% endif %} {{ tag|tw_highlight }}{% if not forloop.last %}, {% endif %}
{% endfor %} {% endfor %}
</li> </li>
</ul> </ul>

View File

@ -101,7 +101,7 @@
{% if event.start_time %} {% if event.start_time %}
{{ event.start_time }} {{ event.start_time }}
{% endif %} {% endif %}
{{ event|picto_status }} <a href="#event-{{ event.id }}">{{ event.title }}</a> {{ event|picto_status }} <a href="#event-{{ event.id }}">{{ event.title }}</a> {{ event|tw_badge }}
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>

View File

@ -57,7 +57,7 @@
<div class="infos"> <div class="infos">
<p> <p>
{% for tag in event.tags %} {% for tag in event.tags %}
<a href="{% url 'view_tag' tag|prepare_tag %}" role="button" class="small-cat">{{ tag }}</a> <a href="{% url 'view_tag' tag|prepare_tag %}" role="button" class="small-cat">{{ tag|tw_highlight }}</a>
{% endfor %} {% endfor %}
</p> </p>

View File

@ -37,7 +37,7 @@
<p class="subentry-search"> <p class="subentry-search">
{% picto_from_name "tag" %} {% picto_from_name "tag" %}
{% for tag in event.tags %} {% for tag in event.tags %}
<a href="{% url 'view_tag' tag|prepare_tag %}">{{ tag }}</a> <a href="{% url 'view_tag' tag|prepare_tag %}">{{ tag|tw_highlight }}</a>
{% if not forloop.last %}, {% endif %} {% if not forloop.last %}, {% endif %}
{% endfor %} {% endfor %}
</p> </p>

View File

@ -39,7 +39,7 @@
<p> <p>
{% picto_from_name "tag" %} {% picto_from_name "tag" %}
{% for tag in event.tags %} {% for tag in event.tags %}
<a href="{% url 'view_tag' tag|prepare_tag %}">{{ tag }}</a> <a href="{% url 'view_tag' tag|prepare_tag %}">{{ tag|tw_highlight }}</a>
{% if not forloop.last %}, {% endif %} {% if not forloop.last %}, {% endif %}
{% endfor %} {% endfor %}
</p> </p>

View File

@ -66,7 +66,7 @@
<p> <p>
{% for tag in event.tags %} {% for tag in event.tags %}
<a href="{% url 'view_tag' tag|prepare_tag %}" role="button" class="small-cat">{{ tag }}</a> <a href="{% url 'view_tag' tag|prepare_tag %}" role="button" class="small-cat">{{ tag|tw_highlight }}</a>
{% endfor %} {% endfor %}
</p> </p>

View File

@ -1,5 +1,7 @@
{% extends "agenda_culturel/page.html" %} {% extends "agenda_culturel/page.html" %}
{% load tag_extra %}
{% block title %}{% block og_title %}Les événements {{ tag }}{% endblock %}{% endblock %} {% block title %}{% block og_title %}Les événements {{ tag }}{% endblock %}{% endblock %}
{% load cat_extra %} {% load cat_extra %}

View File

@ -163,4 +163,11 @@ def only_allowed(elist, is_authenticated):
if not is_authenticated: if not is_authenticated:
return [e for e in elist if e.status == Event.STATUS.PUBLISHED] return [e for e in elist if e.status == Event.STATUS.PUBLISHED]
else: else:
return elist return elist
@register.filter
def tw_badge(event):
if event.tags and len([t for t in event.tags if t.startswith("TW:")]) > 0:
return mark_safe('<span class="badge tw-badge">TW</span>')
else:
return ""

View File

@ -68,4 +68,11 @@ def show_suggested_tags(filter):
@register.filter @register.filter
def prepare_tag(tag): def prepare_tag(tag):
return tag.replace('/', '-') return tag.replace('/', '-')
@register.filter
def tw_highlight(tag):
if tag.startswith('TW:'):
return mark_safe('<span class="tw-prefix">TW:</span>' + tag[3:])
else:
return tag