From b37a8e3f33e7482d47e32f78ae273c0828672404 Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Thu, 17 Apr 2025 16:54:11 -0500 Subject: [PATCH 1/3] Hide Previously Seen section when empty with CSS --- app/assets/stylesheets/notifications.css | 8 ++++++++ app/views/notifications/index.html.erb | 5 ++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/notifications.css b/app/assets/stylesheets/notifications.css index d8779c2e6..989d04773 100644 --- a/app/assets/stylesheets/notifications.css +++ b/app/assets/stylesheets/notifications.css @@ -94,3 +94,11 @@ } } } + +.notificiations-list--read { + display: none; + + &:has(.notification) { + display: flex; + } +} diff --git a/app/views/notifications/index.html.erb b/app/views/notifications/index.html.erb index bf83657ee..917d3b0b5 100644 --- a/app/views/notifications/index.html.erb +++ b/app/views/notifications/index.html.erb @@ -23,14 +23,13 @@ <%= render partial: "notifications/notification", collection: @unread, cached: true %> <% else %> <%# FIXME: Need to reveal this section if there are unread notification records in it %> -
+
Nothing new for you.
<% end %> -<%# FIXME: Need to hide this section if there are no notification records in it, but then it needs to appear when any are added %> -
+

Previously seen

From e16dc859e305e5a5f9df3f90968d300c72c51cb4 Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Thu, 17 Apr 2025 16:57:24 -0500 Subject: [PATCH 2/3] Display the empty message via CSS when there are no unread notifications --- app/assets/stylesheets/notifications.css | 6 ++++++ app/views/notifications/index.html.erb | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/notifications.css b/app/assets/stylesheets/notifications.css index 989d04773..bc95412d7 100644 --- a/app/assets/stylesheets/notifications.css +++ b/app/assets/stylesheets/notifications.css @@ -95,6 +95,12 @@ } } +.notifications__empty-message { + .notificiations-list:has(.notification) & { + display: none; + } +} + .notificiations-list--read { display: none; diff --git a/app/views/notifications/index.html.erb b/app/views/notifications/index.html.erb index 917d3b0b5..4b76c0779 100644 --- a/app/views/notifications/index.html.erb +++ b/app/views/notifications/index.html.erb @@ -13,7 +13,7 @@ <% end %> -
+
<% if @unread.any? %>

New for you

@@ -22,8 +22,7 @@ <%= render partial: "notifications/notification", collection: @unread, cached: true %> <% else %> - <%# FIXME: Need to reveal this section if there are unread notification records in it %> -
+
Nothing new for you.
<% end %> From c61fa77d6bdf8839bc4070ea309e1c0d355ccd10 Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Thu, 17 Apr 2025 17:03:18 -0500 Subject: [PATCH 3/3] Fix failing test (we're no longer redirecting here See: #411 --- test/controllers/cards_controller_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/controllers/cards_controller_test.rb b/test/controllers/cards_controller_test.rb index e794e7898..5272dc182 100644 --- a/test/controllers/cards_controller_test.rb +++ b/test/controllers/cards_controller_test.rb @@ -40,7 +40,7 @@ class CardsControllerTest < ActionDispatch::IntegrationTest image: fixture_file_upload("moon.jpg", "image/jpeg"), draft_comment: "Something more in-depth", tag_ids: [ tags(:mobile).id ] } } - assert_redirected_to collection_card_path(collections(:writebook), cards(:logo)) + assert_response :success card = cards(:logo).reload assert_equal "Logo needs to change", card.title