Skip to content

Commit

Permalink
Clean up My Stuff cards and show "None found" when empty
Browse files Browse the repository at this point in the history
  • Loading branch information
moveson committed Dec 18, 2024
1 parent 7b5532b commit 26867e1
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 42 deletions.
12 changes: 8 additions & 4 deletions app/views/my_stuff/_event_series.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<%# locals: (presenter:) %>

<turbo-frame id="my_stuff_event_series_card">
<% presenter.recent_event_series(10).each do |series| %>
<h4 class="card-text">
<strong><%= link_to series.name, organization_event_series_path(series.organization, series) %></strong>
</h4>
<% if presenter.recent_event_series(1).any? %>
<% presenter.recent_event_series(10).each do |series| %>
<h4 class="card-text">
<strong><%= link_to series.name, organization_event_series_path(series.organization, series) %></strong>
</h4>
<% end %>
<% else %>
<div class="card-text h5">None found</div>
<% end %>
</turbo-frame>
12 changes: 8 additions & 4 deletions app/views/my_stuff/_events.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<%# locals: (presenter:) %>

<turbo-frame id="my_stuff_events_card">
<% presenter.recent_event_groups(20).each do |event_group| %>
<h4 class="card-text">
<strong><%= link_to event_group.name, event_group_path(event_group) %></strong>
</h4>
<% if presenter.recent_event_groups(1).any? %>
<% presenter.recent_event_groups(20).each do |event_group| %>
<h4 class="card-text">
<strong><%= link_to event_group.name, event_group_path(event_group) %></strong>
</h4>
<% end %>
<% else %>
<div class="card-text h5">None found</div>
<% end %>
</turbo-frame>
12 changes: 8 additions & 4 deletions app/views/my_stuff/_interests.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<%# locals: (presenter:) %>

<turbo-frame id="my_stuff_interests_card">
<% presenter.interests.each do |person| %>
<h4 class="card-text">
<strong><%= link_to person.full_name, person_path(person) %></strong>
</h4>
<% if presenter.interests.any? %>
<% presenter.interests.each do |person| %>
<h4 class="card-text">
<strong><%= link_to person.full_name, person_path(person) %></strong>
</h4>
<% end %>
<% else %>
<div class="card-text h5">None found</div>
<% end %>
</turbo-frame>
12 changes: 8 additions & 4 deletions app/views/my_stuff/_live_updates.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<%# locals: (presenter:) %>

<turbo-frame id="my_stuff_live_updates_card">
<% presenter.watch_efforts.each do |effort| %>
<h4 class="card-text">
<strong><%= link_to "#{effort.full_name} at #{effort.event_name}", effort_path(effort) %></strong>
</h4>
<% if presenter.watch_efforts.any? %>
<% presenter.watch_efforts.each do |effort| %>
<h4 class="card-text">
<strong><%= link_to "#{effort.full_name} at #{effort.event_name}", effort_path(effort) %></strong>
</h4>
<% end %>
<% else %>
<div class="card-text h5">None found</div>
<% end %>
</turbo-frame>
26 changes: 15 additions & 11 deletions app/views/my_stuff/_organizations.html.erb
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
<%# locals: (presenter:) %>

<turbo-frame id="my_stuff_organizations_card">
<% presenter.owned_organizations.each do |organization| %>
<h4 class="card-text">
<strong><%= link_to organization.name, organization_path(organization) %></strong>
<span class="badge bg-secondary">Owner</span>
</h4>
<% end %>
<% presenter.steward_organizations.each do |organization| %>
<h4 class="card-text">
<strong><%= link_to organization.name, organization_path(organization) %></strong>
<span class="badge bg-secondary">Steward</span>
</h4>
<% if presenter.owned_organizations.any? || presenter.steward_organizations.any? %>
<% presenter.owned_organizations.each do |organization| %>
<h4 class="card-text">
<strong><%= link_to organization.name, organization_path(organization) %></strong>
<span class="badge bg-secondary">Owner</span>
</h4>
<% end %>
<% presenter.steward_organizations.each do |organization| %>
<h4 class="card-text">
<strong><%= link_to organization.name, organization_path(organization) %></strong>
<span class="badge bg-secondary">Steward</span>
</h4>
<% end %>
<% else %>
<div class="card-text h5">None found</div>
<% end %>
</turbo-frame>
12 changes: 8 additions & 4 deletions app/views/my_stuff/_results.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<%# locals: (presenter:) %>

