Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/facilitators_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def index
.search_by_params(params.to_unsafe_h)
.includes(:user).references(:user)
.order(:first_name, :last_name)
@facilitators_count = facilitators.size
@count_display = facilitators.size
@facilitators = facilitators.paginate(page: params[:page], per_page: per_page)
end

Expand Down
188 changes: 91 additions & 97 deletions app/views/facilitators/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,111 +1,105 @@
<div class="min-h-screen py-8">
<div class="max-w-full mx-auto px-4 sm:px-6 lg:px-8">
<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">
<div class="space-y-6">
<!-- Header -->
<div class="flex items-center justify-between mb-6">
<h1 class="text-2xl font-semibold text-gray-900">
<%= Facilitator.model_name.human.pluralize %> (<%= @facilitators_count %>)
</h1>
<div class="flex gap-2">
<% if current_user.super_user? %>
<%= link_to "New #{Facilitator.model_name.human.downcase}",
new_facilitator_path,
class: "admin-only bg-blue-100 btn btn-primary-outline" %>
<% end %>
</div>
</div>
<div class="community-news-index max-w-7xl mx-auto <%= DomainTheme.bg_class_for(:facilitators) %> border border-gray-200 rounded-xl shadow p-6">
<div class="w-full">
<div class="flex items-start justify-between mb-6">
<div class="pr-6">
<h2 class="text-2xl font-semibold mb-2">Facilitators (<%= @count_display %>)</h2>
</div>
<div class="text-right text-end">
<% if current_user.super_user? %>
<%= link_to "New Facilitator",
new_facilitator_path,
class: "admin-only bg-blue-100 btn btn-primary-outline" %>
<% end %>
</div>
</div>

<!-- Filter form -->
<%= render "search_boxes" %>
<%= render "search_boxes" %>

<div class="rounded-xl bg-white p-6">
<div class="overflow-x-auto">
<table class="w-full border-collapse border border-gray-200">
<thead class="bg-gray-100">
<tr>
<th class="px-4 py-2 text-left text-sm font-semibold text-gray-700 w-1/6">Name</th>
<th class="px-4 py-2 text-center text-sm font-semibold text-gray-700 w-1/6">Facilitator since</th>
<th class="px-4 py-2 text-left text-sm font-semibold text-gray-700 w-1/6">Sector(s)</th>
<th class="px-4 py-2 text-left text-sm font-semibold text-gray-700 w-1/3">Affiliation(s)</th>
<th class="px-4 py-2 text-left text-sm font-semibold text-gray-700 w-1/6">Socials</th>
<% if current_user.super_user? %>
<th class="px-4 py-2 text-center text-sm font-semibold text-gray-700 w-[80px]">Actions</th>
<% end %>
</tr>
</thead>
<div class="rounded-xl bg-white p-6">
<div class="overflow-x-auto">
<table class="w-full border-collapse border border-gray-200">
<thead class="bg-gray-100">
<tr>
<th class="px-4 py-2 text-left text-sm font-semibold text-gray-700 w-1/6">Name</th>
<th class="px-4 py-2 text-center text-sm font-semibold text-gray-700 w-1/6">Facilitator since</th>
<th class="px-4 py-2 text-left text-sm font-semibold text-gray-700 w-1/6">Sector(s)</th>
<th class="px-4 py-2 text-left text-sm font-semibold text-gray-700 w-1/3">Affiliation(s)</th>
<th class="px-4 py-2 text-left text-sm font-semibold text-gray-700 w-1/6">Socials</th>
<% if current_user.super_user? %>
<th class="px-4 py-2 text-center text-sm font-semibold text-gray-700 w-[80px]">Actions</th>
<% end %>
</tr>
</thead>

<tbody class="divide-y divide-gray-200">
<% @facilitators.each do |facilitator| %>
<% facilitator = facilitator.decorate %>
<tr class="hover:bg-gray-50 transition-colors duration-150">
<td class="px-4 py-2">
<%= facilitator_profile_button(facilitator) %>
</td>
<tbody class="divide-y divide-gray-200">
<% @facilitators.each do |facilitator| %>
<% facilitator = facilitator.decorate %>
<tr class="hover:bg-gray-50 transition-colors duration-150">
<td class="px-4 py-2">
<%= facilitator_profile_button(facilitator) %>
</td>

<td class="px-4 py-2 text-center text-sm text-gray-800">
<%= facilitator.member_since_year %>
</td>
<td class="px-4 py-2 text-center text-sm text-gray-800">
<%= facilitator.member_since_year %>
</td>

