diff --git a/app/controllers/admin/analytics_controller.rb b/app/controllers/admin/analytics_controller.rb index 4ab57c745..22f8e549e 100644 --- a/app/controllers/admin/analytics_controller.rb +++ b/app/controllers/admin/analytics_controller.rb @@ -16,7 +16,7 @@ def index @most_viewed_tutorials = decorate_with_counts(most_viewed_for_model(Tutorial, time_scope), :view_count) @most_viewed_projects = decorate_with_counts(most_viewed_for_model(Project, time_scope), :view_count) @most_viewed_events = decorate_with_counts(most_viewed_for_model(Event, time_scope), :view_count) - @most_viewed_facilitators = decorate_with_counts(most_viewed_for_model(Facilitator, time_scope), :view_count) + @most_viewed_people = decorate_with_counts(most_viewed_for_model(Person, time_scope), :view_count) @most_printed_workshops = decorate_with_counts(most_printed_for_model(Workshop, time_scope), :print_count) @most_printed_resources = decorate_with_counts(most_printed_for_model(Resource, time_scope), :print_count) @@ -71,8 +71,8 @@ def index views: view_count_for_model(Project, time_scope), prints: print_count_for_model(Project, time_scope) }, - facilitators: { - views: view_count_for_model(Facilitator, time_scope) + people: { + views: view_count_for_model(Person, time_scope) } } end diff --git a/app/controllers/community_news_controller.rb b/app/controllers/community_news_controller.rb index 759b53138..e951a366c 100644 --- a/app/controllers/community_news_controller.rb +++ b/app/controllers/community_news_controller.rb @@ -7,7 +7,7 @@ def index per_page = params[:number_of_items_per_page].presence || 12 unfiltered = current_user.super_user? ? CommunityNews.all : CommunityNews.published filtered = unfiltered.search_by_params(params) - @community_news = filtered&.includes([ :bookmarks, :primary_asset, :author, :project, author: :facilitator ]) + @community_news = filtered&.includes([ :bookmarks, :primary_asset, :author, :project, author: :person ]) &.paginate(page: params[:page], per_page: per_page)&.decorate @count_display = if filtered.count == unfiltered.count diff --git a/app/controllers/facilitators_controller.rb b/app/controllers/people_controller.rb similarity index 69% rename from app/controllers/facilitators_controller.rb rename to app/controllers/people_controller.rb index 55024e94f..4fcc78ccc 100644 --- a/app/controllers/facilitators_controller.rb +++ b/app/controllers/people_controller.rb @@ -1,26 +1,26 @@ -class FacilitatorsController < ApplicationController +class PeopleController < ApplicationController include AhoyTracking - before_action :set_facilitator, only: %i[ show edit update destroy ] + before_action :set_person, only: %i[ show edit update destroy ] def index per_page = params[:number_of_items_per_page].presence || 25 - facilitators = Facilitator + people = Person .searchable .search_by_params(params.to_unsafe_h) .includes(:user, :avatar_attachment, :sectorable_items, user: [ :avatar_attachment, :projects ]).references(:user) .order(:first_name, :last_name) - @count_display = facilitators.size - @facilitators = facilitators.paginate(page: params[:page], per_page: per_page) + @count_display = people.size + @people = people.paginate(page: params[:page], per_page: per_page) end def show - @facilitator = Facilitator.find(params[:id]).decorate - track_view(@facilitator) + @person = Person.find(params[:id]).decorate + track_view(@person) end def new set_user - @facilitator = @user ? FacilitatorFromUserService.new(user: @user).call : Facilitator.new + @person = @user ? PersonFromUserService.new(user: @user).call : Person.new set_form_variables end @@ -29,12 +29,12 @@ def edit end def create - @facilitator = Facilitator.new(facilitator_params.except(:user_attributes)) - @facilitator.user ||= (User.find(params[:facilitator][:user_attributes][:id]) if params[:facilitator][:user_attributes]) + @person = Person.new(person_params.except(:user_attributes)) + @person.user ||= (User.find(params[:person][:user_attributes][:id]) if params[:person][:user_attributes]) respond_to do |format| - if @facilitator.save - format.html { redirect_to @facilitator, notice: "Facilitator was successfully created." } + if @person.save + format.html { redirect_to @person, notice: "Person was successfully created." } else set_form_variables format.html { render :new, status: :unprocessable_content } @@ -44,8 +44,8 @@ def create def update respond_to do |format| - if @facilitator.update(facilitator_params) - format.html { redirect_to @facilitator, notice: "Facilitator was successfully updated." } + if @person.update(person_params) + format.html { redirect_to @person, notice: "Person was successfully updated." } else set_form_variables format.html { render :edit, status: :unprocessable_content } @@ -54,35 +54,35 @@ def update end def destroy - @facilitator.destroy + @person.destroy respond_to do |format| - format.html { redirect_to facilitators_path, status: :see_other, notice: "Facilitator was successfully destroyed." } + format.html { redirect_to people_path, status: :see_other, notice: "Person was successfully destroyed." } end end private # Use callbacks to share common setup or constraints between actions. - def set_facilitator - @facilitator = Facilitator.find(params[:id]) + def set_person + @person = Person.find(params[:id]) end def set_user if params[:user_id].present? @user ||= User.find_by(id: params[:user_id]) if @user - @facilitator&.user ||= @user - @user.facilitator ||= @facilitator + @person&.user ||= @user + @user.person ||= @person end end end def set_form_variables set_user - # @facilitator.build_user if @facilitator.user.blank? # Build a fresh one if missing + # @person.build_user if @person.user.blank? # Build a fresh one if missing - if @facilitator.user - @facilitator.user.project_users.first || @facilitator.user.project_users.build + if @person.user + @person.user.project_users.first || @person.user.project_users.build end projects = if current_user.super_user? Project.active @@ -94,8 +94,8 @@ def set_form_variables # Only allow a list of trusted parameters through. - def facilitator_params - params.require(:facilitator).permit( + def person_params + params.require(:person).permit( :avatar, :first_name, :last_name, :email, :email_type, @@ -157,7 +157,7 @@ def facilitator_params :_destroy ], user_attributes: [ - :id, :facilitator_id, + :id, :person_id, :first_name, :last_name, :email, diff --git a/app/controllers/project_users_controller.rb b/app/controllers/project_users_controller.rb index e0e7d535a..a45fbe4f4 100644 --- a/app/controllers/project_users_controller.rb +++ b/app/controllers/project_users_controller.rb @@ -8,6 +8,6 @@ def destroy else flash[:alert] = "Unable to delete project user. Please contact AWBW." end - redirect_to generate_facilitator_user_path(user) + redirect_to generate_person_user_path(user) end end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 7138afcf1..a398ea310 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -35,7 +35,7 @@ def show .references(:windows_type) .order("workshops.title ASC, windows_types.name ASC") - @facilitators = User.active + @people = User.active .or(User.where(id: user_ids)) .distinct .order(:last_name, :first_name) @@ -78,13 +78,13 @@ def destroy # Optional hooks for setting variables for forms or index def set_form_variables @project_statuses = ProjectStatus.all - @facilitators_array = Facilitator.includes(:user) + @people_array = Person.includes(:user) .joins(:user) .order(:first_name, :last_name) .map { |f| [ f.name, f.user.id ] } @project.project_users = @project.project_users .includes(:project) - .sort_by { |pu| pu.user.facilitator&.name.to_s.downcase } + .sort_by { |pu| pu.user.person&.name.to_s.downcase } end def set_index_variables diff --git a/app/controllers/resources_controller.rb b/app/controllers/resources_controller.rb index 648cc378d..dcf47957f 100644 --- a/app/controllers/resources_controller.rb +++ b/app/controllers/resources_controller.rb @@ -37,7 +37,7 @@ def new end def edit - @resource = Resource.includes(user: :facilitator).find(resource_id_param).decorate + @resource = Resource.includes(user: :person).find(resource_id_param).decorate set_form_variables if turbo_frame_request? diff --git a/app/controllers/stories_controller.rb b/app/controllers/stories_controller.rb index 63ca6e7ca..364e4a563 100644 --- a/app/controllers/stories_controller.rb +++ b/app/controllers/stories_controller.rb @@ -112,7 +112,7 @@ def story_params params.require(:story).permit( :title, :rhino_body, :featured, :published, :public, :public_featued, :youtube_url, :website_url, :windows_type_id, :project_id, :workshop_id, :external_workshop_title, - :created_by_id, :updated_by_id, :story_idea_id, :spotlighted_facilitator_id + :created_by_id, :updated_by_id, :story_idea_id, :spotlighted_person_id ) end diff --git a/app/controllers/taggings_controller.rb b/app/controllers/taggings_controller.rb index c5c192d79..694de001d 100644 --- a/app/controllers/taggings_controller.rb +++ b/app/controllers/taggings_controller.rb @@ -12,7 +12,7 @@ def index stories: params[:stories_page], community_news: params[:community_news_page], events: params[:events_page], - facilitators: params[:facilitators_page], + people: params[:people_page], projects: params[:projects_page], quotes: params[:quotes_page] } diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 0419fbbac..20b74b90e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,5 +1,5 @@ class UsersController < ApplicationController - before_action :set_user, only: [ :show, :edit, :update, :destroy, :generate_facilitator, :toggle_lock_status, :confirm_email, :send_reset_password_instructions ] + before_action :set_user, only: [ :show, :edit, :update, :destroy, :generate_person, :toggle_lock_status, :confirm_email, :send_reset_password_instructions ] def index return redirect_to root_path unless current_user.super_user? @@ -30,9 +30,9 @@ def create @user.password ||= SecureRandom.hex(8) @user.password_confirmation ||= @user.password - # assign facilitator - facilitator_id = params[:facilitator_id].presence || params.dig(:user, :facilitator_id).presence - @user.facilitator = Facilitator.find(facilitator_id) if facilitator_id + # assign person + person_id = params[:person_id].presence || params.dig(:user, :person_id).presence + @user.person = Person.find(person_id) if person_id if @user.save # @user.notifications.create(notification_type: 0) @@ -87,15 +87,15 @@ def update_password end end - def generate_facilitator - if @user.facilitator.present? - redirect_to @user.facilitator and return + def generate_person + if @user.person.present? + redirect_to @user.person and return else - @facilitator = FacilitatorFromUserService.new(user: @user).call - if @facilitator.save - redirect_to @facilitator, notice: "Facilitator was successfully created for this user." and return + @person = PersonFromUserService.new(user: @user).call + if @person.save + redirect_to @person, notice: "Person was successfully created for this user." and return else - redirect_to @user, alert: "Unable to create facilitator: #{@facilitator.errors.full_messages.join(", ")}" and return + redirect_to @user, alert: "Unable to create person: #{@person.errors.full_messages.join(", ")}" and return end end end @@ -146,13 +146,13 @@ def set_user @user = User.find(params[:id]) end - def set_facilitator - @facilitator = @user.facilitator || - (Facilitator.where(id: params[:facilitator_id]).first if params[:facilitator_id].present?) + def set_person + @person = @user.person || + (Person.where(id: params[:person_id]).first if params[:person_id].present?) end def set_form_variables - set_facilitator + set_person @user.project_users.first || @user.project_users.build projects = if current_user.super_user? Project.active @@ -176,7 +176,7 @@ def user_params :address, :address2, :city, :city2, :state, :state2, :zip, :zip2, :phone, :phone2, :phone3, :birthday, :best_time_to_call, :comment, :notes, :primary_address, :avatar, :subscribecode, - :agency_id, :facilitator_id, :created_by_id, :updated_by_id, + :agency_id, :person_id, :created_by_id, :updated_by_id, :confirmed, :inactive, :super_user, :legacy, :legacy_id, project_users_attributes: [ :id, :project_id, :position, :title, :inactive, :_destroy ] ) diff --git a/app/controllers/workshop_logs_controller.rb b/app/controllers/workshop_logs_controller.rb index 888ac75d2..dcfb6de78 100644 --- a/app/controllers/workshop_logs_controller.rb +++ b/app/controllers/workshop_logs_controller.rb @@ -119,7 +119,7 @@ def set_index_variables # needs to not be private @year_options = WorkshopLog.pluck( Arel.sql("DISTINCT EXTRACT(YEAR FROM COALESCE(date, created_at, NOW()))") ).sort.reverse - @facilitators = User.active.or(User.where(id: @workshop_logs_unpaginated.pluck(:user_id))) + @people = User.active.or(User.where(id: @workshop_logs_unpaginated.pluck(:user_id))) .includes(:workshop_logs) .joins(:workshop_logs) .distinct diff --git a/app/controllers/workshops_controller.rb b/app/controllers/workshops_controller.rb index 6b4bd05c9..654f4a8df 100644 --- a/app/controllers/workshops_controller.rb +++ b/app/controllers/workshops_controller.rb @@ -13,7 +13,7 @@ def index @workshops = search_service.workshops .includes(:categories, :windows_type, :user, :images, :bookmarks, :age_ranges, - user: [ :facilitator ], primary_asset: [ :file_attachment ]) + user: [ :person ], primary_asset: [ :file_attachment ]) .paginate(page: params[:page], per_page: params[:per_page] || 12) @workshops_count = search_service.workshops.size diff --git a/app/decorators/facilitator_decorator.rb b/app/decorators/person_decorator.rb similarity index 88% rename from app/decorators/facilitator_decorator.rb rename to app/decorators/person_decorator.rb index c0fb138b6..3ee14caed 100644 --- a/app/decorators/facilitator_decorator.rb +++ b/app/decorators/person_decorator.rb @@ -1,4 +1,4 @@ -class FacilitatorDecorator < ApplicationDecorator +class PersonDecorator < ApplicationDecorator def title "#{first_name} #{last_name}" end @@ -37,9 +37,9 @@ def badges years = member_since ? (Time.zone.now.year - member_since.year) : 0 badges = [] badges << [ "Legacy Facilitator (10+ years)", "yellow" ] if years >= 10 - badges << [ "Seasoned Facilitator (3-10 years)", DomainTheme.bg_class_for(:facilitators) ] if member_since.present? && years >= 3 + badges << [ "Seasoned Facilitator (3-10 years)", DomainTheme.bg_class_for(:people) ] if member_since.present? && years >= 3 badges << [ "New Facilitator (<3 years)", "green" ] if member_since.present? && years < 3 - badges << [ "Spotlighted Facilitator", "gray" ] if stories_as_spotlighted_facilitator + badges << [ "Featured in Stories", "gray" ] if stories_as_spotlighted_person badges << [ "Events Attended", DomainTheme.bg_class_for(:events) ] if user && user.events.any? badges << [ "Workshop Author", DomainTheme.bg_class_for(:workshops) ] if user && user.workshops.any? # indigo badges << [ "Story Author", DomainTheme.bg_class_for(:stories) ] if user && user.stories_as_creator.any? # pink diff --git a/app/helpers/admin_cards_helper.rb b/app/helpers/admin_cards_helper.rb index aa91949e0..595703b6e 100644 --- a/app/helpers/admin_cards_helper.rb +++ b/app/helpers/admin_cards_helper.rb @@ -5,7 +5,7 @@ module AdminCardsHelper def system_cards [ model_card(:banners, icon: "📣"), - model_card(:facilitators, icon: "🧑‍🎨"), + model_card(:people, icon: "🧑‍🎨"), model_card(:faqs, icon: "❔", title: "FAQs"), model_card(:community_news, icon: "📰"), model_card(:events, icon: "📆"), diff --git a/app/helpers/facilitator_helper.rb b/app/helpers/person_helper.rb similarity index 69% rename from app/helpers/facilitator_helper.rb rename to app/helpers/person_helper.rb index ff2673542..67c9cf054 100644 --- a/app/helpers/facilitator_helper.rb +++ b/app/helpers/person_helper.rb @@ -1,18 +1,18 @@ -module FacilitatorHelper - def facilitator_profile_button(facilitator, size: 10) - link_to facilitator_path(facilitator), +module PersonHelper + def person_profile_button(person, size: 10) + link_to person_path(person), 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" do - facilitator = facilitator.decorate + person = person.decorate # --- Avatar --- - avatar = if facilitator.avatar.present? - image_tag url_for(facilitator.avatar), + avatar = if person.avatar.present? + image_tag url_for(person.avatar), class: "w-10 h-10 rounded-full object-cover border border-gray-300 shadow-sm flex-shrink-0" - elsif facilitator.user&.avatar.present? - image_tag url_for(facilitator.user.avatar), + elsif person.user&.avatar.present? + image_tag url_for(person.user.avatar), class: "w-10 h-10 rounded-full object-cover border border-gray-300 shadow-sm flex-shrink-0" else image_tag "missing.png", @@ -22,16 +22,16 @@ def facilitator_profile_button(facilitator, size: 10) # --- Name: stays one line & turns white on hover --- name = content_tag( :span, - facilitator.name.to_s.truncate(21), - title: facilitator.name.to_s, + person.name.to_s.truncate(21), + title: person.name.to_s, class: "font-semibold text-gray-900 group-hover:text-white" ) # --- Pronouns --- - pronouns = if facilitator.pronouns_display.present? + pronouns = if person.pronouns_display.present? content_tag( :span, - facilitator.pronouns_display, + person.pronouns_display, class: "text-xs text-gray-500 italic group-hover:text-white" ) end diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb index 4c7f9e210..196e4c08d 100644 --- a/app/mailers/notification_mailer.rb +++ b/app/mailers/notification_mailer.rb @@ -5,7 +5,7 @@ def event_registration_confirmation_fyi(notification) @event_registration = notification.noticeable @event = @event_registration.event.decorate @user = @event_registration.registrant - @facilitator = @user.facilitator + @person = @user.person @notification_type = "Event registration" # Send email to the admin @@ -58,7 +58,7 @@ def report_submitted_fyi(notification) def reset_password_fyi(notification) @user = notification.noticeable - @facilitator = @user.facilitator + @person = @user.person @notification_type = "Password reset" # Send email to the admin diff --git a/app/models/bookmark.rb b/app/models/bookmark.rb index 80e6ee0bf..227d7d4f4 100644 --- a/app/models/bookmark.rb +++ b/app/models/bookmark.rb @@ -2,7 +2,7 @@ class Bookmark < ApplicationRecord belongs_to :user belongs_to :bookmarkable, polymorphic: true - BOOKMARKABLE_MODELS = [ "CommunityNews", "Event", "Facilitator", "Project", "Resource", "Story", "StoryIdea", + BOOKMARKABLE_MODELS = [ "CommunityNews", "Event", "Person", "Project", "Resource", "Story", "StoryIdea", "Workshop", "WorkshopIdea", "WorkshopLog", "WorkshopVariation" ] scope :for_workshops, -> { where(bookmarkable_type: "Workshop") } @@ -54,7 +54,7 @@ def self.sort_by_title bookmarks = self.joins(<<~SQL) LEFT JOIN community_news ON community_news.id = bookmarks.bookmarkable_id AND bookmarks.bookmarkable_type = 'CommunityNews' LEFT JOIN events ON events.id = bookmarks.bookmarkable_id AND bookmarks.bookmarkable_type = 'Event' - LEFT JOIN facilitators ON facilitators.id = bookmarks.bookmarkable_id AND bookmarks.bookmarkable_type = 'Facilitator' + LEFT JOIN people ON people.id = bookmarks.bookmarkable_id AND bookmarks.bookmarkable_type = 'Person' LEFT JOIN projects ON projects.id = bookmarks.bookmarkable_id AND bookmarks.bookmarkable_type = 'Project' LEFT JOIN resources ON resources.id = bookmarks.bookmarkable_id AND bookmarks.bookmarkable_type = 'Resource' LEFT JOIN stories ON stories.id = bookmarks.bookmarkable_id AND bookmarks.bookmarkable_type = 'Story' @@ -69,7 +69,7 @@ def self.sort_by_title COALESCE( community_news.title, events.title, - CONCAT(facilitators.first_name, ' ', facilitators.last_name), + CONCAT(people.first_name, ' ', people.last_name), projects.name, resources.title, stories.title, @@ -92,7 +92,7 @@ def self.title(title) bookmarks = bookmarks.joins(<<~SQL) LEFT JOIN community_news ON community_news.id = bookmarks.bookmarkable_id AND bookmarks.bookmarkable_type = 'CommunityNews' LEFT JOIN events ON events.id = bookmarks.bookmarkable_id AND bookmarks.bookmarkable_type = 'Event' - LEFT JOIN facilitators ON facilitators.id = bookmarks.bookmarkable_id AND bookmarks.bookmarkable_type = 'Facilitator' + LEFT JOIN people ON people.id = bookmarks.bookmarkable_id AND bookmarks.bookmarkable_type = 'Person' LEFT JOIN projects ON projects.id = bookmarks.bookmarkable_id AND bookmarks.bookmarkable_type = 'Project' LEFT JOIN resources ON resources.id = bookmarks.bookmarkable_id AND bookmarks.bookmarkable_type = 'Resource' LEFT JOIN stories ON stories.id = bookmarks.bookmarkable_id AND bookmarks.bookmarkable_type = 'Story' @@ -104,8 +104,8 @@ def self.title(title) SQL bookmarks.where( - "community_news.title LIKE :title OR events.title LIKE :title OR facilitators.first_name LIKE :title OR - facilitators.last_name LIKE :title OR projects.name LIKE :title OR resources.title LIKE :title OR + "community_news.title LIKE :title OR events.title LIKE :title OR people.first_name LIKE :title OR + people.last_name LIKE :title OR projects.name LIKE :title OR resources.title LIKE :title OR stories.title LIKE :title OR workshops.title LIKE :title OR workshop_ideas.title LIKE :title OR story_ideas.body LIKE :title OR -- searching body for story ideas (title exists but isn't used in UI) DATE_FORMAT(workshop_logs.date, '%Y-%m-%d') LIKE :title OR -- no title on workshop_logs diff --git a/app/models/community_news.rb b/app/models/community_news.rb index a9772e8a4..408cc1620 100644 --- a/app/models/community_news.rb +++ b/app/models/community_news.rb @@ -36,9 +36,9 @@ class CommunityNews < ApplicationRecord # SearchCop include SearchCop search_scope :search do - attributes :title, :published, facilitator_first: "facilitators.first_name", facilitator_last: "facilitators.last_name" + attributes :title, :published, person_first: "people.first_name", person_last: "people.last_name" - scope { join_rich_texts.left_joins(author: :facilitator) } + scope { join_rich_texts.left_joins(author: :person) } attributes action_text_body: "action_text_rich_texts.plain_text_body" end diff --git a/app/models/facilitator.rb b/app/models/person.rb similarity index 95% rename from app/models/facilitator.rb rename to app/models/person.rb index 51e4834ea..37f815b33 100644 --- a/app/models/facilitator.rb +++ b/app/models/person.rb @@ -1,17 +1,17 @@ -class Facilitator < ApplicationRecord +class Person < ApplicationRecord include TagFilterable, Trendable, WindowsTypeFilterable belongs_to :created_by, class_name: "User" belongs_to :updated_by, class_name: "User" - has_one :user, inverse_of: :facilitator, dependent: :nullify + has_one :user, inverse_of: :person, dependent: :nullify has_many :addresses, as: :addressable, dependent: :destroy has_many :bookmarks, as: :bookmarkable, dependent: :destroy has_many :contact_methods, as: :contactable, dependent: :destroy has_many :categorizable_items, inverse_of: :categorizable, as: :categorizable, dependent: :destroy has_many :sectorable_items, as: :sectorable, dependent: :destroy - has_many :stories_as_spotlighted_facilitator, inverse_of: :spotlighted_facilitator, class_name: "Story", + has_many :stories_as_spotlighted_person, inverse_of: :spotlighted_person, class_name: "Story", dependent: :restrict_with_error # has_many through has_many :event_registrations, through: :user diff --git a/app/models/sectorable_item.rb b/app/models/sectorable_item.rb index 5953c49e4..9477c1ea8 100644 --- a/app/models/sectorable_item.rb +++ b/app/models/sectorable_item.rb @@ -1,7 +1,7 @@ class SectorableItem < ApplicationRecord belongs_to :sector belongs_to :sectorable, polymorphic: true - has_many :facilitators, through: :sectorable_items, source: :sectorable, source_type: "Facilitator" + has_many :people, through: :sectorable_items, source: :sectorable, source_type: "Person" # Validations validates_presence_of :sectorable_type, :sectorable_id, :sector_id diff --git a/app/models/story.rb b/app/models/story.rb index 6320c1a9b..a7e69d419 100644 --- a/app/models/story.rb +++ b/app/models/story.rb @@ -5,8 +5,8 @@ class Story < ApplicationRecord belongs_to :updated_by, class_name: "User" belongs_to :windows_type belongs_to :project, optional: true - belongs_to :spotlighted_facilitator, class_name: "Facilitator", - foreign_key: "spotlighted_facilitator_id", optional: true + belongs_to :spotlighted_person, class_name: "Person", + foreign_key: "spotlighted_person_id", optional: true belongs_to :story_idea, optional: true belongs_to :workshop, optional: true has_many :bookmarks, as: :bookmarkable, dependent: :destroy @@ -41,9 +41,9 @@ class Story < ApplicationRecord # SearchCop include SearchCop search_scope :search do - attributes :title, :published, facilitator_first: "facilitators.first_name", facilitator_last: "facilitators.last_name" + attributes :title, :published, person_first: "people.first_name", person_last: "people.last_name" - scope { join_rich_texts.left_joins(created_by: :facilitator) } + scope { join_rich_texts.left_joins(created_by: :person) } attributes action_text_body: "action_text_rich_texts.plain_text_body" options :action_text_body, type: :text, default: true, default_operator: :or end diff --git a/app/models/tag.rb b/app/models/tag.rb index e2d60052e..f4a8eac64 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -25,10 +25,10 @@ class Tag path: -> { Rails.application.routes.url_helpers.events_path }, klass: Event }, - facilitators: { + people: { icon: "🧑‍🎨", - path: -> { Rails.application.routes.url_helpers.facilitators_path }, - klass: Facilitator + path: -> { Rails.application.routes.url_helpers.people_path }, + klass: Person }, projects: { icon: "🏫", diff --git a/app/models/user.rb b/app/models/user.rb index 4c9fa87d9..8b6c75745 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -10,7 +10,7 @@ class User < ApplicationRecord before_destroy :reassign_reports_and_logs_to_orphaned_user # Associations - belongs_to :facilitator, optional: true + belongs_to :person, optional: true has_many :bookmarks, dependent: :destroy has_many :event_registrations, foreign_key: :registrant_id, dependent: :destroy has_many :notifications, as: :noticeable @@ -85,8 +85,8 @@ def bookmark_for(record) end def full_name - if facilitator - facilitator.full_name + if person + person.full_name else if !first_name || first_name.empty? email @@ -97,7 +97,7 @@ def full_name end def devise_email_name - facilitator&.first_name.presence || first_name.presence || email + person&.first_name.presence || first_name.presence || email end def submitted_monthly_report(submitted_date = Date.today, windows_type, project_id) diff --git a/app/services/facilitator_from_user_service.rb b/app/services/person_from_user_service.rb similarity index 74% rename from app/services/facilitator_from_user_service.rb rename to app/services/person_from_user_service.rb index 1e6976817..e2081d090 100644 --- a/app/services/facilitator_from_user_service.rb +++ b/app/services/person_from_user_service.rb @@ -1,25 +1,25 @@ # frozen_string_literal: true -class FacilitatorFromUserService - attr_reader :user, :facilitator +class PersonFromUserService + attr_reader :user, :person def initialize(user:) @user = user - @facilitator = Facilitator.new + @person = Person.new end def call - hydrate_facilitator + hydrate_person hydrate_addresses hydrate_contact_methods hydrate_projects - facilitator + person end private - def hydrate_facilitator - facilitator.assign_attributes( + def hydrate_person + person.assign_attributes( first_name: user.first_name, last_name: user.last_name, email: user.email, @@ -35,16 +35,16 @@ def hydrate_projects end def hydrate_contact_methods - facilitator.contact_methods.build( + person.contact_methods.build( kind: :phone, value: user.phone, is_primary: true ) if user.phone.present? - facilitator.contact_methods.build( + person.contact_methods.build( kind: :phone, value: user.phone2, ) if user.phone2.present? - facilitator.contact_methods.build( + person.contact_methods.build( kind: :phone, value: user.phone3, ) if user.phone3.present? @@ -53,14 +53,14 @@ def hydrate_contact_methods def hydrate_addresses # t.integer "primary_address" - facilitator.addresses.build( + person.addresses.build( address_type: nil, street_address: user.address, city: user.city, state: user.state, zip_code: user.zip, ) - facilitator.addresses.build( + person.addresses.build( address_type: nil, street_address: user.address2, city: user.city2, diff --git a/app/services/tagging_search_service.rb b/app/services/tagging_search_service.rb index 0c3eabfe7..23dc75829 100644 --- a/app/services/tagging_search_service.rb +++ b/app/services/tagging_search_service.rb @@ -51,14 +51,14 @@ def self.call(sector_names:, category_names: nil, .paginate(page: pages[:stories] || 1, per_page: number_of_items_per_page) .decorate, - facilitators: Facilitator + people: Person .includes(:sectors) .published .searchable .sector_names(sector_names) .category_names(category_names) .order(:first_name, :last_name) - .paginate(page: pages[:facilitators] || 1, per_page: number_of_items_per_page) + .paginate(page: pages[:people] || 1, per_page: number_of_items_per_page) .decorate, projects: Project diff --git a/app/views/admin/analytics/index.html.erb b/app/views/admin/analytics/index.html.erb index 67a2638a1..ee0bada80 100644 --- a/app/views/admin/analytics/index.html.erb +++ b/app/views/admin/analytics/index.html.erb @@ -153,11 +153,11 @@ %> <%= render "admin/analytics/popular_list", - title: "Facilitators", - records: @most_viewed_facilitators, - path_method: :facilitator_path, + title: "People", + records: @most_viewed_people, + path_method: :person_path, metric: :view_count, - color: :facilitators + color: :people %> diff --git a/app/views/bookmarks/_personal_row.html.erb b/app/views/bookmarks/_personal_row.html.erb index e70e08220..b9ee8f031 100644 --- a/app/views/bookmarks/_personal_row.html.erb +++ b/app/views/bookmarks/_personal_row.html.erb @@ -59,14 +59,14 @@ Created by: <% if bookmarkable.respond_to?(:user) && bookmarkable.user %> <%= link_to bookmarkable.user.full_name, - generate_facilitator_user_path(bookmarkable.user), + generate_person_user_path(bookmarkable.user), class: "hover:underline", data: { turbo: false, } %> <% elsif bookmark.bookmarkable_type == "Workshop" %> <%= bookmarkable.full_name.present? ? bookmarkable.full_name : "Facilitator" %> <% elsif bookmarkable.respond_to?(:created_by) && bookmarkable.created_by %> <%= link_to bookmarkable.object.created_by.full_name, - generate_facilitator_user_path(bookmarkable.created_by), + generate_person_user_path(bookmarkable.created_by), class: "hover:underline", data: { turbo: false, } %> <% else %> diff --git a/app/views/bookmarks/update.turbo_stream.erb b/app/views/bookmarks/update.turbo_stream.erb index 74565af1b..81e656b8f 100644 --- a/app/views/bookmarks/update.turbo_stream.erb +++ b/app/views/bookmarks/update.turbo_stream.erb @@ -7,9 +7,9 @@ <%= "time".pluralize(@bookmarkable.bookmarks_count) %> <% end %> -<%= turbo_stream.update dom_id(@bookmarkable, :bookmark_count_facilitator) do %> +<%= turbo_stream.update dom_id(@bookmarkable, :bookmark_count_person) do %> (Bookmarked by - <%= pluralize(@bookmarkable.bookmarks_count, "facilitator") %>, + <%= pluralize(@bookmarkable.bookmarks_count, "user") %>, <% end %> <%= turbo_stream.replace "flash_now", partial: "shared/flash_messages" %> diff --git a/app/views/event_registrations/index.html.erb b/app/views/event_registrations/index.html.erb index e2b1f4124..7f0975084 100644 --- a/app/views/event_registrations/index.html.erb +++ b/app/views/event_registrations/index.html.erb @@ -49,10 +49,10 @@ <%= event_registration.event.decorate.times(display_day: true, display_date: true).html_safe %> - <%# FIXME not all users have facilitators %> - <% if event_registration.registrant.facilitator %> + <%# FIXME not all users have people %> + <% if event_registration.registrant.person %> <%= link_to event_registration.registrant.full_name, - facilitator_path(event_registration.registrant.facilitator), + person_path(event_registration.registrant.person), class: "btn btn-secondary-outline" %> <% else %> <%= event_registration.registrant.full_name %> diff --git a/app/views/notification_mailer/event_registration_confirmation_fyi.html.erb b/app/views/notification_mailer/event_registration_confirmation_fyi.html.erb index ee61d8183..9390f5f58 100644 --- a/app/views/notification_mailer/event_registration_confirmation_fyi.html.erb +++ b/app/views/notification_mailer/event_registration_confirmation_fyi.html.erb @@ -1,4 +1,4 @@ -<% profile_url = @facilitator ? facilitator_url(@facilitator) : user_url(@user) %> +<% profile_url = @person ? person_url(@person) : user_url(@user) %>

