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
4 changes: 3 additions & 1 deletion app/controllers/facilitators_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ def facilitator_params
:primary_email_address, :primary_email_address_type,
:street_address, :city, :state, :zip, :country, :mailing_address_type,
:phone_number, :phone_number_type,
:phone_number_2, :phone_number_3, :best_time_to_call,
:date_of_birth,
:created_by_id, :updated_by_id,
:bio,
:bio, :notes,
:display_name_preference,
:pronouns,
:profile_show_name_preference,
Expand Down
16 changes: 15 additions & 1 deletion app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,26 @@ def generate_facilitator
last_name: @user.last_name,
primary_email_address: @user.email,
phone_number: @user.phone,
phone_number_2: @user.phone2,
phone_number_3: @user.phone3,
best_time_to_call: @user.best_time_to_call,
date_of_birth: @user.birthday,
street_address: @user.address,
city: @user.city,
state: @user.state,
zip: @user.zip,
created_by: current_user,
updated_by: current_user
updated_by: current_user,
notes: @user.notes,
# comment: @user.comment,
# t.string "address2"
# t.integer "agency_id"
# t.string "city2"
# t.boolean "inactive", default: false
# t.integer "primary_address"
# t.string "state2"
# t.string "subscribecode"
# t.string "zip2"
)
if @facilitator.save
redirect_to @facilitator, notice: "Facilitator was successfully created for this user." and return
Expand Down
36 changes: 23 additions & 13 deletions app/helpers/facilitator_helper.rb
Original file line number Diff line number Diff line change
@@ -1,41 +1,51 @@
module FacilitatorHelper

def facilitator_profile_button(facilitator, size: 10)
link_to facilitator_path(facilitator),
class: "btn btn-secondary-outline flex items-center gap-3 px-4 py-2 rounded-lg" do
class: "group inline-flex items-center gap-2 px-4 py-2
border border-primary text-primary rounded-lg
hover:bg-primary hover:text-white transition-colors duration-200
font-medium shadow-sm leading-none whitespace-nowrap w-60" do

facilitator = facilitator.decorate

# --- Avatar ---
avatar = if facilitator.avatar_image.present?
image_tag url_for(facilitator.avatar_image.file),
class: "w-10 h-10 rounded-full object-cover border border-gray-300 shadow-sm"
elsif facilitator.user&.avatar.present?
image_tag url_for(facilitator.user.avatar),
class: "w-10 h-10 rounded-full object-cover border border-gray-300 shadow-sm"
else
image_tag "missing.png",
class: "w-10 h-10 rounded-full object-cover border border-dashed border-gray-300"
end

# --- Name (forced single line) ---
# --- Name: stays one line & turns white on hover ---
name = content_tag(
:span,
facilitator.name.to_s.truncate(28), # Prevent spillover
class: "font-semibold text-gray-900 whitespace-nowrap"
facilitator.name.to_s.truncate(21),
title: facilitator.name.to_s,
class: "font-semibold text-gray-900 whitespace-nowrap group-hover:text-white"
)

# --- Pronouns (small, optional, below) ---
# --- Pronouns ---
pronouns = if facilitator.pronouns_display.present?
content_tag(:span,
facilitator.pronouns_display,
class: "text-xs text-gray-500 italic")
content_tag(
:span,
facilitator.pronouns_display,
class: "text-xs text-gray-500 italic group-hover:text-white"
)
end

# --- Text Block ---
text_block = content_tag(:div,
safe_join([name, pronouns].compact),
class: "flex flex-col leading-tight text-left")
text_block = content_tag(
:div,
safe_join([name, pronouns].compact),
class: "flex flex-col leading-tight text-left"
)

avatar + text_block
end
end


end
4 changes: 2 additions & 2 deletions app/views/events/_card.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</div>

<!-- 1️⃣ Thumbnail + Title Row -->
<div class="flex flex-col md:flex-row gap-4">
<div class="flex flex-col md:flex-row gap-2">

<!-- Thumbnail -->
<div class="flex-shrink-0 w-32 h-24 rounded overflow-hidden bg-gray-100 relative">
Expand All @@ -30,7 +30,7 @@
</div>

<!-- Title + badges -->
<div class="flex flex-col gap-2 flex-1 min-w-0 mr-4 mt-1">
<div class="flex flex-col gap-2 flex-1 min-w-0 pr-1 mr-4 mt-1">
<%= link_to event_path(event),
class: "hover:underline block leading-tight",
data: { turbo: false } do %>
Expand Down
16 changes: 8 additions & 8 deletions app/views/facilitators/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<div class="flex-1" style="flex: 0 0 75%;">
<div class="space-y-6">
<div class="flex flex-col md:flex-row gap-4">
<%= u.input :first_name %>
<%= u.input :last_name %>
<%= f.input :first_name %>
<%= f.input :last_name %>

<div>
<label class="block text-md font-medium text-gray-700 mb-1">Email</label>
Expand All @@ -27,7 +27,7 @@

