From 26867e1be626d11e71cb7c273b9ea27eb70e135a Mon Sep 17 00:00:00 2001 From: moveson Date: Tue, 17 Dec 2024 20:43:02 -0700 Subject: [PATCH] Clean up My Stuff cards and show "None found" when empty --- app/views/my_stuff/_event_series.html.erb | 12 ++++++--- app/views/my_stuff/_events.html.erb | 12 ++++++--- app/views/my_stuff/_interests.html.erb | 12 ++++++--- app/views/my_stuff/_live_updates.html.erb | 12 ++++++--- app/views/my_stuff/_organizations.html.erb | 26 +++++++++++-------- app/views/my_stuff/_results.html.erb | 12 ++++++--- .../my_stuff/_service_requirements.html.erb | 12 ++++++--- app/views/my_stuff/index.html.erb | 14 +++++----- 8 files changed, 70 insertions(+), 42 deletions(-) diff --git a/app/views/my_stuff/_event_series.html.erb b/app/views/my_stuff/_event_series.html.erb index e43d6696a..db8aeb6f5 100644 --- a/app/views/my_stuff/_event_series.html.erb +++ b/app/views/my_stuff/_event_series.html.erb @@ -1,9 +1,13 @@ <%# locals: (presenter:) %> - <% presenter.recent_event_series(10).each do |series| %> -

- <%= link_to series.name, organization_event_series_path(series.organization, series) %> -

+ <% if presenter.recent_event_series(1).any? %> + <% presenter.recent_event_series(10).each do |series| %> +

+ <%= link_to series.name, organization_event_series_path(series.organization, series) %> +

+ <% end %> + <% else %> +
None found
<% end %>
diff --git a/app/views/my_stuff/_events.html.erb b/app/views/my_stuff/_events.html.erb index 46856a4b6..e74a293c0 100644 --- a/app/views/my_stuff/_events.html.erb +++ b/app/views/my_stuff/_events.html.erb @@ -1,9 +1,13 @@ <%# locals: (presenter:) %> - <% presenter.recent_event_groups(20).each do |event_group| %> -

- <%= link_to event_group.name, event_group_path(event_group) %> -

+ <% if presenter.recent_event_groups(1).any? %> + <% presenter.recent_event_groups(20).each do |event_group| %> +

+ <%= link_to event_group.name, event_group_path(event_group) %> +

+ <% end %> + <% else %> +
None found
<% end %>
diff --git a/app/views/my_stuff/_interests.html.erb b/app/views/my_stuff/_interests.html.erb index a058b81c5..e9af5e9b0 100644 --- a/app/views/my_stuff/_interests.html.erb +++ b/app/views/my_stuff/_interests.html.erb @@ -1,9 +1,13 @@ <%# locals: (presenter:) %> - <% presenter.interests.each do |person| %> -

- <%= link_to person.full_name, person_path(person) %> -

+ <% if presenter.interests.any? %> + <% presenter.interests.each do |person| %> +

+ <%= link_to person.full_name, person_path(person) %> +

+ <% end %> + <% else %> +
None found
<% end %>
diff --git a/app/views/my_stuff/_live_updates.html.erb b/app/views/my_stuff/_live_updates.html.erb index 9379b556d..1cce482b2 100644 --- a/app/views/my_stuff/_live_updates.html.erb +++ b/app/views/my_stuff/_live_updates.html.erb @@ -1,9 +1,13 @@ <%# locals: (presenter:) %> - <% presenter.watch_efforts.each do |effort| %> -

- <%= link_to "#{effort.full_name} at #{effort.event_name}", effort_path(effort) %> -

+ <% if presenter.watch_efforts.any? %> + <% presenter.watch_efforts.each do |effort| %> +

+ <%= link_to "#{effort.full_name} at #{effort.event_name}", effort_path(effort) %> +