New Event Registration diff --git a/app/views/notification_mailer/event_registration_confirmation_fyi.text.erb b/app/views/notification_mailer/event_registration_confirmation_fyi.text.erb index 7a6e25828..c8a5dd233 100644 --- a/app/views/notification_mailer/event_registration_confirmation_fyi.text.erb +++ b/app/views/notification_mailer/event_registration_confirmation_fyi.text.erb @@ -1,4 +1,4 @@ -<% profile_url = @facilitator ? facilitator_url(@facilitator) : user_url(@user) %> +<% profile_url = @person ? person_url(@person) : user_url(@user) %> New Event Registration ========================== diff --git a/app/views/notification_mailer/idea_submitted_fyi.html.erb b/app/views/notification_mailer/idea_submitted_fyi.html.erb index 8007e931b..f4d8529e1 100644 --- a/app/views/notification_mailer/idea_submitted_fyi.html.erb +++ b/app/views/notification_mailer/idea_submitted_fyi.html.erb @@ -1,4 +1,4 @@ -<% profile_url = @facilitator ? facilitator_url(@facilitator) : user_url(@user) %> +<% profile_url = @person ? person_url(@person) : user_url(@user) %>

New <%= @noticeable_klass %> diff --git a/app/views/notification_mailer/idea_submitted_fyi.text.erb b/app/views/notification_mailer/idea_submitted_fyi.text.erb index a5a249454..10cb06e50 100644 --- a/app/views/notification_mailer/idea_submitted_fyi.text.erb +++ b/app/views/notification_mailer/idea_submitted_fyi.text.erb @@ -1,4 +1,4 @@ -<% profile_url = @facilitator ? facilitator_url(@facilitator) : user_url(@user) %> +<% profile_url = @person ? person_url(@person) : user_url(@user) %> New <%= @noticeable_klass %> ========================== diff --git a/app/views/notification_mailer/report_submitted_fyi.html.erb b/app/views/notification_mailer/report_submitted_fyi.html.erb index 712d5953a..10bb3f2bd 100644 --- a/app/views/notification_mailer/report_submitted_fyi.html.erb +++ b/app/views/notification_mailer/report_submitted_fyi.html.erb @@ -1,4 +1,4 @@ -<% profile_url = @facilitator ? facilitator_url(@facilitator) : user_url(@user) %> +<% profile_url = @person ? person_url(@person) : user_url(@user) %>

