Skip to content

Commit fbde76d

Browse files
authored
Make facilitators and stories indexes the same size as the other indexes (#589)
1 parent 6c7ecf4 commit fbde76d

File tree

3 files changed

+109
-120
lines changed

3 files changed

+109
-120
lines changed

app/controllers/facilitators_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def index
1515
.search_by_params(params.to_unsafe_h)
1616
.includes(:user).references(:user)
1717
.order(:first_name, :last_name)
18-
@facilitators_count = facilitators.size
18+
@count_display = facilitators.size
1919
@facilitators = facilitators.paginate(page: params[:page], per_page: per_page)
2020
end
2121

app/views/facilitators/index.html.erb

Lines changed: 91 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,105 @@
1-
<div class="min-h-screen py-8">
2-
<div class="max-w-full mx-auto px-4 sm:px-6 lg:px-8">
3-
<div class="max-w-7xl mx-auto <%= DomainTheme.bg_class_for(:facilitators) %> border border-gray-200 rounded-xl shadow-lg hover:shadow-xl transition-shadow duration-200 p-6">
4-
<div class="space-y-6">
5-
<!-- Header -->
6-
<div class="flex items-center justify-between mb-6">
7-
<h1 class="text-2xl font-semibold text-gray-900">
8-
<%= Facilitator.model_name.human.pluralize %> (<%= @facilitators_count %>)
9-
</h1>
10-
<div class="flex gap-2">
11-
<% if current_user.super_user? %>
12-
<%= link_to "New #{Facilitator.model_name.human.downcase}",
13-
new_facilitator_path,
14-
class: "admin-only bg-blue-100 btn btn-primary-outline" %>
15-
<% end %>
16-
</div>
17-
</div>
1+
<div class="community-news-index max-w-7xl mx-auto <%= DomainTheme.bg_class_for(:facilitators) %> border border-gray-200 rounded-xl shadow p-6">
2+
<div class="w-full">
3+
<div class="flex items-start justify-between mb-6">
4+
<div class="pr-6">
5+
<h2 class="text-2xl font-semibold mb-2">Facilitators (<%= @count_display %>)</h2>
6+
</div>
7+
<div class="text-right text-end">
8+
<% if current_user.super_user? %>
9+
<%= link_to "New Facilitator",
10+
new_facilitator_path,
11+
class: "admin-only bg-blue-100 btn btn-primary-outline" %>
12+
<% end %>
13+
</div>
14+
</div>
1815

19-
<!-- Filter form -->
20-
<%= render "search_boxes" %>
16+
<%= render "search_boxes" %>
2117

22-
<div class="rounded-xl bg-white p-6">
23-
<div class="overflow-x-auto">
24-
<table class="w-full border-collapse border border-gray-200">
25-
<thead class="bg-gray-100">
26-
<tr>
27-
<th class="px-4 py-2 text-left text-sm font-semibold text-gray-700 w-1/6">Name</th>
28-
<th class="px-4 py-2 text-center text-sm font-semibold text-gray-700 w-1/6">Facilitator since</th>
29-
<th class="px-4 py-2 text-left text-sm font-semibold text-gray-700 w-1/6">Sector(s)</th>
30-
<th class="px-4 py-2 text-left text-sm font-semibold text-gray-700 w-1/3">Affiliation(s)</th>
31-
<th class="px-4 py-2 text-left text-sm font-semibold text-gray-700 w-1/6">Socials</th>
32-
<% if current_user.super_user? %>
33-
<th class="px-4 py-2 text-center text-sm font-semibold text-gray-700 w-[80px]">Actions</th>
34-
<% end %>
35-
</tr>
36-
</thead>
18+
<div class="rounded-xl bg-white p-6">
19+
<div class="overflow-x-auto">
20+
<table class="w-full border-collapse border border-gray-200">
21+
<thead class="bg-gray-100">
22+
<tr>
23+
<th class="px-4 py-2 text-left text-sm font-semibold text-gray-700 w-1/6">Name</th>
24+
<th class="px-4 py-2 text-center text-sm font-semibold text-gray-700 w-1/6">Facilitator since</th>
25+
<th class="px-4 py-2 text-left text-sm font-semibold text-gray-700 w-1/6">Sector(s)</th>
26+
<th class="px-4 py-2 text-left text-sm font-semibold text-gray-700 w-1/3">Affiliation(s)</th>
27+
<th class="px-4 py-2 text-left text-sm font-semibold text-gray-700 w-1/6">Socials</th>
28+
<% if current_user.super_user? %>
29+
<th class="px-4 py-2 text-center text-sm font-semibold text-gray-700 w-[80px]">Actions</th>
30+
<% end %>
31+
</tr>
32+
</thead>
3733

38-
<tbody class="divide-y divide-gray-200">
39-
<% @facilitators.each do |facilitator| %>
40-
<% facilitator = facilitator.decorate %>
41-
<tr class="hover:bg-gray-50 transition-colors duration-150">
42-
<td class="px-4 py-2">
43-
<%= facilitator_profile_button(facilitator) %>
44-
</td>
34+
<tbody class="divide-y divide-gray-200">
35+
<% @facilitators.each do |facilitator| %>
36+
<% facilitator = facilitator.decorate %>
37+
<tr class="hover:bg-gray-50 transition-colors duration-150">
38+
<td class="px-4 py-2">
39+
<%= facilitator_profile_button(facilitator) %>
40+
</td>
4541

46-
<td class="px-4 py-2 text-center text-sm text-gray-800">
47-
<%= facilitator.member_since_year %>
48-
</td>
42+
<td class="px-4 py-2 text-center text-sm text-gray-800">
43+
<%= facilitator.member_since_year %>
44+
</td>
4945

50-
<!-- Sectors -->
51-
<td class="px-4 py-2 text-sm text-gray-800">
52-
<div class="flex flex-wrap gap-2">
53-
<% facilitator.sectorable_items.each do |si| %>
54-
<% si_name = "#{ si.sector.name }#{ " (#{"leader"})" if si.is_leader? }" %>
55-
<span class="inline-flex items-center px-2 py-1 rounded-full text-xs
56-
font-medium bg-gray-400 text-white whitespace-nowrap">
57-
<%= link_to si_name, taggings_path(sector_names: si.sector.name) %>
58-
</span>
59-
<% end %>
60-
</div>
61-
</td>
46+
<!-- Sectors -->
47+
<td class="px-4 py-2 text-sm text-gray-800">
48+
<div class="flex flex-wrap gap-2">
49+
<% facilitator.sectorable_items.each do |si| %>
50+
<% si_name = "#{ si.sector.name }#{ " (#{"leader"})" if si.is_leader? }" %>
51+
<span class="inline-flex items-center px-2 py-1 rounded-full text-xs
52+
font-medium bg-gray-400 text-white whitespace-nowrap">
53+
<%= link_to si_name, taggings_path(sector_names: si.sector.name) %>
54+
</span>
55+
<% end %>
56+
</div>
57+
</td>
6258

63-
<!-- Organizations -->
64-
<td class="px-4 py-2 text-sm text-gray-800">
65-
<% if facilitator.user&.projects&.any? %>
66-
<% user_project_names = facilitator.user.projects.map(&:name).join(", ") %>
67-
<span title="<%= user_project_names %>">
68-
<%= truncate(user_project_names, length: 120) %>
69-
</span>
70-
<% else %>
71-
<span>--</span>
72-
<% end %>
73-
</td>
59+
<!-- Organizations -->
60+
<td class="px-4 py-2 text-sm text-gray-800">
61+
<% if facilitator.user&.projects&.any? %>
62+
<% user_project_names = facilitator.user.projects.map(&:name).join(", ") %>
63+
<span title="<%= user_project_names %>">
64+
<%= truncate(user_project_names, length: 120) %>
65+
</span>
66+
<% else %>
67+
<span>--</span>
68+
<% end %>
69+
</td>
7470

75-
<!-- Phone -->
76-
<td class="px-4 py-2 text-sm text-gray-800 whitespace-nowrap">
77-
<%= render "social_media_buttons", facilitator: facilitator %>
78-
</td>
71+
<!-- Phone -->
72+
<td class="px-4 py-2 text-sm text-gray-800 whitespace-nowrap">
73+
<%= render "social_media_buttons", facilitator: facilitator %>
74+
</td>
7975

80-
<!-- Actions -->
81-
<% if current_user.super_user? %>
82-
<td class="px-4 py-2 justify-center gap-2">
83-
<%= link_to "User", user_path(facilitator.user),
84-
class: "admin-only bg-blue-100 btn btn-secondary-outline" if facilitator.user %>
85-
<%= link_to "Edit", edit_facilitator_path(facilitator),
86-
class: "admin-only bg-blue-100 btn btn-secondary-outline" %>
87-
</td>
88-
<% end %>
89-
</tr>
76+
<!-- Actions -->
77+
<% if current_user.super_user? %>
78+
<td class="px-4 py-2 justify-center gap-2">
79+
<%= link_to "User", user_path(facilitator.user),
80+
class: "admin-only bg-blue-100 btn btn-secondary-outline" if facilitator.user %>
81+
<%= link_to "Edit", edit_facilitator_path(facilitator),
82+
class: "admin-only bg-blue-100 btn btn-secondary-outline" %>
83+
</td>
9084
<% end %>
91-
</tbody>
92-
</table>
93-
</div>
94-
</div>
95-
96-
<!-- Empty state -->
97-
<% unless @facilitators.any? %>
98-
<p class="text-gray-500 text-center py-6">
99-
No <%= Facilitator.model_name.human.pluralize %> found.
100-
</p>
85+
</tr>
10186
<% end %>
87+
</tbody>
88+
</table>
89+
</div>
90+
</div>
91+
92+
<!-- Empty state -->
93+
<% unless @facilitators.any? %>
94+
<p class="text-gray-500 text-center py-6">
95+
No <%= Facilitator.model_name.human.pluralize %> found.
96+
</p>
97+
<% end %>
10298

103-
<!-- Pagination -->
104-
<div class="mt-6 flex justify-center">
105-
<div class="pagination">
106-
<%= tailwind_paginate @facilitators %>
107-
</div>
108-
</div>
99+
<!-- Pagination -->
100+
<div class="mt-6 flex justify-center">
101+
<div class="pagination">
102+
<%= tailwind_paginate @facilitators %>
109103
</div>
110104
</div>
111105
</div>

app/views/stories/index.html.erb

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
1-
<div class="min-h-screen py-8">
2-
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
3-
<div class="border border-gray-200 <%= DomainTheme.bg_class_for(:stories) %> rounded-xl shadow-md hover:shadow-lg transition-shadow duration-200 p-6">
4-
<!-- Header Row -->
5-
<div class="w-full">
6-
<div class="flex items-start justify-between mb-6">
7-
<div class="pr-6">
8-
<h2 class="text-2xl font-semibold mb-2"><%= Story.model_name.human.pluralize %> (<%= @count_display %>)</h2>
9-
</div>
10-
<div class="text-right text-end">
11-
<% if current_user.super_user? %>
12-
<%= link_to "New Story",
13-
new_story_path,
14-
class: "admin-only bg-blue-100 btn btn-primary-outline" %>
15-
<% end %>
16-
</div>
17-
</div>
1+
<div class="community-news-index max-w-7xl mx-auto <%= DomainTheme.bg_class_for(:stories) %> border border-gray-200 rounded-xl shadow p-6">
2+
<div class="w-full">
3+
<div class="flex items-start justify-between mb-6">
4+
<div class="pr-6">
5+
<h2 class="text-2xl font-semibold mb-2">Stories (<%= @count_display %>)</h2>
6+
</div>
7+
<div class="text-right text-end">
8+
<% if current_user.super_user? %>
9+
<%= link_to "New Story",
10+
new_story_path,
11+
class: "admin-only bg-blue-100 btn btn-primary-outline" %>
12+
<% end %>
13+
</div>
14+
</div>
1815

19-
<%= render "search_boxes" %>
16+
<%= render "search_boxes" %>
2017

21-
<% if @stories.any? %>
18+
<% if @stories.any? %>
2219
<div class="overflow-x-auto bg-white border border-gray-200 rounded-xl shadow-sm">
2320
<table class="min-w-full divide-y divide-gray-200">
2421
<thead class="bg-gray-50">
@@ -109,8 +106,6 @@
109106
<% end %>
110107
</div>
111108
<% end %>
112-
</div>
113-
</div>
109+
114110
</div>
115111
</div>
116-

0 commit comments

Comments
 (0)