From 75ed7ae3ef1e0c584c9e718f26535756031d0382 Mon Sep 17 00:00:00 2001 From: cyrillefr Date: Tue, 15 Apr 2025 11:36:07 +0200 Subject: [PATCH] Replace link with button in nofications --- app/assets/stylesheets/layout.scss | 8 ++++++++ .../notifications/_notification.html.erb | 20 +++++++++---------- spec/system/notifications_spec.rb | 4 ++-- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 93428859f..377ea5716 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -1190,9 +1190,17 @@ form { @include breakpoint(medium) { .mark-notification { + @include anchor-color; + cursor: pointer; position: absolute; right: 12px; top: 12px; + + &:hover, + &:active, + &:focus { + @include anchor-color-hover; + } } } diff --git a/app/views/notifications/_notification.html.erb b/app/views/notifications/_notification.html.erb index b19be5432..3acfc6e5a 100644 --- a/app/views/notifications/_notification.html.erb +++ b/app/views/notifications/_notification.html.erb @@ -15,16 +15,16 @@ <% end %> <% if notification.unread? %> - <%= link_to t("notifications.notification.mark_as_read"), - mark_as_read_notification_path(notification), - method: :put, - remote: true, - class: "mark-notification small" %> + <%= button_to t("notifications.notification.mark_as_read"), + mark_as_read_notification_path(notification), + method: :put, + remote: true, + class: "mark-notification small" %> <% else %> - <%= link_to t("notifications.notification.mark_as_unread"), - mark_as_unread_notification_path(notification), - method: :put, - remote: true, - class: "mark-notification small" %> + <%= button_to t("notifications.notification.mark_as_unread"), + mark_as_unread_notification_path(notification), + method: :put, + remote: true, + class: "mark-notification small" %> <% end %> diff --git a/spec/system/notifications_spec.rb b/spec/system/notifications_spec.rb index f139f1d43..a8168850c 100644 --- a/spec/system/notifications_spec.rb +++ b/spec/system/notifications_spec.rb @@ -59,7 +59,7 @@ describe "Notifications" do click_notifications_icon within("#notification_#{notification1.id}") do - click_link "Mark as read" + click_button "Mark as read" end expect(page).to have_css(".notification", count: 1) @@ -89,7 +89,7 @@ describe "Notifications" do expect(page).to have_css(".notification", count: 1) within("#notification_#{notification1.id}") do - click_link "Mark as unread" + click_button "Mark as unread" end expect(page).to have_css(".notification", count: 0)