New <%= @noticeable.class.model_name.human.titleize %> <%= @type %> diff --git a/app/views/notification_mailer/report_submitted_fyi.text.erb b/app/views/notification_mailer/report_submitted_fyi.text.erb index b05c3804c..89ed3efc2 100644 --- a/app/views/notification_mailer/report_submitted_fyi.text.erb +++ b/app/views/notification_mailer/report_submitted_fyi.text.erb @@ -1,4 +1,4 @@ -<% profile_url = @facilitator ? facilitator_url(@facilitator) : user_url(@user) %> +<% profile_url = @person ? person_url(@person) : user_url(@user) %> New <%= @noticeable.class.model_name.human.titleize %> <%= @type %> ========================== diff --git a/app/views/notification_mailer/reset_password_fyi.html.erb b/app/views/notification_mailer/reset_password_fyi.html.erb index 58b811f23..7a9928e98 100644 --- a/app/views/notification_mailer/reset_password_fyi.html.erb +++ b/app/views/notification_mailer/reset_password_fyi.html.erb @@ -1,4 +1,4 @@ -<% profile_url = @facilitator ? facilitator_url(@facilitator) : user_url(@user) %> +<% profile_url = @person ? person_url(@person) : user_url(@user) %>

<%= @notification_type %> @@ -25,13 +25,13 @@ requested a password reset.

