Replace link with button in nofications

This commit is contained in:
cyrillefr
2025-04-15 11:36:07 +02:00
parent 267dd931d8
commit 75ed7ae3ef
3 changed files with 20 additions and 12 deletions

View File

@@ -1190,9 +1190,17 @@ form {
@include breakpoint(medium) { @include breakpoint(medium) {
.mark-notification { .mark-notification {
@include anchor-color;
cursor: pointer;
position: absolute; position: absolute;
right: 12px; right: 12px;
top: 12px; top: 12px;
&:hover,
&:active,
&:focus {
@include anchor-color-hover;
}
} }
} }

View File

@@ -15,16 +15,16 @@
<% end %> <% end %>
<% if notification.unread? %> <% if notification.unread? %>
<%= link_to t("notifications.notification.mark_as_read"), <%= button_to t("notifications.notification.mark_as_read"),
mark_as_read_notification_path(notification), mark_as_read_notification_path(notification),
method: :put, method: :put,
remote: true, remote: true,
class: "mark-notification small" %> class: "mark-notification small" %>
<% else %> <% else %>
<%= link_to t("notifications.notification.mark_as_unread"), <%= button_to t("notifications.notification.mark_as_unread"),
mark_as_unread_notification_path(notification), mark_as_unread_notification_path(notification),
method: :put, method: :put,
remote: true, remote: true,
class: "mark-notification small" %> class: "mark-notification small" %>
<% end %> <% end %>
</li> </li>

View File

@@ -59,7 +59,7 @@ describe "Notifications" do
click_notifications_icon click_notifications_icon
within("#notification_#{notification1.id}") do within("#notification_#{notification1.id}") do
click_link "Mark as read" click_button "Mark as read"
end end
expect(page).to have_css(".notification", count: 1) expect(page).to have_css(".notification", count: 1)
@@ -89,7 +89,7 @@ describe "Notifications" do
expect(page).to have_css(".notification", count: 1) expect(page).to have_css(".notification", count: 1)
within("#notification_#{notification1.id}") do within("#notification_#{notification1.id}") do
click_link "Mark as unread" click_button "Mark as unread"
end end
expect(page).to have_css(".notification", count: 0) expect(page).to have_css(".notification", count: 0)