<turbo-frame id="my_stuff_results_card">
<% presenter.recent_user_efforts(20).each do |effort| %>
<h4 class="card-text">
<strong><%= link_to effort.event_name, effort_path(effort) %></strong>
</h4>
<% if presenter.recent_user_efforts(1).any? %>
<% presenter.recent_user_efforts(20).each do |effort| %>
<h4 class="card-text">
<strong><%= link_to effort.event_name, effort_path(effort) %></strong>
</h4>
<% end %>
<% else %>
<div class="card-text h5">None found</div>
<% end %>
</turbo-frame>
12 changes: 8 additions & 4 deletions app/views/my_stuff/_service_requirements.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<%# locals: (presenter:) %>

<turbo-frame id="my_stuff_service_requirements_card">
<% presenter.drawn_lottery_entrants.each do |lottery_entrant| %>
<h4 class="card-text fw-bold">
<%= link_to lottery_entrant.lottery.name, organization_lottery_entrant_service_detail_path(lottery_entrant.organization, lottery_entrant.lottery, lottery_entrant) %>
</h4>
<% if presenter.drawn_lottery_entrants.any? %>
<% presenter.drawn_lottery_entrants.each do |lottery_entrant| %>
<div class="card-text h4 fw-bold">
<%= link_to lottery_entrant.lottery.name, organization_lottery_entrant_service_detail_path(lottery_entrant.organization, lottery_entrant.lottery, lottery_entrant) %>
</div>
<% end %>
<% else %>
<div class="card-text h5">None found</div>
<% end %>
</turbo-frame>
14 changes: 7 additions & 7 deletions app/views/my_stuff/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

<div class="col-md-6 col-lg-4">
<div class="card mb-3">
<h3 class="card-header"><strong>My Service Requirements</strong></h3>
<div class="card-header h3 fw-bold">Manage Service</div>
<div class="card-body">
<turbo-frame id="my_stuff_service_requirements_card" src="<%= my_stuff_service_requirements_path %>" target="_top">
<%= render partial: "shared/loading" %>
Expand All @@ -54,7 +54,7 @@

<div class="col-md-6 col-lg-4">
<div class="card mb-3">
<h3 class="card-header"><strong>My Results</strong></h3>
<div class="card-header h3 fw-bold">My Results</div>
<div class="card-body">
<turbo-frame id="my_stuff_results_card" src="<%= my_stuff_results_path %>" target="_top">
<%= render partial: "shared/loading" %>
Expand All @@ -65,7 +65,7 @@

<div class="col-md-6 col-lg-4">
<div class="card mb-3">
<h3 class="card-header"><strong>My Events</strong></h3>
<div class="card-header h3 fw-bold">My Events</div>
<div class="card-body">
<turbo-frame id="my_stuff_events_card" src="<%= my_stuff_events_path %>" target="_top">
<%= render partial: "shared/loading" %>
Expand All @@ -76,7 +76,7 @@

<div class="col-md-6 col-lg-4">
<div class="card mb-3">
<h3 class="card-header"><strong>My Event Series</strong></h3>
<div class="card-header h3 fw-bold">My Event Series</div>
<div class="card-body">
<turbo-frame id="my_stuff_event_series_card" src="<%= my_stuff_event_series_path %>" target="_top">
<%= render partial: "shared/loading" %>
Expand All @@ -87,7 +87,7 @@

<div class="col-md-6 col-lg-4">
<div class="card mb-3">
<h3 class="card-header"><strong>My Interests</strong></h3>
<div class="card-header h3 fw-bold">My Interests</div>
<div class="card-body">
<turbo-frame id="my_stuff_interests_card" src="<%= my_stuff_interests_path %>" target="_top">
<%= render partial: "shared/loading" %>
Expand All @@ -98,7 +98,7 @@

<div class="col-md-6 col-lg-4">
<div class="card mb-3">
<h3 class="card-header"><strong>My Live Updates</strong></h3>
<div class="card-header h3 fw-bold">My Live Updates</div>
<div class="card-body">
<turbo-frame id="my_stuff_live_updates_card" src="<%= my_stuff_live_updates_path %>" target="_top">
<%= render partial: "shared/loading" %>
Expand All @@ -109,7 +109,7 @@

<div class="col-md-6 col-lg-4">
<div class="card mb-3">
<h3 class="card-header"><strong>My Organizations</strong></h3>
<div class="card-header h3 fw-bold">My Organizations</div>
<div class="card-body">
<turbo-frame id="my_stuff_organizations_card" src="<%= my_stuff_organizations_path %>" target="_top">
<%= render partial: "shared/loading" %>
Expand Down

0 comments on commit 26867e1

Please sign in to comment.