- <% if @facilitator&.avatar&.file&.attached? %> + <% if @person&.avatar&.file&.attached? %>

Avatar

- <%= image_tag url_for(@facilitator.avatar.file), + <%= image_tag url_for(@person.avatar.file), width: 96, height: 96, style: "border-radius: 50%; display: block;" %> diff --git a/app/views/notification_mailer/reset_password_fyi.text.erb b/app/views/notification_mailer/reset_password_fyi.text.erb index e4c85b418..3fa50ef34 100644 --- a/app/views/notification_mailer/reset_password_fyi.text.erb +++ b/app/views/notification_mailer/reset_password_fyi.text.erb @@ -1,4 +1,4 @@ -<% profile_url = @facilitator ? facilitator_url(@facilitator) : user_url(@user) %> +<% profile_url = @person ? person_url(@person) : user_url(@user) %> <%= @notification_type %> ========================== @@ -19,10 +19,10 @@ requested a password reset. Profile: <%= profile_url %> -<% if @facilitator&.avatar&.file&.attached? %> +<% if @person&.avatar&.file&.attached? %> Avatar available: - <%= url_for(@facilitator.avatar.file) %> + <%= url_for(@person.avatar.file) %> <% end %> diff --git a/app/views/notification_mailer/workshop_log_submitted_fyi.html.erb b/app/views/notification_mailer/workshop_log_submitted_fyi.html.erb index 3feac7d25..ad3383e64 100644 --- a/app/views/notification_mailer/workshop_log_submitted_fyi.html.erb +++ b/app/views/notification_mailer/workshop_log_submitted_fyi.html.erb @@ -1,4 +1,4 @@ -<% profile_url = @facilitator ? facilitator_url(@facilitator) : user_url(@user) %> +<% profile_url = @person ? person_url(@person) : user_url(@user) %> <% breakdown = @noticeable.attendance_breakdown %> <% totals = @noticeable.totals %> diff --git a/app/views/notification_mailer/workshop_log_submitted_fyi.text.erb b/app/views/notification_mailer/workshop_log_submitted_fyi.text.erb index 32ef4bb96..def60615c 100644 --- a/app/views/notification_mailer/workshop_log_submitted_fyi.text.erb +++ b/app/views/notification_mailer/workshop_log_submitted_fyi.text.erb @@ -1,4 +1,4 @@ -<% profile_url = @facilitator ? facilitator_url(@facilitator) : user_url(@user) %> +<% profile_url = @person ? person_url(@person) : user_url(@user) %> <% breakdown = @noticeable.attendance_breakdown %> <% totals = @noticeable.totals %> diff --git a/app/views/facilitators/_address_fields.html.erb b/app/views/people/_address_fields.html.erb similarity index 100% rename from app/views/facilitators/_address_fields.html.erb rename to app/views/people/_address_fields.html.erb diff --git a/app/views/facilitators/_contact_method_fields.html.erb b/app/views/people/_contact_method_fields.html.erb similarity index 100% rename from app/views/facilitators/_contact_method_fields.html.erb rename to app/views/people/_contact_method_fields.html.erb diff --git a/app/views/facilitators/_form.html.erb b/app/views/people/_form.html.erb similarity index 92% rename from app/views/facilitators/_form.html.erb rename to app/views/people/_form.html.erb index 205370c22..6dfa35378 100644 --- a/app/views/facilitators/_form.html.erb +++ b/app/views/people/_form.html.erb @@ -1,5 +1,5 @@ -<%= simple_form_for @facilitator, html: { multipart: true, class: "space-y-8" } do |f| %> - <%= render 'shared/errors', resource: @facilitator if @facilitator.errors.any? %> +<%= simple_form_for @person, html: { multipart: true, class: "space-y-8" } do |f| %> + <%= render 'shared/errors', resource: @person if @person.errors.any? %> <%= f.hidden_field :created_by_id, value: current_user&.id unless f.object.persisted? %> <%= f.hidden_field :updated_by_id, value: current_user&.id %> @@ -29,7 +29,7 @@ start_year: 1991, end_year: Time.current.year, order: [:month, :year], - label: "Facilitator since", + label: "Person since", hint: "Pick Jan if you only know the year", input_html: { type: "date", @@ -39,7 +39,7 @@ <% else %>

<%= f.object.member_since&.to_date&.strftime("%B %d, %Y") || "—" %> @@ -87,13 +87,13 @@ <%= f.input :email_type, label: "Primary email type", as: :select, - collection: Facilitator::CONTACT_TYPES.compact.map{|type| [type.to_s.humanize, type]} %> + collection: Person::CONTACT_TYPES.compact.map{|type| [type.to_s.humanize, type]} %> <% end %> <%= f.input :email_2, label: "Secondary email" %> <%= f.input :email_2_type, label: "Secondary email type", as: :select, - collection: Facilitator::CONTACT_TYPES.compact.map{|type| [type.to_s.humanize, type]} %> + collection: Person::CONTACT_TYPES.compact.map{|type| [type.to_s.humanize, type]} %>
@@ -143,7 +143,7 @@ <%= f.fields_for :user do |u| %> - <%= u.hidden_field :facilitator_id, value: f.object.id %> + <%= u.hidden_field :person_id, value: f.object.id %>
@@ -205,7 +205,7 @@
- +
<%= f.input :bio, as: :text, @@ -242,8 +242,8 @@
<%= f.input :profile_is_searchable, - hint: ("Findable on " + (link_to "facilitators index", - facilitators_path, + hint: ("Findable on " + (link_to "people index", + people_path, class: "underline")).html_safe %> <%= f.input :display_name_preference, @@ -266,7 +266,7 @@
- <%= f.input :profile_show_member_since, label: "Show facilitator since" %> + <%= f.input :profile_show_member_since, label: "Show person since" %> <%= f.input :profile_show_bio, label: "Show bio" %> <%= f.input :profile_show_affiliations, label: "Show affiliations" %> <%= f.input :profile_show_sectors, label: "Show sectors" %> @@ -292,12 +292,12 @@
- <% if @facilitator.persisted? && current_user.super_user? %> - <%= link_to "Delete", @facilitator, method: :delete, + <% if @person.persisted? && current_user.super_user? %> + <%= link_to "Delete", @person, method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-danger-outline" %> <% end %> - <%= link_to "Cancel", facilitators_path, class: "btn btn-secondary-outline" %> + <%= link_to "Cancel", people_path, class: "btn btn-secondary-outline" %> <%= f.submit "Submit", class: "btn btn-primary" %>
<% end %> diff --git a/app/views/facilitators/_project_user_fields.html.erb b/app/views/people/_project_user_fields.html.erb similarity index 100% rename from app/views/facilitators/_project_user_fields.html.erb rename to app/views/people/_project_user_fields.html.erb diff --git a/app/views/facilitators/_search_boxes.html.erb b/app/views/people/_search_boxes.html.erb similarity index 95% rename from app/views/facilitators/_search_boxes.html.erb rename to app/views/people/_search_boxes.html.erb index ac3a7d45f..af8163f68 100644 --- a/app/views/facilitators/_search_boxes.html.erb +++ b/app/views/people/_search_boxes.html.erb @@ -1,4 +1,4 @@ -<%= form_tag(facilitators_path, method: :get, class: "space-y-4") do |f| %> +<%= form_tag(people_path, method: :get, class: "space-y-4") do |f| %>
@@ -53,7 +53,7 @@
- <%= link_to 'Clear filters', facilitators_path, + <%= link_to "Clear filters", people_path, class: "btn btn-utility-outline" %>
diff --git a/app/views/facilitators/_sectorable_item_fields.html.erb b/app/views/people/_sectorable_item_fields.html.erb similarity index 100% rename from app/views/facilitators/_sectorable_item_fields.html.erb rename to app/views/people/_sectorable_item_fields.html.erb diff --git a/app/views/facilitators/_show_card.html.erb b/app/views/people/_show_card.html.erb similarity index 100% rename from app/views/facilitators/_show_card.html.erb rename to app/views/people/_show_card.html.erb diff --git a/app/views/facilitators/_social_media_buttons.html.erb b/app/views/people/_social_media_buttons.html.erb similarity index 71% rename from app/views/facilitators/_social_media_buttons.html.erb rename to app/views/people/_social_media_buttons.html.erb index 29a5b1854..9653b2da5 100644 --- a/app/views/facilitators/_social_media_buttons.html.erb +++ b/app/views/people/_social_media_buttons.html.erb @@ -1,9 +1,9 @@ -<%# app/views/facilitators/_social_links.html.erb %> -<% return if facilitator.blank? %> +<%# app/views/people/_social_links.html.erb %> +<% return if person.blank? %>
- <% if facilitator.linked_in_url.present? %> - <%= link_to facilitator.linked_in_url, target: "_blank", rel: "noopener noreferrer", + <% if person.linked_in_url.present? %> + <%= link_to person.linked_in_url, target: "_blank", rel: "noopener noreferrer", class: "group inline-flex items-center justify-center w-6 h-6 rounded-md bg-gray-100 hover:bg-[#0A66C2] transition-colors duration-200" do %> @@ -11,8 +11,8 @@ <% end %> <% end %> - <% if facilitator.instagram_url.present? %> - <%= link_to facilitator.instagram_url, target: "_blank", rel: "noopener noreferrer", + <% if person.instagram_url.present? %> + <%= link_to person.instagram_url, target: "_blank", rel: "noopener noreferrer", class: "group inline-flex items-center justify-center w-6 h-6 rounded-md bg-gray-100 hover:bg-gradient-to-tr hover:from-[#F58529] hover:via-[#DD2A7B] hover:to-[#8134AF] @@ -21,8 +21,8 @@ <% end %> <% end %> - <% if facilitator.facebook_url.present? %> - <%= link_to facilitator.facebook_url, target: "_blank", rel: "noopener noreferrer", + <% if person.facebook_url.present? %> + <%= link_to person.facebook_url, target: "_blank", rel: "noopener noreferrer", class: "group inline-flex items-center justify-center w-6 h-6 rounded-md bg-gray-100 hover:bg-[#1877F2] transition-colors duration-200" do %> @@ -30,8 +30,8 @@ <% end %> <% end %> - <% if facilitator.twitter_url.present? %> - <%= link_to facilitator.twitter_url, target: "_blank", rel: "noopener noreferrer", + <% if person.twitter_url.present? %> + <%= link_to person.twitter_url, target: "_blank", rel: "noopener noreferrer", class: "group inline-flex items-center justify-center w-6 h-6 rounded-md bg-gray-100 hover:bg-[#1DA1F2] transition-colors duration-200" do %> @@ -39,8 +39,8 @@ <% end %> <% end %> - <% if facilitator.youtube_url.present? %> - <%= link_to facilitator.youtube_url, target: "_blank", rel: "noopener noreferrer", + <% if person.youtube_url.present? %> + <%= link_to person.youtube_url, target: "_blank", rel: "noopener noreferrer", class: "group inline-flex items-center justify-center w-6 h-6 rounded-md bg-gray-100 hover:bg-[#FF0000] text-gray-600 hover:text-white diff --git a/app/views/facilitators/edit.html.erb b/app/views/people/edit.html.erb similarity index 73% rename from app/views/facilitators/edit.html.erb rename to app/views/people/edit.html.erb index 9889d4f14..34b6f5c11 100644 --- a/app/views/facilitators/edit.html.erb +++ b/app/views/people/edit.html.erb @@ -2,24 +2,24 @@
-

Edit <%= @facilitator.class.model_name.human %>

+

Edit <%= @person.class.model_name.human %>

- <% if current_user.super_user? || current_user == @facilitator.user %> + <% if current_user.super_user? || current_user == @person.user %> <%= link_to "Change password", change_password_path, class: "btn btn-secondary-outline" %> <% end %> - <% if @facilitator.user %> + <% if @person.user %> <%= link_to "User account", - edit_user_path(@facilitator.user), + edit_user_path(@person.user), class: "admin-only bg-blue-100 btn btn-secondary-outline" %> <% else %> <%= link_to "Create user account", - new_user_path(facilitator_id: @facilitator.id), + new_user_path(person_id: @person.id), class: "admin-only bg-blue-100 btn btn-secondary-outline" %> <% end %> <%= link_to "Profile", - facilitator_path(@facilitator), + person_path(@person), class: "btn btn-secondary-outline" %>
@@ -28,7 +28,7 @@
- <%= render "form", facilitator: @facilitator %> + <%= render "form", person: @person %>
diff --git a/app/views/facilitators/index.html.erb b/app/views/people/index.html.erb similarity index 74% rename from app/views/facilitators/index.html.erb rename to app/views/people/index.html.erb index 32f2876d0..9b4d3eb74 100644 --- a/app/views/facilitators/index.html.erb +++ b/app/views/people/index.html.erb @@ -1,13 +1,13 @@ -
+
-

Facilitators (<%= @count_display %>)

+

People (<%= @count_display %>)

<% if current_user.super_user? %> - <%= link_to "New Facilitator", - new_facilitator_path, + <%= link_to "New Person", + new_person_path, class: "admin-only bg-blue-100 btn btn-primary-outline" %> <% end %>
@@ -21,7 +21,7 @@ Name - Facilitator since + Person since Sector(s) Affiliation(s) Socials @@ -32,21 +32,21 @@ - <% @facilitators.each do |facilitator| %> - <% facilitator = facilitator.decorate %> + <% @people.each do |person| %> + <% person = person.decorate %> - <%= facilitator_profile_button(facilitator) %> + <%= person_profile_button(person) %> - <%= facilitator.member_since_year %> + <%= person.member_since_year %>
- <% facilitator.sectorable_items.each do |si| %> + <% person.sectorable_items.each do |si| %> <% si_name = "#{ si.sector.name }#{ " (#{"leader"})" if si.is_leader? }" %> @@ -58,8 +58,8 @@ - <% if facilitator.user&.projects&.any? %> - <% user_project_names = facilitator.user.projects.map(&:name).join(", ") %> + <% if person.user&.projects&.any? %> + <% user_project_names = person.user.projects.map(&:name).join(", ") %> <%= truncate(user_project_names, length: 120) %> @@ -70,15 +70,15 @@ - <%= render "social_media_buttons", facilitator: facilitator %> + <%= render "social_media_buttons", person: person %> <% if current_user.super_user? %> - <%= 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), + <%= link_to "User", user_path(person.user), + class: "admin-only bg-blue-100 btn btn-secondary-outline" if person.user %> + <%= link_to "Edit", edit_person_path(person), class: "admin-only bg-blue-100 btn btn-secondary-outline" %> <% end %> @@ -90,16 +90,16 @@
- <% unless @facilitators.any? %> + <% unless @people.any? %>

- No <%= Facilitator.model_name.human.pluralize %> found. + No <%= Person.model_name.human.pluralize %> found.

<% end %>
diff --git a/app/views/facilitators/new.html.erb b/app/views/people/new.html.erb similarity index 84% rename from app/views/facilitators/new.html.erb rename to app/views/people/new.html.erb index 2a0f69775..3202f936a 100644 --- a/app/views/facilitators/new.html.erb +++ b/app/views/people/new.html.erb @@ -1,10 +1,10 @@
-
border border-gray-200 rounded-xl shadow-lg hover:shadow-xl transition-shadow duration-200 p-6">
-

New <%= @facilitator.class.model_name.human %>

+

New <%= @person.class.model_name.human %>

diff --git a/app/views/facilitators/show.html.erb b/app/views/people/show.html.erb similarity index 70% rename from app/views/facilitators/show.html.erb rename to app/views/people/show.html.erb index 6164b4b89..abfec7901 100644 --- a/app/views/facilitators/show.html.erb +++ b/app/views/people/show.html.erb @@ -3,12 +3,12 @@
- <%= link_to "Facilitators", facilitators_path, class: "btn btn-secondary-outline" %> + <%= link_to "People", people_path, class: "btn btn-secondary-outline" %> - <%= render "bookmarks/editable_bookmark_button", resource: @facilitator.object %> + <%= render "bookmarks/editable_bookmark_button", resource: @person.object %> - <% if current_user.super_user? || current_user == @facilitator.user %> - <%= link_to "Edit", edit_facilitator_path(@facilitator), + <% if current_user.super_user? || current_user == @person.user %> + <%= link_to "Edit", edit_person_path(@person), class: "admin-only #{ DomainTheme.bg_class_for(:admin_only) } #{ DomainTheme.bg_class_for(:user_only) } btn btn-primary-outline" %> <% end %> @@ -17,11 +17,11 @@
- <% if @facilitator.avatar&.attached? %> - <%= image_tag url_for(@facilitator.avatar), + <% if @person.avatar&.attached? %> + <%= image_tag url_for(@person.avatar), 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), + <% elsif @person.user&.avatar&.attached? %> + <%= image_tag url_for(@person.user.avatar), class: "w-32 h-32 rounded-full object-cover border border-gray-200 shadow-sm" %> <% else %> <%= image_tag "missing.png", @@ -31,23 +31,23 @@

- <%= @facilitator.name %> - <% if @facilitator.pronouns.present? && @facilitator.profile_show_pronouns? %> - (<%= @facilitator.pronouns %>) + <%= @person.name %> + <% if @person.pronouns.present? && @person.profile_show_pronouns? %> + (<%= @person.pronouns %>) <% end %>

- <% if @facilitator.member_since_year.present? && @facilitator.profile_show_member_since? %> + <% if @person.member_since_year.present? && @person.profile_show_member_since? %>

- Facilitator since - <%= @facilitator.member_since_year %> + Person since + <%= @person.member_since_year %>

<% end %> - <% if @facilitator.profile_show_social_media? %> + <% if @person.profile_show_social_media? %>
- <%= render "facilitators/social_media_buttons", facilitator: @facilitator %> + <%= render "people/social_media_buttons", person: @person %>
<% end %>
@@ -55,7 +55,7 @@
- <% @facilitator.badges.each do |(label, color)| %> + <% @person.badges.each do |(label, color)| %> <%= label %> @@ -64,12 +64,12 @@
- <% unless @facilitator.user %> + <% unless @person.user %>
Not associated with a user!
<%= link_to "Create user", - new_user_path(facilitator_id: @facilitator.id), + new_user_path(person_id: @person.id), class: "btn btn-primary" %>
<% end %> @@ -79,12 +79,12 @@
- <% if @facilitator.profile_show_affiliations? %> + <% if @person.profile_show_affiliations? %>

Organizational affiliations

- <% if @facilitator.user && @facilitator.user.project_users.active.any? %> + <% if @person.user && @person.user.project_users.active.any? %>
    - <% @facilitator.user.project_users.active.each do |pu| %> + <% @person.user.project_users.active.each do |pu| %>
  • <% if pu.title.present? || pu.position.present? %> <%= pu.title.presence || pu.position.humanize %> - @@ -101,13 +101,13 @@ <% end %> - <% if @facilitator.profile_show_sectors? %> + <% if @person.profile_show_sectors? %>

    Service Populations

    - <% if @facilitator.sectorable_items.any? %> + <% if @person.sectorable_items.any? %>

    - <% @facilitator + <% @person .sectorable_items .includes(:sector) .order("sectors.name") @@ -129,17 +129,17 @@
    - <% if @facilitator.profile_show_email? || @facilitator.profile_show_phone? %> + <% if @person.profile_show_email? || @person.profile_show_phone? %>

    Contact Information

    - <% email = @facilitator.user&.email || @facilitator.email %> - <% if @facilitator.profile_show_email? && email.present? %> + <% email = @person.user&.email || @person.email %> + <% if @person.profile_show_email? && email.present? %>

    📧 <%= mail_to email, email, class: "text-blue-600 hover:underline" %>

    <% end %> - <% phone = @facilitator.phone_number || @facilitator.user&.phone %> - <% if @facilitator.profile_show_phone? && phone.present? %> + <% phone = @person.phone_number || @person.user&.phone %> + <% if @person.profile_show_phone? && phone.present? %>

    📞 <%= link_to phone, "tel:#{phone}", class: "text-blue-600 hover:underline" %> @@ -152,18 +152,18 @@


    - <% if @facilitator.profile_show_bio? && @facilitator.bio.present? %> + <% if @person.profile_show_bio? && @person.bio.present? %>

    Bio

    - <%= sanitize(@facilitator.bio, tags: %w[p br strong em a ul ol li b i], attributes: %w[href]) %> + <%= sanitize(@person.bio, tags: %w[p br strong em a ul ol li b i], attributes: %w[href]) %>
    <% end %> - <% if @facilitator.profile_show_workshops? || - @facilitator.profile_show_workshop_variations? || - @facilitator.profile_show_stories? %> -
    + <% if @person.profile_show_workshops? || + @person.profile_show_workshop_variations? || + @person.profile_show_stories? %> +

    @@ -174,12 +174,12 @@
    - <% if @facilitator.profile_show_workshops? %> + <% if @person.profile_show_workshops? %>

    Workshops authored

    - <% if @facilitator.user && @facilitator.user.workshops.any? %> + <% if @person.user && @person.user.workshops.any? %>
    - <% @facilitator.user.workshops.order(created_at: :desc).each do |workshop| %> + <% @person.user.workshops.order(created_at: :desc).each do |workshop| %> <%= render "show_card", record: workshop.decorate, title_font_size: "text-sm" %> <% end %>
    @@ -190,12 +190,12 @@ <% end %> - <% if @facilitator.profile_show_workshop_variations? %> + <% if @person.profile_show_workshop_variations? %>

    Workshop variations authored

    - <% if @facilitator.user && @facilitator.user.workshop_variations_as_creator.any? %> + <% if @person.user && @person.user.workshop_variations_as_creator.any? %>
    - <% @facilitator.user.workshop_variations_as_creator.order(created_at: :desc).each do |workshop_variation| %> + <% @person.user.workshop_variations_as_creator.order(created_at: :desc).each do |workshop_variation| %> <%= render "show_card", record_title: "#{workshop_variation.name}
    " + "WORKSHOP: #{workshop_variation.workshop.name}", @@ -209,11 +209,11 @@ <% end %> - <% if @facilitator.profile_show_stories? %> + <% if @person.profile_show_stories? %>

    Stories authored/featured

    - <% stories = Story.where(id: @facilitator.user&.stories_as_creator&.pluck(:id).to_a + - @facilitator.stories_as_spotlighted_facilitator.pluck(:id)) %> + <% stories = Story.where(id: @person.user&.stories_as_creator&.pluck(:id).to_a + + @person.stories_as_spotlighted_person.pluck(:id)) %> <% if stories.any? %>
    <% stories.order(created_at: :desc).each do |story| %> @@ -230,8 +230,8 @@ <% end %> - <% if @facilitator.profile_show_events_registered? %> -
    + <% if @person.profile_show_events_registered? %> +

    @@ -241,12 +241,12 @@
    - <% if @facilitator.profile_show_events_registered? %> + <% if @person.profile_show_events_registered? %>

    Events registered

    - <% if @facilitator.event_registrations.any? %> + <% if @person.event_registrations.any? %>
    - <% @facilitator.event_registrations.includes(:event).order("events.start_date DESC").each do |event_registration| %> + <% @person.event_registrations.includes(:event).order("events.start_date DESC").each do |event_registration| %> <%= render "show_card", bookmarkable: event_registration.event, record_title: "#{event_registration.event.title}
    " + @@ -266,8 +266,8 @@ - <% if current_user.super_user || current_user == @facilitator.user %> -
    + <% if current_user.super_user || current_user == @person.user %> +

    @@ -281,12 +281,12 @@
    - <% if @facilitator.profile_show_workshop_ideas? %> + <% if @person.profile_show_workshop_ideas? %>

    Workshop ideas submitted

    - <% if @facilitator.user && @facilitator.user.workshop_ideas_as_creator.any? %> + <% if @person.user && @person.user.workshop_ideas_as_creator.any? %>
    - <% @facilitator.user.workshop_ideas_as_creator.order(created_at: :desc).each do |idea| %> + <% @person.user.workshop_ideas_as_creator.order(created_at: :desc).each do |idea| %> <%= render "show_card", record: idea.decorate, title_font_size: "text-sm" %> <% end %> @@ -298,12 +298,12 @@ <% end %> - <% if @facilitator.profile_show_story_ideas? %> + <% if @person.profile_show_story_ideas? %>

    Story ideas submitted

    - <% if @facilitator.user && @facilitator.user.story_ideas_as_creator.any? %> + <% if @person.user && @person.user.story_ideas_as_creator.any? %>
    - <% @facilitator.user.story_ideas_as_creator.order(created_at: :desc).each do |story_idea| %> + <% @person.user.story_ideas_as_creator.order(created_at: :desc).each do |story_idea| %> <%= render "show_card", record_title: story_idea.workshop_title, record: story_idea.decorate, title_font_size: "text-sm" %> @@ -316,12 +316,12 @@ <% end %> - <% if @facilitator.profile_show_workshop_logs? %> + <% if @person.profile_show_workshop_logs? %>

    Workshop logs submitted

    - <% if @facilitator.user && @facilitator.user.workshop_logs.any? %> + <% if @person.user && @person.user.workshop_logs.any? %>
    - <% @facilitator.user.workshop_logs.order(date: :desc, created_at: :desc).each do |workshop_log| %> + <% @person.user.workshop_logs.order(date: :desc, created_at: :desc).each do |workshop_log| %> <%= render "show_card", record_title: "#{workshop_log.workshop&.title || "Workshop log #" + workshop_log.id.to_s} - #{workshop_log.windows_type_name}", diff --git a/app/views/projects/_form.html.erb b/app/views/projects/_form.html.erb index bd8316059..3e5bbb89e 100644 --- a/app/views/projects/_form.html.erb +++ b/app/views/projects/_form.html.erb @@ -263,7 +263,7 @@ <% f.object.user && f.object.user.project_users.each do |pu| %>
  • <%= pu.title || pu.position %> - - <%= facilitator_profile_button(pu.user.facilitator) if pu.persisted? && pu.user.facilitator %> + <%= person_profile_button(pu.user.person) if pu.persisted? && pu.user.person %>
  • <% end %> diff --git a/app/views/projects/_project_user_fields.html.erb b/app/views/projects/_project_user_fields.html.erb index 424ed1913..9be10777b 100644 --- a/app/views/projects/_project_user_fields.html.erb +++ b/app/views/projects/_project_user_fields.html.erb @@ -5,7 +5,7 @@ <%= f.input :user_id, as: :select, label: "Facilitator", - collection: @facilitators_array, + collection: @people_array, include_blank: true, selected: f.object&.user_id, input_html: { diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index 8796ec645..20272c2aa 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -89,7 +89,7 @@
      <% @project.project_users.active.each do |pu| %>
    • - <%= pu.user.facilitator ? facilitator_profile_button(pu.user.facilitator) : pu.user.name %> + <%= pu.user.person ? person_profile_button(pu.user.person) : pu.user.name %> <% if pu.position.present? %> – <%= pu.title.presence || pu.position.humanize %> <% end %> diff --git a/app/views/shared/_navbar_menu.html.erb b/app/views/shared/_navbar_menu.html.erb index 104b5ad7b..129f790fc 100644 --- a/app/views/shared/_navbar_menu.html.erb +++ b/app/views/shared/_navbar_menu.html.erb @@ -81,10 +81,10 @@ <% end %> <% if current_user&.super_user %> - <%= link_to facilitators_path, + <%= link_to people_path, class: "admin-only bg-blue-100 flex items-center gap-2 px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" do %> - Facilitators + People <% end %> <%= link_to projects_path, diff --git a/app/views/shared/_navbar_menu_mobile.html.erb b/app/views/shared/_navbar_menu_mobile.html.erb index 5af6b8926..0ddc09980 100644 --- a/app/views/shared/_navbar_menu_mobile.html.erb +++ b/app/views/shared/_navbar_menu_mobile.html.erb @@ -63,10 +63,10 @@ <% end %> <% if current_user&.super_user %> - <%= link_to facilitators_path, class: "admin-only bg-blue-100 flex items-center px-4 py-2 text-sm text-white + <%= link_to people_path, class: "admin-only bg-blue-100 flex items-center px-4 py-2 text-sm text-white hover:text-gray-700 hover:bg-gray-100 w-full space-x-2" do %> - Facilitators + People <% end %> <%= link_to projects_path, class: "admin-only bg-blue-100 flex items-center px-4 py-2 text-sm text-white hover:text-gray-700 hover:bg-gray-100 w-full space-x-2" do %> diff --git a/app/views/shared/_navbar_user.html.erb b/app/views/shared/_navbar_user.html.erb index a97f3e923..77a30f316 100644 --- a/app/views/shared/_navbar_user.html.erb +++ b/app/views/shared/_navbar_user.html.erb @@ -28,7 +28,7 @@ <% end %> <% if current_user&.super_user %> - <%= link_to (current_user.facilitator ? facilitator_path(current_user.facilitator) : generate_facilitator_user_path(current_user)), + <%= link_to (current_user.person ? person_path(current_user.person) : generate_person_user_path(current_user)), class: "admin-only bg-blue-100 flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 w-full space-x-2" do %> My profile diff --git a/app/views/stories/_form.html.erb b/app/views/stories/_form.html.erb index f8c564281..69983a8f2 100644 --- a/app/views/stories/_form.html.erb +++ b/app/views/stories/_form.html.erb @@ -84,7 +84,7 @@ selected: f.object.project_id || @story_idea&.project_id, label: (f.object.created_by ? ( link_to "Story author", - generate_facilitator_user_path(f.object.created_by), + generate_person_user_path(f.object.created_by), class: "hover:underline") : "Story author").html_safe, prompt: "Select User" %> @@ -103,15 +103,15 @@
    - <%= f.input :spotlighted_facilitator_id, - collection: Facilitator.joins(:user).order("users.first_name, users.last_name"), + <%= f.input :spotlighted_person_id, + collection: Person.joins(:user).order("users.first_name, users.last_name"), label_method: :full_name, value_method: :id, include_blank: true, - selected: f.object.spotlighted_facilitator_id, - label: (f.object.spotlighted_facilitator_id ? (link_to "Story spotlighted facilitator", - facilitator_path(f.object.spotlighted_facilitator_id), - class: "hover:underline") : "Story spotlighted facilitator").html_safe %> + selected: f.object.spotlighted_person_id, + label: (f.object.spotlighted_person_id ? (link_to "Story spotlighted person", + person_path(f.object.spotlighted_person_id), + class: "hover:underline") : "Story spotlighted person").html_safe %>
    <%= f.hidden_field :updated_by_id, value: current_user.id %> diff --git a/app/views/stories/show.html.erb b/app/views/stories/show.html.erb index 21393efae..b395ebd2e 100644 --- a/app/views/stories/show.html.erb +++ b/app/views/stories/show.html.erb @@ -36,8 +36,8 @@

    Story by: <% author_credit = @story.story_idea&.author_credit || @story.created_by.full_name %> - <% if @story.created_by.facilitator&.profile_is_searchable %> - <%= link_to author_credit, facilitator_path(@story.created_by) %> + <% if @story.created_by.person&.profile_is_searchable %> + <%= link_to author_credit, person_path(@story.created_by) %> <% else %> <%= author_credit %> <% end %> diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb index 579455ff2..94ea1e08f 100644 --- a/app/views/users/_form.html.erb +++ b/app/views/users/_form.html.erb @@ -1,7 +1,7 @@ <%= simple_form_for @user, html: { multipart: true, class: "space-y-8" } do |f| %> <%= render 'shared/errors', resource: user if user.errors.any? %> - <%= f.hidden_field :facilitator_id, value: params[:facilitator_id] %> + <%= f.hidden_field :person_id, value: params[:person_id] %> @@ -10,9 +10,9 @@

    - <% if @facilitator %> - <%= f.hidden_field :first_name, value: @facilitator.first_name %> - <%= f.hidden_field :last_name, value: @facilitator.last_name %> + <% if @person %> + <%= f.hidden_field :first_name, value: @person.first_name %> + <%= f.hidden_field :last_name, value: @person.last_name %>
    - <%= @facilitator.first_name %> + <%= @person.first_name %>

    - Edit on <%= link_to "facilitator profile", facilitator_path(@facilitator), class: "underline" %> + Edit on <%= link_to "person profile", person_path(@person), class: "underline" %>

    @@ -36,20 +36,20 @@
    - <%= @facilitator.last_name %> + <%= @person.last_name %>

    - Edit on <%= link_to "facilitator profile", facilitator_path(@facilitator), class: "underline" %> + Edit on <%= link_to "person profile", person_path(@person), class: "underline" %>

    <% else %>
    - Not associated with a facilitator! + Not associated with a person!
    - <%= link_to "Create facilitator", - new_facilitator_path(user_id: @user.id), + <%= link_to "Create person", + new_person_path(user_id: @user.id), class: "btn btn-primary" if @user.persisted? %>
    <% end %> @@ -60,7 +60,7 @@ <%= f.input :email, label: email_label_with_confirmation_icon(@user), hint: "Only editable by admins", - input_html: { value: f.object.email.presence || @facilitator&.email, + input_html: { value: f.object.email.presence || @person&.email, class: "w-full" }, wrapper_html: { class: "w-full" }, label_html: { id: "email_label" } %> @@ -85,7 +85,7 @@
    - <%= f.object.email.presence || @facilitator&.email %> + <%= f.object.email.presence || @person&.email %>

    diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 6d646477e..d74cbdcc4 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -16,9 +16,9 @@ change_password_path, class: "btn btn-secondary-outline" %> <% end %> - <%= link_to "Facilitator", - facilitator_path(@user.facilitator), - class: "btn btn-secondary-outline" if @user.facilitator %> + <%= link_to "Person", + person_path(@user.person), + class: "btn btn-secondary-outline" if @user.person %> <%= link_to "View", user_path(@user), class: "btn btn-secondary-outline" %> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index ad1c8d065..53c838ab2 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -38,11 +38,11 @@ - <% if user.facilitator %> - <%= facilitator_profile_button(user.facilitator) %> + <% if user.person %> + <%= person_profile_button(user.person) %> <% else %> - <%= link_to "Create facilitator", - new_facilitator_path(user_id: user.id), + <%= link_to "Create person", + new_person_path(user_id: user.id), class: "btn btn-secondary-outline" %> <% end %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 2f673f7e3..2379facf6 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -6,9 +6,9 @@

    <% if current_user.super_user? %> <%= link_to "Users", users_path, class: "btn btn-secondary-outline mr-2" %> - <%= link_to "Facilitator profile", - facilitator_path(@user.facilitator), - class: "btn btn-secondary-outline mr-2" if @user.facilitator %> + <%= link_to "Person profile", + person_path(@user.person), + class: "btn btn-secondary-outline mr-2" if @user.person %> <%= link_to "Edit", edit_user_path(@user), class: "btn btn-primary-outline" %> <% end %>
    @@ -53,11 +53,11 @@
    - <% unless @user.facilitator %> - Not associated with a facilitator! + <% unless @user.person %> + Not associated with a person!
    - <%= link_to "Create facilitator", - new_facilitator_path(user_id: @user.id), + <%= link_to "Create person", + new_person_path(user_id: @user.id), class: "btn btn-primary" if @user.persisted? %> <% end %>
    diff --git a/app/views/workshop_logs/_index.html.erb b/app/views/workshop_logs/_index.html.erb index c36844c68..0280dfd6f 100644 --- a/app/views/workshop_logs/_index.html.erb +++ b/app/views/workshop_logs/_index.html.erb @@ -77,7 +77,7 @@ <%= log.workshop ? link_to(log.workshop.title, workshop_path(log.workshop)) : "-" %> - <%= log.user ? link_to(log.user.name, generate_facilitator_user_path(log.user)) : "—" %> + <%= log.user ? link_to(log.user.name, generate_person_user_path(log.user)) : "—" %> <%= display_count(log.total_attendance) %> diff --git a/app/views/workshop_logs/_search_boxes.html.erb b/app/views/workshop_logs/_search_boxes.html.erb index cdaa2f1ad..3751874e8 100644 --- a/app/views/workshop_logs/_search_boxes.html.erb +++ b/app/views/workshop_logs/_search_boxes.html.erb @@ -37,8 +37,8 @@
    <%= label_tag :user_id, "Facilitator", class: "text-sm font-medium text-gray-700 mb-1" %> <%= select_tag :user_id, - options_from_collection_for_select(@facilitators, :id, :name, params[:user_id]), - include_blank: "All facilitators", + options_from_collection_for_select(@people, :id, :name, params[:user_id]), + include_blank: "All people", class: "rounded-md 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 w-full", onchange: "this.form.requestSubmit()" %> diff --git a/app/views/workshop_variations/index.html.erb b/app/views/workshop_variations/index.html.erb index 2e6cdbe81..aa25ce7f8 100644 --- a/app/views/workshop_variations/index.html.erb +++ b/app/views/workshop_variations/index.html.erb @@ -50,9 +50,9 @@ - <% if workshop_variation.created_by && workshop_variation.created_by.facilitator %> + <% if workshop_variation.created_by && workshop_variation.created_by.person %> <%= link_to workshop_variation.created_by.full_name, - facilitator_path(workshop_variation.created_by.facilitator), + person_path(workshop_variation.created_by.person), class: "btn btn-secondary-outline" %> <% elsif workshop_variation.created_by %> <%= workshop_variation.created_by.full_name %> diff --git a/app/views/workshops/_index_row.html.erb b/app/views/workshops/_index_row.html.erb index ef840d84d..2672f5231 100644 --- a/app/views/workshops/_index_row.html.erb +++ b/app/views/workshops/_index_row.html.erb @@ -56,7 +56,7 @@ By: <% if workshop.user %> <%= link_to workshop.author_name, - generate_facilitator_user_path(workshop.user), + generate_person_user_path(workshop.user), class: "hover:underline", data: { turbo: false } %> <% else %> diff --git a/app/views/workshops/_show_actions_row.html.erb b/app/views/workshops/_show_actions_row.html.erb index cd6aa05af..e45e7610b 100644 --- a/app/views/workshops/_show_actions_row.html.erb +++ b/app/views/workshops/_show_actions_row.html.erb @@ -3,8 +3,8 @@
    <%= render "bookmarks/editable_bookmark_button", resource: workshop.object %> - <%= tag.span id: dom_id(workshop, :bookmark_count_facilitator), class: "text-gray-600 text-sm" do %> - (Bookmarked by <%= pluralize(workshop.bookmarks.count, "facilitator") %>, + <%= tag.span id: dom_id(workshop, :bookmark_count_person), class: "text-gray-600 text-sm" do %> + (Bookmarked by <%= pluralize(workshop.bookmarks.count, "user") %>, <% end %> <%= tag.span id: dom_id(workshop, :led_count), class: "text-gray-600 text-sm" do %> diff --git a/app/views/workshops/_show_associations.html.erb b/app/views/workshops/_show_associations.html.erb index 0afc26ac3..2e0283644 100644 --- a/app/views/workshops/_show_associations.html.erb +++ b/app/views/workshops/_show_associations.html.erb @@ -57,7 +57,7 @@
    -

    Related facilitator spotlight(s)

    +

    Related people spotlights

    <% if current_user.super_user? && @workshop.persisted? %> <%= link_to "New story", diff --git a/config/routes.rb b/config/routes.rb index eecf56ea6..7cb8f412b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -58,7 +58,7 @@ resources :events do resource :registrations, only: %i[create destroy], module: :events, as: :registrant_registration end - resources :facilitators + resources :people resources :faqs resources :notifications, only: [ :index, :show ] resources :organizations @@ -92,7 +92,7 @@ resources :tutorials resources :users, only: [ :new, :index, :show, :edit, :update, :create, :destroy ] do member do - get :generate_facilitator + get :generate_person post :send_reset_password_instructions post :toggle_lock_status post :confirm_email diff --git a/db/migrate/20260204025110_rename_facilitators_to_people.rb b/db/migrate/20260204025110_rename_facilitators_to_people.rb new file mode 100644 index 000000000..324135778 --- /dev/null +++ b/db/migrate/20260204025110_rename_facilitators_to_people.rb @@ -0,0 +1,5 @@ +class RenameFacilitatorsToPeople < ActiveRecord::Migration[8.1] + def change + rename_table :facilitators, :people + end +end diff --git a/db/migrate/20260204025111_rename_spotlighted_facilitator_to_spotlighted_person.rb b/db/migrate/20260204025111_rename_spotlighted_facilitator_to_spotlighted_person.rb new file mode 100644 index 000000000..2e2fda816 --- /dev/null +++ b/db/migrate/20260204025111_rename_spotlighted_facilitator_to_spotlighted_person.rb @@ -0,0 +1,5 @@ +class RenameSpotlightedFacilitatorToSpotlightedPerson < ActiveRecord::Migration[8.1] + def change + rename_column :stories, :spotlighted_facilitator_id, :spotlighted_person_id + end +end diff --git a/spec/factories/facilitators.rb b/spec/factories/people.rb similarity index 71% rename from spec/factories/facilitators.rb rename to spec/factories/people.rb index 83b02ae88..30d1e116d 100644 --- a/spec/factories/facilitators.rb +++ b/spec/factories/people.rb @@ -1,5 +1,5 @@ FactoryBot.define do - factory :facilitator do + factory :person do association :user association :created_by, factory: :user association :updated_by, factory: :user @@ -7,8 +7,8 @@ last_name { Faker::Name.last_name.gsub("'", " ") } trait :with_organization do - after(:create) do |facilitator| - facilitator.organizations << create(:organization) + after(:create) do |person| + person.organizations << create(:organization) end end end diff --git a/spec/models/facilitator_spec.rb b/spec/models/person_spec.rb similarity index 56% rename from spec/models/facilitator_spec.rb rename to spec/models/person_spec.rb index e8dde26d1..846821004 100644 --- a/spec/models/facilitator_spec.rb +++ b/spec/models/person_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Facilitator, type: :model do +RSpec.describe Person, type: :model do describe "associations" do it { should have_one(:user) } end @@ -11,40 +11,40 @@ end describe "#name" do - let(:facilitator) { build(:facilitator, first_name: "Jane", last_name: "Doe") } + let(:person) { build(:person, first_name: "Jane", last_name: "Doe") } context "when display_name_preference is full_name" do it "returns the full name" do - facilitator.display_name_preference = "full_name" - expect(facilitator.name).to eq("Jane Doe") + person.display_name_preference = "full_name" + expect(person.name).to eq("Jane Doe") end end context "when display_name_preference is first_name_last_initial" do it "returns first name and last initial" do - facilitator.display_name_preference = "first_name_last_initial" - expect(facilitator.name).to eq("Jane D") + person.display_name_preference = "first_name_last_initial" + expect(person.name).to eq("Jane D") end end context "when display_name_preference is first_name_only" do it "returns only the first name" do - facilitator.display_name_preference = "first_name_only" - expect(facilitator.name).to eq("Jane") + person.display_name_preference = "first_name_only" + expect(person.name).to eq("Jane") end end context "when display_name_preference is last_name_only" do it "returns only the last name" do - facilitator.display_name_preference = "last_name_only" - expect(facilitator.name).to eq("Doe") + person.display_name_preference = "last_name_only" + expect(person.name).to eq("Doe") end end context "when display_name_preference is nil or unknown" do it "defaults to full name" do - facilitator.display_name_preference = nil - expect(facilitator.name).to eq("Jane Doe") + person.display_name_preference = nil + expect(person.name).to eq("Jane Doe") end end end diff --git a/spec/services/facilitator_from_user_service_spec.rb b/spec/services/person_from_user_service_spec.rb similarity index 61% rename from spec/services/facilitator_from_user_service_spec.rb rename to spec/services/person_from_user_service_spec.rb index 4f71ed05e..d8c940042 100644 --- a/spec/services/facilitator_from_user_service_spec.rb +++ b/spec/services/person_from_user_service_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -RSpec.describe FacilitatorFromUserService do +RSpec.describe PersonFromUserService do subject(:service) { described_class.new(user: user) } let(:user) do @@ -30,15 +30,15 @@ end describe "#call" do - let(:facilitator) { service.call } + let(:person) { service.call } - it "returns a new Facilitator" do - expect(facilitator).to be_a(Facilitator) - expect(facilitator).to be_new_record + it "returns a new Person" do + expect(person).to be_a(Person) + expect(person).to be_new_record end - it "hydrates facilitator attributes from the user" do - expect(facilitator).to have_attributes( + it "hydrates person attributes from the user" do + expect(person).to have_attributes( first_name: "Jane", last_name: "Doe", email: "jane@example.com", @@ -50,7 +50,7 @@ end it "builds contact methods from user phone fields" do - contact_methods = facilitator.contact_methods + contact_methods = person.contact_methods expect(contact_methods.size).to eq(2) @@ -58,35 +58,35 @@ secondary_phone = contact_methods.reject(&:is_primary).first expect(primary_phone).to have_attributes( - kind: "phone", - value: "111-111-1111", - is_primary: true - ) + kind: "phone", + value: "111-111-1111", + is_primary: true + ) expect(secondary_phone).to have_attributes( - kind: "phone", - value: "222-222-2222" - ) + kind: "phone", + value: "222-222-2222" + ) end it "builds addresses from user address fields" do - addresses = facilitator.addresses + addresses = person.addresses expect(addresses.size).to eq(2) expect(addresses.first).to have_attributes( - street_address: "123 Main St", - city: "Boston", - state: "MA", - zip_code: "02101" - ) - - expect(addresses.second).to have_attributes( - street_address: "456 Side St", - city: "Cambridge", + street_address: "123 Main St", + city: "Boston", state: "MA", - zip_code: "02139" + zip_code: "02101" ) + + expect(addresses.second).to have_attributes( + street_address: "456 Side St", + city: "Cambridge", + state: "MA", + zip_code: "02139" + ) end context "when optional user fields are blank" do @@ -104,13 +104,13 @@ end it "does not build contact methods" do - facilitator = service.call - expect(facilitator.contact_methods).to be_empty + person = service.call + expect(person.contact_methods).to be_empty end it "still builds addresses (even if values are nil)" do - facilitator = service.call - expect(facilitator.addresses.size).to eq(2) + person = service.call + expect(person.addresses.size).to eq(2) end end end diff --git a/spec/system/facilitator_adds_event_to_calendar_test.rb b/spec/system/facilitator_adds_event_to_calendar_test.rb index 88a25ac8f..9469304cd 100644 --- a/spec/system/facilitator_adds_event_to_calendar_test.rb +++ b/spec/system/facilitator_adds_event_to_calendar_test.rb @@ -5,7 +5,7 @@ context "When Facilitator is logged in" do before do user = create(:user) - create(:facilitator, user: user) + create(:person, user: user) @event = create(:event, title: "Upcoming Workshop", diff --git a/spec/system/facilitator_bookmarks_workshop_test.rb b/spec/system/facilitator_bookmarks_workshop_test.rb index ebd5155d6..bc908bdc2 100644 --- a/spec/system/facilitator_bookmarks_workshop_test.rb +++ b/spec/system/facilitator_bookmarks_workshop_test.rb @@ -5,7 +5,7 @@ context "when facilitator is logged in" do before do user = create(:user) - create(:facilitator, user: user) + create(:person, user: user) adult_window = create(:windows_type, :adult) @workshop_world = create(:workshop, title: 'The best workshop in the world', windows_type: adult_window) diff --git a/spec/system/facilitator_changes_password_test.rb b/spec/system/facilitator_changes_password_test.rb index 52aba955b..9a8720887 100644 --- a/spec/system/facilitator_changes_password_test.rb +++ b/spec/system/facilitator_changes_password_test.rb @@ -5,7 +5,7 @@ context 'when facilitator requests password change' do before do @user = create(:user) - create(:facilitator, user: @user) + create(:person, user: @user) end it 'completes the full password reset flow successfully' do diff --git a/spec/system/facilitator_downloads_resources_test.rb b/spec/system/facilitator_downloads_resources_test.rb index 54a7732d7..dccad9bc6 100644 --- a/spec/system/facilitator_downloads_resources_test.rb +++ b/spec/system/facilitator_downloads_resources_test.rb @@ -27,7 +27,7 @@ driven_by :selenium_chrome_headless_download - create(:facilitator, user: user) + create(:person, user: user) create(:downloadable_asset, owner: resource) clear_downloads end diff --git a/spec/system/facilitator_filters_workshops_test.rb b/spec/system/facilitator_filters_workshops_test.rb index d80b8e3aa..7464922e8 100644 --- a/spec/system/facilitator_filters_workshops_test.rb +++ b/spec/system/facilitator_filters_workshops_test.rb @@ -14,7 +14,7 @@ let(:sector_education) { create(:sector, :published, name: "Education/Schools") } before do - create(:facilitator, user: user) + create(:person, user: user) # Create test workshops workshop_world = create(:workshop, title: 'The best workshop in the world', windows_type: adult_window, inactive: false) @@ -173,7 +173,7 @@ let(:sector_lgbtqia) { create(:sector, :published, name: "LGBTQIA") } before do - create(:facilitator, user: admin) + create(:person, user: admin) # Published workshop published_workshop = create(:workshop, diff --git a/spec/system/facilitator_registers_for_event_test.rb b/spec/system/facilitator_registers_for_event_test.rb index 47f519481..0f1bab093 100644 --- a/spec/system/facilitator_registers_for_event_test.rb +++ b/spec/system/facilitator_registers_for_event_test.rb @@ -5,7 +5,7 @@ context "When Facilitator is logged in" do before do user = create(:user) - create(:facilitator, user: user) + create(:person, user: user) @event = create(:event, title: "Upcoming Workshop", diff --git a/spec/system/facilitator_searches_resources_test.rb b/spec/system/facilitator_searches_resources_test.rb index ef2c474f0..7ebee9502 100644 --- a/spec/system/facilitator_searches_resources_test.rb +++ b/spec/system/facilitator_searches_resources_test.rb @@ -5,7 +5,7 @@ context "When user is logged in" do before do user = create(:user) - create(:facilitator, user: user) + create(:person, user: user) create(:resource, title: "Scholarship Application Guide", featured: true, kind: "Scholarship") create(:resource, title: "Workshop Session Template", kind: "Template") create(:resource, title: "Participant Handout Package", kind: "Handout") diff --git a/spec/system/facilitator_searches_workshop_test.rb b/spec/system/facilitator_searches_workshop_test.rb index 40d62231a..d00c5c96a 100644 --- a/spec/system/facilitator_searches_workshop_test.rb +++ b/spec/system/facilitator_searches_workshop_test.rb @@ -5,7 +5,7 @@ context "when facilitator is logged in" do before do user = create(:user) - create(:facilitator, user: user) + create(:person, user: user) adult_window = create(:windows_type, :adult) workshop_world = create(:workshop, title: 'The best workshop in the world', windows_type: adult_window) diff --git a/spec/system/facilitator_submits_story_test.rb b/spec/system/facilitator_submits_story_test.rb index 04837e0cf..3812afcf4 100644 --- a/spec/system/facilitator_submits_story_test.rb +++ b/spec/system/facilitator_submits_story_test.rb @@ -9,7 +9,7 @@ create(:windows_type, :combined) @user = create(:user) - create(:facilitator, user: @user) + create(:person, user: @user) sign_in @user visit new_story_path diff --git a/spec/system/facilitator_submits_workshop_idea_test.rb b/spec/system/facilitator_submits_workshop_idea_test.rb index ad4f7c793..5f3c98bd7 100644 --- a/spec/system/facilitator_submits_workshop_idea_test.rb +++ b/spec/system/facilitator_submits_workshop_idea_test.rb @@ -10,7 +10,7 @@ create(:windows_type, :combined) user = create(:user) - create(:facilitator, user: user) + create(:person, user: user) sign_in user visit new_workshop_idea_path diff --git a/spec/system/facilitator_submits_workshop_log_test.rb b/spec/system/facilitator_submits_workshop_log_test.rb index 427121595..205eda919 100644 --- a/spec/system/facilitator_submits_workshop_log_test.rb +++ b/spec/system/facilitator_submits_workshop_log_test.rb @@ -5,7 +5,7 @@ context "when facilitator is logged in" do before do @user = create(:user) - create(:facilitator, user: @user) + create(:person, user: @user) adult_window = create(:windows_type, :adult) @windows_type = create(:windows_type, short_name: "COMBINED") diff --git a/spec/system/facilitator_views_featured_workshops_test.rb b/spec/system/facilitator_views_featured_workshops_test.rb index ce0ce27e1..e0b9af00b 100644 --- a/spec/system/facilitator_views_featured_workshops_test.rb +++ b/spec/system/facilitator_views_featured_workshops_test.rb @@ -5,7 +5,7 @@ context "when facilitator is logged in" do before do user = create(:user) - create(:facilitator, user: user) + create(:person, user: user) adult_window = create(:windows_type, :adult) create(:workshop, title: 'The best workshop in the world', windows_type: adult_window, featured: true) create(:workshop, title: 'The best workshop on mars', windows_type: adult_window, featured: true) diff --git a/spec/system/facilitator_views_popular_resources_test.rb b/spec/system/facilitator_views_popular_resources_test.rb index a55c5e34b..509196063 100644 --- a/spec/system/facilitator_views_popular_resources_test.rb +++ b/spec/system/facilitator_views_popular_resources_test.rb @@ -5,7 +5,7 @@ context "when logged in" do before do @user = create(:user) - create(:facilitator, user: @user) + create(:person, user: @user) @popular_resource = create(:resource, title: "Most Popular Resource", featured: true, diff --git a/spec/system/facilitator_views_workshop_logs_test.rb b/spec/system/facilitator_views_workshop_logs_test.rb index 00fb91335..9fd510466 100644 --- a/spec/system/facilitator_views_workshop_logs_test.rb +++ b/spec/system/facilitator_views_workshop_logs_test.rb @@ -7,7 +7,7 @@ Capybara.current_session.current_window.resize_to(1920, 5000) @user = create(:user) - create(:facilitator, user: @user) + create(:person, user: @user) windows_type = create(:windows_type, short_name: "COMBINED") form_builder = FormBuilder.create!(windows_type_id: windows_type.id, name: "The form") diff --git a/spec/system/facilitator_views_workshop_test.rb b/spec/system/facilitator_views_workshop_test.rb index 5734ef605..cfeb16c9e 100644 --- a/spec/system/facilitator_views_workshop_test.rb +++ b/spec/system/facilitator_views_workshop_test.rb @@ -5,7 +5,7 @@ context "When facilitator is logged in" do before do user = create(:user) - create(:facilitator, user: user) + create(:person, user: user) adult_window = create(:windows_type, :adult) @workshop_world = create(:workshop, title: 'The best workshop in the world', windows_type: adult_window) @workshop_mars = create(:workshop, title: 'The best workshop on mars', windows_type: adult_window, featured: true, objective: 'take everyone to mars', materials: 'rocket', setup: 'make a rocket')