From 823602bcee735ae5e9201e7ff9506bff4867e84c Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Fri, 24 Jan 2025 13:56:03 -0600 Subject: [PATCH] Avoid leaving the tray open --- app/helpers/notifications_helper.rb | 2 +- app/views/notifications/_tray.html.erb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb index bb0dade2a..9d3b9a259 100644 --- a/app/helpers/notifications_helper.rb +++ b/app/helpers/notifications_helper.rb @@ -22,7 +22,7 @@ module NotificationsHelper def notification_tag(notification, &) link_to notification.resource, id: dom_id(notification), class: "notification border-radius", - data: { turbo_frame: "_top" }, & + data: { action: "click->dialog#close", turbo_frame: "_top" }, & end def notifications_next_page_link(page) diff --git a/app/views/notifications/_tray.html.erb b/app/views/notifications/_tray.html.erb index 476f0bc78..55fbfa570 100644 --- a/app/views/notifications/_tray.html.erb +++ b/app/views/notifications/_tray.html.erb @@ -4,11 +4,11 @@ data: { controller: "dialog", turbo_permanent: true, dialog_modal_value: false, dialog_target: "dialog", action: "keydown.esc->dialog#close:stop click@document->dialog#closeOnClickOutside" } do %> <%= turbo_frame_tag("notifications", src: notifications_tray_path) -%>
- <%= button_to notifications_mark_all_read_path, class: "notification-tray__read_action btn flex-item-justify-start", data: { turbo_frame: "notifications" } do %> + <%= button_to notifications_mark_all_read_path, class: "notification-tray__read_action btn flex-item-justify-start", data: { action: "click->dialog#close", turbo_frame: "notifications" } do %> Mark all as read <% end %> - <%= link_to notifications_path, class: "notification-tray__all_action btn flex-item-justify-end" do %> + <%= link_to notifications_path, class: "notification-tray__all_action btn flex-item-justify-end", data: { action: "click->dialog#close"} do %> <%= image_tag "bell.svg", aria: { hidden: true }, size: 24 %> See all notifications <% end %>