<div class="flex flex-col md:flex-row gap-4">
<%= f.input :pronouns %>
<%= u.input :birthday,
<%= f.input :date_of_birth,
as: :string,
input_html: {
type: "date",
Expand Down Expand Up @@ -66,10 +66,10 @@
<h3 class="font-semibold text-gray-700 mb-2">Phones</h3>
<div class="rounded-lg border border-gray-200 bg-gray-50 p-4 mb-4 shadow-sm">
<div class="flex flex-col md:flex-row gap-4">
<%= u.input :phone %>
<%= u.input :phone2 %>
<%= u.input :phone3 %>
<%= u.input :best_time_to_call %>
<%= f.input :phone_number %>
<%= f.input :phone_number_2 %>
<%= f.input :phone_number_3 %>
<%= f.input :best_time_to_call %>
</div>
</div>
</div>
Expand Down Expand Up @@ -112,7 +112,7 @@
<span class="text-sm font-normal text-gray-500">(only editable by admins)</span>
</div>
<div class="rounded-lg border border-gray-200 bg-gray-50 p-4 mb-4 shadow-sm">
<% if false && current_user.super_user? %>
<% if current_user.super_user? %>
<div class="admin-only bg-blue-100 p-3">
<%= u.fields_for :project_users do |project_user_form| %>
<%= render "project_user_fields",
Expand Down
8 changes: 4 additions & 4 deletions app/views/facilitators/_search_boxes.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<div class="flex flex-col md:flex-row md:flex-wrap md:items-end gap-4 mb-6">
<!-- Contact info -->
<div class="w-full md:flex-1">
<%= label_tag :contact_info, "Name, email, phone", class: "block text-sm font-medium text-gray-700 mb-1" %>
<%= label_tag :contact_info, "Name, email, or phone", class: "block text-sm font-medium text-gray-700 mb-1" %>
<div class="relative">
<%= text_field_tag :contact_info, params[:contact_info],
class: "w-full rounded-lg border border-gray-300 px-3 py-2 text-gray-800 shadow-sm
focus:border-blue-500 focus:ring focus:ring-blue-200 focus:outline-none",
placeholder: "Type and hit Enter",
placeholder: "",
onkeypress: "if(event.key === 'Enter'){ this.form.submit(); }" %>
<button type="submit"
class="absolute inset-y-0 right-0 flex items-center pr-3 text-gray-500 hover:text-blue-600"
Expand All @@ -24,7 +24,7 @@
<%= text_field_tag :sector_name, params[:sector_name],
class: "w-full rounded-lg border border-gray-300 px-3 py-2 text-gray-800 shadow-sm
focus:border-blue-500 focus:ring focus:ring-blue-200 focus:outline-none",
placeholder: "Type and hit Enter",
placeholder: "",
onkeypress: "if(event.key === 'Enter'){ this.form.submit(); }" %>
<button type="submit"
class="absolute inset-y-0 right-0 flex items-center pr-3 text-gray-500 hover:text-blue-600"
Expand All @@ -41,7 +41,7 @@
<%= text_field_tag :project_name, params[:project_name],
class: "w-full rounded-lg border border-gray-300 px-3 py-2 text-gray-800 shadow-sm
focus:border-blue-500 focus:ring focus:ring-blue-200 focus:outline-none",
placeholder: "Type and hit Enter",
placeholder: "",
onkeypress: "if(event.key === 'Enter'){ this.form.submit(); }" %>
<button type="submit"
class="absolute inset-y-0 right-0 flex items-center pr-3 text-gray-500 hover:text-blue-600"
Expand Down
26 changes: 18 additions & 8 deletions app/views/facilitators/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@
<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-left text-sm font-semibold text-gray-700 w-1/6">Facilitator since</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>
<th class="px-4 py-2 text-center text-sm font-semibold text-gray-700 w-[80px]">Actions</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>

Expand All @@ -40,13 +42,21 @@
<%= facilitator_profile_button(facilitator) %>
</td>

<td class="px-4 py-2 text-sm text-gray-800">
<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">
<%= facilitator.sector_list.join(", ") %>
<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, authenticated_root_path %>
</span>
<% end %>
</div>
</td>

<!-- Organizations -->
Expand All @@ -67,14 +77,14 @@
</td>

<!-- Actions -->
<td class="px-4 py-2 justify-center gap-2">
<% if current_user.super_user? %>
<% 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" %>
<% end %>
</td>
</td>
<% end %>
</tr>
<% end %>
</tbody>
Expand Down
5 changes: 4 additions & 1 deletion app/views/facilitators/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
<!-- Header: avatar + name + pronouns -->
<div class="flex flex-col md:flex-row md:items-center md:gap-8 mb-10">
<div class="flex-shrink-0 flex justify-center md:justify-start">
<% if @facilitator.user.avatar.attached? %>
<% if @facilitator.avatar_image&.file&.attached? %>
<%= image_tag url_for(@facilitator.avatar_image.file),
class: "w-32 h-32 rounded-full object-cover border border-gray-200 shadow-sm" %>
<% elsif @facilitator.user&.avatar&.attached? %>
<%= image_tag url_for(@facilitator.user.avatar),
class: "w-32 h-32 rounded-full object-cover border border-gray-200 shadow-sm" %>
<% else %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
<!-- Notes -->
<% if current_user.super_user? %>
<div class="admin-only bg-blue-100 p-3">
<%= f.input :notes, as: :text, input_html: { rows: 3, class: "w-full" } %>
<%= f.input :comment, as: :text, input_html: { rows: 3, class: "w-full" } %>
</div>
<% end %>

Expand Down
11 changes: 11 additions & 0 deletions db/migrate/20251204024120_add_fields_to_facilitator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class AddFieldsToFacilitator < ActiveRecord::Migration[8.1]
def change
add_column :facilitators, :phone_number_2, :string
add_column :facilitators, :phone_number_3, :string
add_column :facilitators, :best_time_to_call, :string

add_column :facilitators, :notes, :text

add_column :facilitators, :date_of_birth, :date
end
end
Loading