+ <% end %> + <% else %> +
None found
<% end %>
diff --git a/app/views/my_stuff/_organizations.html.erb b/app/views/my_stuff/_organizations.html.erb index bc7b2f8f7..4e0ab4d2f 100644 --- a/app/views/my_stuff/_organizations.html.erb +++ b/app/views/my_stuff/_organizations.html.erb @@ -1,16 +1,20 @@ <%# locals: (presenter:) %> - <% presenter.owned_organizations.each do |organization| %> -

- <%= link_to organization.name, organization_path(organization) %> - Owner -

- <% end %> - <% presenter.steward_organizations.each do |organization| %> -

- <%= link_to organization.name, organization_path(organization) %> - Steward -

+ <% if presenter.owned_organizations.any? || presenter.steward_organizations.any? %> + <% presenter.owned_organizations.each do |organization| %> +

+ <%= link_to organization.name, organization_path(organization) %> + Owner +

+ <% end %> + <% presenter.steward_organizations.each do |organization| %> +

+ <%= link_to organization.name, organization_path(organization) %> + Steward +

+ <% end %> + <% else %> +
None found
<% end %>
diff --git a/app/views/my_stuff/_results.html.erb b/app/views/my_stuff/_results.html.erb index b69551b36..026d5db41 100644 --- a/app/views/my_stuff/_results.html.erb +++ b/app/views/my_stuff/_results.html.erb @@ -1,9 +1,13 @@ <%# locals: (presenter:) %> - <% presenter.recent_user_efforts(20).each do |effort| %> -

- <%= link_to effort.event_name, effort_path(effort) %> -

+ <% if presenter.recent_user_efforts(1).any? %> + <% presenter.recent_user_efforts(20).each do |effort| %> +

+ <%= link_to effort.event_name, effort_path(effort) %> +

+ <% end %> + <% else %> +
None found
<% end %>
diff --git a/app/views/my_stuff/_service_requirements.html.erb b/app/views/my_stuff/_service_requirements.html.erb index 0b1683278..8e1fd75e9 100644 --- a/app/views/my_stuff/_service_requirements.html.erb +++ b/app/views/my_stuff/_service_requirements.html.erb @@ -1,9 +1,13 @@ <%# locals: (presenter:) %> - <% presenter.drawn_lottery_entrants.each do |lottery_entrant| %> -

- <%= link_to lottery_entrant.lottery.name, organization_lottery_entrant_service_detail_path(lottery_entrant.organization, lottery_entrant.lottery, lottery_entrant) %> -

+ <% if presenter.drawn_lottery_entrants.any? %> + <% presenter.drawn_lottery_entrants.each do |lottery_entrant| %> +
+ <%= link_to lottery_entrant.lottery.name, organization_lottery_entrant_service_detail_path(lottery_entrant.organization, lottery_entrant.lottery, lottery_entrant) %> +
+ <% end %> + <% else %> +
None found
<% end %>
diff --git a/app/views/my_stuff/index.html.erb b/app/views/my_stuff/index.html.erb index 451eede06..93297c344 100644 --- a/app/views/my_stuff/index.html.erb +++ b/app/views/my_stuff/index.html.erb @@ -43,7 +43,7 @@
-

My Service Requirements

+
Manage Service
<%= render partial: "shared/loading" %> @@ -54,7 +54,7 @@
-

My Results

+
My Results
<%= render partial: "shared/loading" %> @@ -65,7 +65,7 @@
-

My Events

+
My Events
<%= render partial: "shared/loading" %> @@ -76,7 +76,7 @@
-

My Event Series

+
My Event Series
<%= render partial: "shared/loading" %> @@ -87,7 +87,7 @@
-

My Interests

+
My Interests
<%= render partial: "shared/loading" %> @@ -98,7 +98,7 @@
-

My Live Updates

+
My Live Updates
<%= render partial: "shared/loading" %> @@ -109,7 +109,7 @@
-

My Organizations

+
My Organizations
<%= render partial: "shared/loading" %>