<!-- Sectors -->
<td class="px-4 py-2 text-sm text-gray-800">
<div class="flex flex-wrap gap-2">
<% facilitator.sectorable_items.each do |si| %>
<% si_name = "#{ si.sector.name }#{ " (#{"leader"})" if si.is_leader? }" %>
<span class="inline-flex items-center px-2 py-1 rounded-full text-xs
font-medium bg-gray-400 text-white whitespace-nowrap">
<%= link_to si_name, taggings_path(sector_names: si.sector.name) %>
</span>
<% end %>
</div>
</td>
<!-- Sectors -->
<td class="px-4 py-2 text-sm text-gray-800">
<div class="flex flex-wrap gap-2">
<% facilitator.sectorable_items.each do |si| %>
<% si_name = "#{ si.sector.name }#{ " (#{"leader"})" if si.is_leader? }" %>
<span class="inline-flex items-center px-2 py-1 rounded-full text-xs
font-medium bg-gray-400 text-white whitespace-nowrap">
<%= link_to si_name, taggings_path(sector_names: si.sector.name) %>
</span>
<% end %>
</div>
</td>

<!-- Organizations -->
<td class="px-4 py-2 text-sm text-gray-800">
<% if facilitator.user&.projects&.any? %>
<% user_project_names = facilitator.user.projects.map(&:name).join(", ") %>
<span title="<%= user_project_names %>">
<%= truncate(user_project_names, length: 120) %>
</span>
<% else %>
<span>--</span>
<% end %>
</td>
<!-- Organizations -->
<td class="px-4 py-2 text-sm text-gray-800">
<% if facilitator.user&.projects&.any? %>
<% user_project_names = facilitator.user.projects.map(&:name).join(", ") %>
<span title="<%= user_project_names %>">
<%= truncate(user_project_names, length: 120) %>
</span>
<% else %>
<span>--</span>
<% end %>
</td>

<!-- Phone -->
<td class="px-4 py-2 text-sm text-gray-800 whitespace-nowrap">
<%= render "social_media_buttons", facilitator: facilitator %>
</td>
<!-- Phone -->
<td class="px-4 py-2 text-sm text-gray-800 whitespace-nowrap">
<%= render "social_media_buttons", facilitator: facilitator %>
</td>

<!-- Actions -->
<% if current_user.super_user? %>
<td class="px-4 py-2 justify-center gap-2">
<%= link_to "User", user_path(facilitator.user),
class: "admin-only bg-blue-100 btn btn-secondary-outline" if facilitator.user %>
<%= link_to "Edit", edit_facilitator_path(facilitator),
class: "admin-only bg-blue-100 btn btn-secondary-outline" %>
</td>
<% end %>
</tr>
<!-- Actions -->
<% if current_user.super_user? %>
<td class="px-4 py-2 justify-center gap-2">
<%= link_to "User", user_path(facilitator.user),
class: "admin-only bg-blue-100 btn btn-secondary-outline" if facilitator.user %>
<%= link_to "Edit", edit_facilitator_path(facilitator),
class: "admin-only bg-blue-100 btn btn-secondary-outline" %>
</td>
<% end %>
</tbody>
</table>
</div>
</div>

<!-- Empty state -->
<% unless @facilitators.any? %>
<p class="text-gray-500 text-center py-6">
No <%= Facilitator.model_name.human.pluralize %> found.
</p>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>

<!-- Empty state -->
<% unless @facilitators.any? %>
<p class="text-gray-500 text-center py-6">
No <%= Facilitator.model_name.human.pluralize %> found.
</p>
<% end %>

<!-- Pagination -->
<div class="mt-6 flex justify-center">
<div class="pagination">
<%= tailwind_paginate @facilitators %>
</div>
</div>
<!-- Pagination -->
<div class="mt-6 flex justify-center">
<div class="pagination">
<%= tailwind_paginate @facilitators %>
</div>
</div>
</div>
Expand Down
39 changes: 17 additions & 22 deletions app/views/stories/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
<div class="min-h-screen py-8">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="border border-gray-200 <%= DomainTheme.bg_class_for(:stories) %> rounded-xl shadow-md hover:shadow-lg transition-shadow duration-200 p-6">
<!-- Header Row -->
<div class="w-full">
<div class="flex items-start justify-between mb-6">
<div class="pr-6">
<h2 class="text-2xl font-semibold mb-2"><%= Story.model_name.human.pluralize %> (<%= @count_display %>)</h2>
</div>
<div class="text-right text-end">
<% if current_user.super_user? %>
<%= link_to "New Story",
new_story_path,
class: "admin-only bg-blue-100 btn btn-primary-outline" %>
<% end %>
</div>
</div>
<div class="community-news-index max-w-7xl mx-auto <%= DomainTheme.bg_class_for(:stories) %> border border-gray-200 rounded-xl shadow p-6">
<div class="w-full">
<div class="flex items-start justify-between mb-6">
<div class="pr-6">
<h2 class="text-2xl font-semibold mb-2">Stories (<%= @count_display %>)</h2>
</div>
<div class="text-right text-end">
<% if current_user.super_user? %>
<%= link_to "New Story",
new_story_path,
class: "admin-only bg-blue-100 btn btn-primary-outline" %>
<% end %>
</div>
</div>

<%= render "search_boxes" %>
<%= render "search_boxes" %>

<% if @stories.any? %>
<% if @stories.any? %>
<div class="overflow-x-auto bg-white border border-gray-200 rounded-xl shadow-sm">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
Expand Down Expand Up @@ -109,8 +106,6 @@
<% end %>
</div>
<% end %>
</div>
</div>

</div>
</div>