From 140f53b81f056f5601c0b596b632c04106e50eb6 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 6 Jan 2022 13:25:18 +0100 Subject: [PATCH] setting NotificationReadToggle options for several cases. improve options --- .../public/module/notification/toggle_read.js | 4 +-- .../Notification/NotificationReadToggle.vue | 28 ++++++++++++------- ...extension_list_notifications_for.html.twig | 18 ++++++------ .../views/Notification/list.html.twig | 5 +++- .../views/Notification/show.html.twig | 5 +++- .../translations/messages.fr.yml | 2 +- 6 files changed, 39 insertions(+), 23 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/notification/toggle_read.js b/src/Bundle/ChillMainBundle/Resources/public/module/notification/toggle_read.js index 1ece0c0ad..82a118f77 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/notification/toggle_read.js +++ b/src/Bundle/ChillMainBundle/Resources/public/module/notification/toggle_read.js @@ -23,8 +23,8 @@ window.addEventListener('DOMContentLoaded', function (e) { return { notificationId: +el.dataset.notificationId, buttonClass: el.dataset.buttonClass, - buttonNoText: 'true' === el.dataset.buttonNoText, - showUrl: el.dataset.showUrl, + buttonNoText: 'false' === el.dataset.buttonText, + showUrl: el.dataset.showButtonUrl, isRead: 1 === +el.dataset.notificationCurrentIsRead, } }, diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Notification/NotificationReadToggle.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Notification/NotificationReadToggle.vue index 976046db7..c45cf1ba6 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Notification/NotificationReadToggle.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Notification/NotificationReadToggle.vue @@ -1,5 +1,5 @@ @@ -50,6 +54,7 @@ export default { required: true, type: Number, }, + // Optional buttonClass: { required: false, type: String @@ -65,14 +70,17 @@ export default { }, emits: ['markRead', 'markUnread'], computed: { + /// [Option] override default button appearance (btn-misc) overrideClass() { - console.log('button', this.buttonClass); return this.buttonClass ? this.buttonClass : 'btn-misc' }, + /// [Option] don't display text on button buttonHideText() { return this.buttonNoText; }, - showButton() { + /// [Option] showUrl is href for show page second button. + // When passed, the component return a button-group with 2 buttons. + isButtonGroup() { return !!this.showUrl } }, diff --git a/src/Bundle/ChillMainBundle/Resources/views/Notification/extension_list_notifications_for.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Notification/extension_list_notifications_for.html.twig index ec5149cbf..0235ab4f7 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Notification/extension_list_notifications_for.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Notification/extension_list_notifications_for.html.twig @@ -10,20 +10,23 @@ {% if notification.sender == app.user %}
- + {{ notification.date|format_datetime('short','short') }}
+ {% if notification.addressees|length > 0 %} - {{ 'notification.to'|trans }}: + {{ 'notification.to'|trans }}: {% endif %} + {% for a in notification.addressees %} {{ a|chill_entity_render_string }} @@ -37,7 +40,6 @@
{{ 'notification.you were notified by system'|trans }}
{% endif %} - {% endfor %} diff --git a/src/Bundle/ChillMainBundle/Resources/views/Notification/list.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Notification/list.html.twig index 0c0a75312..24fd4404a 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Notification/list.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Notification/list.html.twig @@ -98,7 +98,10 @@
  • - +
  • {% if is_granted('CHILL_MAIN_NOTIFICATION_UPDATE', notification) %}
  • diff --git a/src/Bundle/ChillMainBundle/Resources/views/Notification/show.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Notification/show.html.twig index 271def828..faab0a8cb 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Notification/show.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Notification/show.html.twig @@ -88,7 +88,10 @@
  • - +
diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index f0e906058..542a1311c 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -366,7 +366,7 @@ notification: is_system: Notification automatique list: Notifications Sent: Envoyé - sentto: Envoyé à + sent_to: Envoyé à you were notified by %sender%: Vous avez été notifié par %sender% you were notified by system: Vous avez été notifié automatiquement to: À