diff --git a/Gemfile.lock b/Gemfile.lock index bf1443fef..cde1846d5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -133,7 +133,7 @@ GEM bigdecimal (4.0.1) bootsnap (1.21.1) msgpack (~> 1.2) - brakeman (8.0.1) + brakeman (8.0.2) racc builder (3.3.0) bullet (8.1.0) @@ -668,7 +668,7 @@ CHECKSUMS bigdecimal (4.0.1) sha256=8b07d3d065a9f921c80ceaea7c9d4ae596697295b584c296fe599dd0ad01c4a7 binding_of_caller (1.0.1) bootsnap (1.21.1) sha256=9373acfe732da35846623c337d3481af8ce77c7b3a927fb50e9aa92b46dbc4c4 - brakeman (8.0.1) sha256=c68ce0ac35a6295027c4eab8b4ac597d2a0bfc82f0d62dcd334bbf944d352f70 + brakeman (8.0.2) sha256=7b02065ce8b1de93949cefd3f2ad78e8eb370e644b95c8556a32a912a782426a builder (3.3.0) sha256=497918d2f9dca528fdca4b88d84e4ef4387256d984b8154e9d5d3fe5a9c8835f bullet (8.1.0) sha256=604b7e2636ec2137dcab3ba61a56248c39a0004a0c9405d58bad0686d23b98ff bundler-audit (0.9.3) sha256=81c8766c71e47d0d28a0f98c7eed028539f21a6ea3cd8f685eb6f42333c9b4e9 diff --git a/app/controllers/admin/analytics_controller.rb b/app/controllers/admin/analytics_controller.rb index 4ab57c745..1e02d86d5 100644 --- a/app/controllers/admin/analytics_controller.rb +++ b/app/controllers/admin/analytics_controller.rb @@ -14,7 +14,7 @@ def index @most_viewed_stories = decorate_with_counts(most_viewed_for_model(Story, time_scope), :view_count) @most_viewed_quotes = decorate_with_counts(most_viewed_for_model(Quote, time_scope), :view_count) @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_organizations = decorate_with_counts(most_viewed_for_model(Organization, 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) @@ -25,7 +25,7 @@ def index # @most_printed_workshop_variations = decorate_with_counts(most_printed_for_model(WorkshopVariation, time_scope), :print_count) # @most_printed_quotes = decorate_with_counts(most_printed_for_model(Quote, time_scope), :print_count) # @most_printed_tutorials = decorate_with_counts(most_printed_for_model(Tutorial, time_scope), :print_count) - # @most_printed_projects = decorate_with_counts(most_printed_for_model(Project, time_scope), :print_count) + # @most_printed_organizations = decorate_with_counts(most_printed_for_model(Organization, time_scope), :print_count) # @most_printed_events = decorate_with_counts(most_printed_for_model(Event, time_scope), :print_count) @most_downloaded_resources = decorate_with_counts(most_downloaded_for_model(Resource, time_scope), :download_count) @@ -67,9 +67,9 @@ def index views: view_count_for_model(Tutorial, time_scope), prints: print_count_for_model(Tutorial, time_scope) }, - projects: { - views: view_count_for_model(Project, time_scope), - prints: print_count_for_model(Project, time_scope) + organizations: { + views: view_count_for_model(Organization, time_scope), + prints: print_count_for_model(Organization, time_scope) }, facilitators: { views: view_count_for_model(Facilitator, time_scope) diff --git a/app/controllers/community_news_controller.rb b/app/controllers/community_news_controller.rb index 759b53138..e900d51e4 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, :organization, author: :facilitator ]) &.paginate(page: params[:page], per_page: per_page)&.decorate @count_display = if filtered.count == unfiltered.count @@ -79,7 +79,7 @@ def destroy # Optional hooks for setting variables for forms or index def set_form_variables - @organizations = Project.pluck(:name, :id).sort_by(&:first) + @organizations = Organization.pluck(:name, :id).sort_by(&:first) @authors = User.active.or(User.where(id: @community_news.author_id)) .map { |u| [ u.full_name, u.id ] }.sort_by(&:first) end @@ -95,7 +95,7 @@ def community_news_params params.require(:community_news).permit( :title, :rhino_body, :published, :featured, :public, :public_featured, :reference_url, :youtube_url, - :project_id, + :organization_id, :author_id, :created_by_id, :updated_by_id ) end diff --git a/app/controllers/facilitators_controller.rb b/app/controllers/facilitators_controller.rb index 55024e94f..7da35082b 100644 --- a/app/controllers/facilitators_controller.rb +++ b/app/controllers/facilitators_controller.rb @@ -7,7 +7,7 @@ def index facilitators = Facilitator .searchable .search_by_params(params.to_unsafe_h) - .includes(:user, :avatar_attachment, :sectorable_items, user: [ :avatar_attachment, :projects ]).references(:user) + .includes(:user, :avatar_attachment, :sectorable_items, user: [ :avatar_attachment, :organizations ]).references(:user) .order(:first_name, :last_name) @count_display = facilitators.size @facilitators = facilitators.paginate(page: params[:page], per_page: per_page) @@ -82,14 +82,14 @@ def set_form_variables # @facilitator.build_user if @facilitator.user.blank? # Build a fresh one if missing if @facilitator.user - @facilitator.user.project_users.first || @facilitator.user.project_users.build + @facilitator.user.organization_users.first || @facilitator.user.organization_users.build end - projects = if current_user.super_user? - Project.active + organizations = if current_user.super_user? + Organization.active else - current_user.projects + current_user.organizations end - @projects_array = projects.order(:name).pluck(:name, :id) + @organizations_array = organizations.order(:name).pluck(:name, :id) end @@ -177,9 +177,9 @@ def facilitator_params :state2, :zip2, :notes, - project_users_attributes: [ + organization_users_attributes: [ :id, - :project_id, + :organization_id, :position, :title, :inactive, diff --git a/app/controllers/monthly_reports_controller.rb b/app/controllers/monthly_reports_controller.rb index 1aff7c7e2..aed686694 100644 --- a/app/controllers/monthly_reports_controller.rb +++ b/app/controllers/monthly_reports_controller.rb @@ -38,7 +38,7 @@ def create @form_builder = FormBuilder.find(@report.owner_id) build_month_and_year load_agencies - @agency_id = report_params["project_id"] + @agency_id = report_params["organization_id"] flash[:alert] = "There was a problem submitting your form: " + "#{@report.errors.full_messages.join(" ")}" @@ -61,7 +61,7 @@ def edit build_month_and_year find_form_builder @report = Report.find(params[:id]) - @agencies = current_user.projects. + @agencies = current_user.organizations. where(windows_type_id: @report.windows_type_id) @month = @report.date.month @year = @report.date.year @@ -85,7 +85,7 @@ def update flash[:notice] = "Thanks for reporting on a update report. " redirect_to root_path else - @agencies = current_user.projects. + @agencies = current_user.organizations. where(windows_type_id: @report.windows_type_id) flash[:alert] = "ERROR!!!!!!!!!!!!!!" @@ -102,7 +102,7 @@ def show @answers = @monthly_report.report_form_field_answers if @monthly_report - if current_user.super_user? || (@monthly_report.project && current_user.project_ids.include?(@monthly_report.project.id)) + if current_user.super_user? || (@monthly_report.organization && current_user.organization_ids.include?(@monthly_report.organization.id)) render :show else redirect_to root_path, error: "You do not have permission to view this page." @@ -116,7 +116,7 @@ def show private def load_agencies - @agencies = current_user.projects. + @agencies = current_user.organizations. where(windows_type_id: @form_builder.windows_type_id).uniq end @@ -143,7 +143,7 @@ def find_form_builder .decorate end - agency = params[:agency_id] ? Project.find(params[:agency_id]) : current_user.projects.where(windows_type_id: @form_builder.windows_type).first + agency = params[:agency_id] ? Organization.find(params[:agency_id]) : current_user.organizations.where(windows_type_id: @form_builder.windows_type).first @agency_id = agency.id unless agency.nil? end @@ -196,7 +196,7 @@ def build_report_form_fields end def find_workshop_logs - @workshop_logs = current_user.project_monthly_workshop_logs( + @workshop_logs = current_user.organization_monthly_workshop_logs( @report.date, @report.windows_type ) @@ -207,7 +207,7 @@ def find_workshop_logs def find_combined_workshop_logs(agency_id) combined_windows_type = WindowsType.where(short_name: "COMBINED").first - @combined_workshop_logs = current_user.project_workshop_logs( + @combined_workshop_logs = current_user.organization_workshop_logs( @report.date, combined_windows_type, agency_id) end @@ -225,7 +225,7 @@ def report_params end params.require(:report).permit( - :type, :project_id, :date, :owner_id, :workshop_id, + :type, :organization_id, :date, :owner_id, :workshop_id, :owner_type, :windows_type_id, :other_description, media_files_attributes: [ :file ], report_form_field_answers_attributes: diff --git a/app/controllers/organization_statuses_controller.rb b/app/controllers/organization_statuses_controller.rb new file mode 100644 index 000000000..bf7441d60 --- /dev/null +++ b/app/controllers/organization_statuses_controller.rb @@ -0,0 +1,68 @@ +class OrganizationStatusesController < Admin::BaseController + before_action :set_organization_status, only: [ :show, :edit, :update, :destroy ] + + def index + per_page = params[:number_of_items_per_page].presence || 25 + unfiltered = OrganizationStatus.all + @count_display = unfiltered.count + @organization_statuses = unfiltered.paginate(page: params[:page], per_page: per_page).decorate + end + + def show + @organization_status = @organization_status.decorate + end + + def new + @organization_status = OrganizationStatus.new.decorate + set_form_variables + end + + def edit + @organization_status = @organization_status.decorate + set_form_variables + end + + def create + @organization_status = OrganizationStatus.new(organization_status_params) + + if @organization_status.save + redirect_to organization_statuses_path, notice: "Organization status was successfully created." + else + @organization_status = OrganizationStatus.new.decorate + set_form_variables + render :new, status: :unprocessable_content + end + end + + def update + if @organization_status.update(organization_status_params) + redirect_to organization_statuses_path, notice: "Organization status was successfully updated.", status: :see_other + else + @organization_status = OrganizationStatus.new.decorate + set_form_variables + render :edit, status: :unprocessable_content + end + end + + def destroy + @organization_status.destroy! + redirect_to organization_statuses_path, notice: "Organization status was successfully destroyed." + end + + # Optional hooks for setting variables for forms or index + def set_form_variables + end + + private + + def set_organization_status + @organization_status = OrganizationStatus.find(params[:id]) + end + + # Strong parameters + def organization_status_params + params.require(:organization_status).permit( + :name + ) + end +end diff --git a/app/controllers/organization_users_controller.rb b/app/controllers/organization_users_controller.rb new file mode 100644 index 000000000..400a3db27 --- /dev/null +++ b/app/controllers/organization_users_controller.rb @@ -0,0 +1,13 @@ +class OrganizationUsersController < ApplicationController + def destroy + organization_user = OrganizationUser.find(params[:id]) + user = organization_user.user + + if organization_user.destroy + flash[:notice] = "Organization user has been deleted." + else + flash[:alert] = "Unable to delete organization user. Please contact AWBW." + end + redirect_to generate_facilitator_user_path(user) + end +end diff --git a/app/controllers/projects_controller.rb b/app/controllers/organizations_controller.rb similarity index 56% rename from app/controllers/projects_controller.rb rename to app/controllers/organizations_controller.rb index 7138afcf1..bc38312b2 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -1,40 +1,39 @@ -class ProjectsController < ApplicationController +class OrganizationsController < ApplicationController include AhoyTracking - before_action :set_project, only: [ :show, :edit, :update, :destroy ] + before_action :set_organization, only: [ :show, :edit, :update, :destroy ] def index per_page = params[:number_of_items_per_page].presence || 25 - unpaginated = Project.includes(:logo_attachment, :windows_type, :project_status).search_by_params(params).order(:name) - @projects_count = unpaginated.count - @projects = unpaginated.paginate(page: params[:page], per_page: per_page) + unpaginated = Organization.includes(:logo_attachment, :windows_type, :organization_status) + .search_by_params(params).order(:name) + @organizations_count = unpaginated.count + @organizations = unpaginated.paginate(page: params[:page], per_page: per_page) set_index_variables end def show - track_view(@project) + track_view(@organization) - workshop_logs = WorkshopLog.where(project_id: @project.id) + workshop_logs = WorkshopLog.where(organization_id: @organization.id) @month_year_options = workshop_logs.group("DATE_FORMAT(COALESCE(date, created_at, NOW()), '%Y-%m')") - .select("DATE_FORMAT(COALESCE(date, created_at, NOW()), '%Y-%m') AS ym, + .select("DATE_FORMAT(COALESCE(date, created_at, NOW()), '%Y-%m') AS ym, MAX(COALESCE(date, created_at)) AS max_dt") - .order("max_dt DESC") - .map { |record| [ Date.strptime(record.ym, "%Y-%m").strftime("%B %Y"), record.ym ] } + .order("max_dt DESC") + .map { |record| [ Date.strptime(record.ym, "%Y-%m").strftime("%B %Y"), record.ym ] } @year_options = workshop_logs.pluck( Arel.sql("DISTINCT EXTRACT(YEAR FROM COALESCE(date, created_at, NOW()))") ).sort.reverse - @projects = Project.where(id: @project.id) + @organizations = Organization.where(id: @organization.id) @per_page = params[:per_page] || 10 @workshop_logs_unpaginated = workshop_logs @workshop_logs_count = @workshop_logs_unpaginated.size @workshop_logs = @workshop_logs_unpaginated.paginate(page: params[:page], per_page: @per_page) - user_ids = @workshop_logs_unpaginated.select(:user_id) - @workshops = Workshop.includes(:windows_type) .published .references(:windows_type) .order("workshops.title ASC, windows_types.name ASC") - + user_ids = @workshop_logs_unpaginated.select(:user_id) @facilitators = User.active .or(User.where(id: user_ids)) .distinct @@ -42,7 +41,7 @@ def show end def new - @project = Project.new + @organization = Organization.new set_form_variables end @@ -51,10 +50,10 @@ def edit end def create - @project = Project.new(project_params) + @organization = Organization.new(organization_params) - if @project.save - redirect_to projects_path, notice: "Organization was successfully created." + if @organization.save + redirect_to organizations_path, notice: "Organization was successfully created." else set_form_variables render :new, status: :unprocessable_content @@ -62,8 +61,8 @@ def create end def update - if @project.update(project_params) - redirect_to projects_path, notice: "Organization was successfully updated.", status: :see_other + if @organization.update(organization_params) + redirect_to organizations_path, notice: "Organization was successfully updated.", status: :see_other else set_form_variables render :edit, status: :unprocessable_content @@ -71,44 +70,43 @@ def update end def destroy - @project.destroy! - redirect_to projects_path, notice: "Organization was successfully destroyed." + @organization.destroy! + redirect_to organizations_path, notice: "Organization was successfully destroyed." end # Optional hooks for setting variables for forms or index def set_form_variables - @project_statuses = ProjectStatus.all - @facilitators_array = Facilitator.includes(:user) - .joins(:user) + @organization_statuses = OrganizationStatus.all + @facilitators_array = Facilitator.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 } + @organization.organization_users = @organization.organization_users + .includes(:organization) + .sort_by { |ou| ou.user.facilitator&.name.to_s.downcase } end def set_index_variables - @project_statuses = ProjectStatus.all + @organization_statuses = OrganizationStatus.all end private - def set_project - @project = Project.find(params[:id]) + def set_organization + @organization = Organization.find(params[:id]) end # Strong parameters - def project_params - params.require(:project).permit( + def organization_params + params.require(:organization).permit( :name, :description, :start_date, :end_date, :mission_vision_values, :internal_id, :inactive, :logo, :notes, :agency_type, :agency_type_other, :website_url, - :project_status_id, :location_id, :windows_type_id, + :organization_status_id, :location_id, :windows_type_id, sectorable_items_attributes: [ :id, :sector_id, :_destroy ], - project_users_attributes: [ + organization_users_attributes: [ :id, :user_id, :inactive, diff --git a/app/controllers/project_statuses_controller.rb b/app/controllers/project_statuses_controller.rb deleted file mode 100644 index c3abc4319..000000000 --- a/app/controllers/project_statuses_controller.rb +++ /dev/null @@ -1,68 +0,0 @@ -class ProjectStatusesController < Admin::BaseController - before_action :set_project_status, only: [ :show, :edit, :update, :destroy ] - - def index - per_page = params[:number_of_items_per_page].presence || 25 - unfiltered = ProjectStatus.all - @count_display = unfiltered.count - @project_statuses = unfiltered.paginate(page: params[:page], per_page: per_page).decorate - end - - def show - @project_status = @project_status.decorate - end - - def new - @project_status = ProjectStatus.new.decorate - set_form_variables - end - - def edit - @project_status = @project_status.decorate - set_form_variables - end - - def create - @project_status = ProjectStatus.new(project_status_params) - - if @project_status.save - redirect_to project_statuses_path, notice: "Project status was successfully created." - else - @project_status = ProjectStatus.new.decorate - set_form_variables - render :new, status: :unprocessable_content - end - end - - def update - if @project_status.update(project_status_params) - redirect_to project_statuses_path, notice: "Project status was successfully updated.", status: :see_other - else - @project_status = ProjectStatus.new.decorate - set_form_variables - render :edit, status: :unprocessable_content - end - end - - def destroy - @project_status.destroy! - redirect_to project_statuses_path, notice: "Project status was successfully destroyed." - end - - # Optional hooks for setting variables for forms or index - def set_form_variables - end - - private - - def set_project_status - @project_status = ProjectStatus.find(params[:id]) - end - - # Strong parameters - def project_status_params - params.require(:project_status).permit( - :name - ) - end -end diff --git a/app/controllers/project_users_controller.rb b/app/controllers/project_users_controller.rb deleted file mode 100644 index e0e7d535a..000000000 --- a/app/controllers/project_users_controller.rb +++ /dev/null @@ -1,13 +0,0 @@ -class ProjectUsersController < ApplicationController - def destroy - project_user = ProjectUser.find(params[:id]) - user = project_user.user - - if project_user.destroy - flash[:notice] = "Project user has been deleted." - else - flash[:alert] = "Unable to delete project user. Please contact AWBW." - end - redirect_to generate_facilitator_user_path(user) - end -end diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb index 0e75dac83..b52fcc83e 100644 --- a/app/controllers/reports_controller.rb +++ b/app/controllers/reports_controller.rb @@ -27,7 +27,7 @@ def share_story @report.owner_type = "FormBuilder" @report.owner_id = 7 - @agencies = current_user.projects + @agencies = current_user.organizations end def render_form @@ -46,7 +46,7 @@ def edit build_month_and_year find_form_builder @report = current_user.submitted_monthly_report(@date, @form_builder.windows_type) - @agencies = current_user.projects. + @agencies = current_user.organizations. where(windows_type_id: @report.windows_type_id) @month = @report.date.month @year = @report.date.year @@ -60,7 +60,7 @@ def edit_story .order(title: :asc) @report = Report.find(params[:id]) - @agencies = current_user.projects. + @agencies = current_user.organizations. where(windows_type_id: @report.windows_type_id) end @@ -79,7 +79,7 @@ def update_story flash[:notice] = "Thanks for reporting on a update report. " redirect_to root_path else - @agencies = current_user.projects. + @agencies = current_user.organizations. where(windows_type_id: @report.windows_type_id) flash[:alert] = "ERROR!!!!!!!!!!!!!!" @@ -105,7 +105,7 @@ def update flash[:notice] = "Thanks for reporting on a update report. " redirect_to root_path else - @agencies = current_user.projects. + @agencies = current_user.organizations. where(windows_type_id: @report.windows_type_id) flash[:alert] = "ERROR!!!!!!!!!!!!!!" @@ -159,7 +159,7 @@ def create_story @report.windows_type_id = Workshop.find(@report.workshop_id).windows_type_id else @report.workshop_id = nil - @report.windows_type_id = @report.project.windows_type_id + @report.windows_type_id = @report.organization.windows_type_id end if @report.save @@ -233,7 +233,7 @@ def build_report_form_fields end def find_workshop_logs - @workshop_logs = current_user.project_monthly_workshop_logs( + @workshop_logs = current_user.organization_monthly_workshop_logs( @report.date, @report.windows_type ) @@ -256,7 +256,7 @@ def report_params end params.require(:report).permit( - :image, :form_file, :type, :project_id, :date, :workshop_name, :owner_id, :workshop_id, + :image, :form_file, :type, :organization_id, :date, :workshop_name, :owner_id, :workshop_id, :owner_type, :windows_type_id, report_form_field_answers_attributes: [ :form_field_id, :answer_option_id, :answer, :_create ], media_files_attributes: [ :file ], diff --git a/app/controllers/stories_controller.rb b/app/controllers/stories_controller.rb index 63ca6e7ca..5f7042106 100644 --- a/app/controllers/stories_controller.rb +++ b/app/controllers/stories_controller.rb @@ -6,7 +6,7 @@ def index if turbo_frame_request? per_page = params[:number_of_items_per_page].presence || 12 unpaginated = current_user.super_user? ? Story.all : Story.published - filtered = unpaginated.includes(:windows_type, :project, :workshop, :created_by, :bookmarks, :primary_asset) + filtered = unpaginated.includes(:windows_type, :organization, :workshop, :created_by, :bookmarks, :primary_asset) .search_by_params(params) .order(created_at: :desc) @stories = filtered.paginate(page: params[:page], per_page: per_page).decorate @@ -90,7 +90,7 @@ def destroy def set_form_variables @story_idea = StoryIdea.find(params[:story_idea_id]) if params[:story_idea_id].present? @user = User.find(params[:user_id]) if params[:user_id].present? - @projects = (@user || current_user).projects.order(:name) + @organizations = (@user || current_user).organizations.order(:name) @story_ideas = StoryIdea.includes(:created_by) .references(:users) .order(:created_at) @@ -111,7 +111,7 @@ def set_story 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, + :windows_type_id, :organization_id, :workshop_id, :external_workshop_title, :created_by_id, :updated_by_id, :story_idea_id, :spotlighted_facilitator_id ) end @@ -119,7 +119,7 @@ def story_params def set_story_attributes_from(idea) { rhino_body: idea.body, - project_id: idea.project.id, + organization_id: idea.organization.id, workshop_id: idea.workshop_id, external_workshop_title: idea.external_workshop_title, windows_type_id: idea.windows_type_id, diff --git a/app/controllers/story_ideas_controller.rb b/app/controllers/story_ideas_controller.rb index ff58bfa9e..77dc75824 100644 --- a/app/controllers/story_ideas_controller.rb +++ b/app/controllers/story_ideas_controller.rb @@ -6,7 +6,7 @@ def index per_page = params[:number_of_items_per_page].presence || 25 - story_ideas = StoryIdea.includes(:windows_type, :project, :workshop, :created_by, :updated_by) + story_ideas = StoryIdea.includes(:windows_type, :organization, :workshop, :created_by, :updated_by) @story_ideas = story_ideas.order(created_at: :desc) .paginate(page: params[:page], per_page: per_page).decorate @@ -64,7 +64,7 @@ def destroy # Optional hooks for setting variables for forms or index def set_form_variables @user = User.find(params[:user_id]) if params[:user_id].present? - @projects = (@user || current_user).projects.order(:name) + @organizations = (@user || current_user).organizations.order(:name) @windows_types = WindowsType.all @workshops = Workshop.all.order(:title) @users = User.active.or(User.where(id: @story_idea.created_by_id)) @@ -82,7 +82,7 @@ def story_idea_params params.require(:story_idea).permit( :title, :body, :youtube_url, :permission_given, :publish_preferences, :promoted_to_story, - :windows_type_id, :project_id, :workshop_id, :external_workshop_title, + :windows_type_id, :organization_id, :workshop_id, :external_workshop_title, :created_by_id, :updated_by_id, ) end diff --git a/app/controllers/taggings_controller.rb b/app/controllers/taggings_controller.rb index c5c192d79..6252eb5f0 100644 --- a/app/controllers/taggings_controller.rb +++ b/app/controllers/taggings_controller.rb @@ -13,7 +13,7 @@ def index community_news: params[:community_news_page], events: params[:events_page], facilitators: params[:facilitators_page], - projects: params[:projects_page], + organizations: params[:organizations_page], quotes: params[:quotes_page] } diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 0419fbbac..4fa69bf00 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -153,13 +153,13 @@ def set_facilitator def set_form_variables set_facilitator - @user.project_users.first || @user.project_users.build - projects = if current_user.super_user? - Project.active + @user.organization_users.first || @user.organization_users.build + organizations = if current_user.super_user? + Organization.active else - current_user.projects + current_user.organizations end - @projects_array = projects.order(:name).pluck(:name, :id) + @organizations_array = organizations.order(:name).pluck(:name, :id) end def password_param @@ -178,7 +178,7 @@ def user_params :notes, :primary_address, :avatar, :subscribecode, :agency_id, :facilitator_id, :created_by_id, :updated_by_id, :confirmed, :inactive, :super_user, :legacy, :legacy_id, - project_users_attributes: [ :id, :project_id, :position, :title, :inactive, :_destroy ] + organization_users_attributes: [ :id, :organization_id, :position, :title, :inactive, :_destroy ] ) end end diff --git a/app/controllers/workshop_log_creation_wizard_controller.rb b/app/controllers/workshop_log_creation_wizard_controller.rb index b07a34106..bd8980769 100644 --- a/app/controllers/workshop_log_creation_wizard_controller.rb +++ b/app/controllers/workshop_log_creation_wizard_controller.rb @@ -6,7 +6,7 @@ class WorkshopLogCreationWizardController < ApplicationController def show @user = current_user - @agencies = current_user.projects + @agencies = current_user.organizations windows_type_id = params[:windows_type_id] || WindowsType.where(short_name: "COMBINED") @windows_type = WindowsType.find(windows_type_id) if windows_type_id send(step) @@ -15,7 +15,7 @@ def show def update @user = current_user - @agencies = current_user.projects + @agencies = current_user.organizations windows_type_id = params["workshop"]["workshop_logs_attributes"].values[0]["windows_type_id"] @windows_type = WindowsType.find(windows_type_id) send("update_#{step}") @@ -155,7 +155,7 @@ def workshop_params :title, :date, :windows_type_id, workshop_logs_attributes: [ :user_id, :rating, :reaction, :similarities, :is_embodied_art_workshop, :successes, :challenges, :differences, :date, - :suggestions, :questions, :lead_similar, :project_id, + :suggestions, :questions, :lead_similar, :organization_id, :num_participants_on_going, :num_participants_first_time, report_form_field_answers_attributes: [ :form_field_id, :answer_option_id, :answer, :_create ] diff --git a/app/controllers/workshop_logs_controller.rb b/app/controllers/workshop_logs_controller.rb index 888ac75d2..bef8e0228 100644 --- a/app/controllers/workshop_logs_controller.rb +++ b/app/controllers/workshop_logs_controller.rb @@ -9,7 +9,7 @@ def index WorkshopLog.all else WorkshopLog.where(created_by_id: current_user.id) - .or(WorkshopLog.project_id(current_user.project_ids)) + .or(WorkshopLog.organization_id(current_user.organization_ids)) end @workshop_logs_unpaginated = permitted_logs.includes(:workshop, :user, :windows_type) .search(params) @@ -83,7 +83,7 @@ def show @answers = @workshop_log.report_form_field_answers if @workshop_log - if current_user.super_user? || (@workshop_log.project && current_user.project_ids.include?(@workshop_log.project.id)) + if current_user.super_user? || (@workshop_log.organization && current_user.organization_ids.include?(@workshop_log.organization.id)) render :show else redirect_to root_path, error: "You do not have permission to view this page." @@ -104,7 +104,7 @@ def edit def validate_new @date = Date.new(params[:year].to_i, params[:month].to_i) @windows_type = WindowsType.find(params[:windows_type]) - @report = current_user.submitted_monthly_report(@date, @windows_type, params[:project_id]) + @report = current_user.submitted_monthly_report(@date, @windows_type, params[:organization_id]) render json: { validate: @report.nil? }.to_json end @@ -124,11 +124,11 @@ def set_index_variables # needs to not be private .joins(:workshop_logs) .distinct .order(:last_name, :first_name) - @projects = if current_user.super_user? - # Project.where(id: @workshop_logs_unpaginated.pluck(:project_id)).order(:name) - Project.active.order(:name) + @organizations = if current_user.super_user? + # Organization.where(id: @workshop_logs_unpaginated.pluck(:organization_id)).order(:name) + Organization.active.order(:name) else - current_user.projects.order(:name) + current_user.organizations.order(:name) end @workshops = Workshop.where(id: @workshop_logs_unpaginated.select(:workshop_id).distinct) .order(:title) @@ -182,11 +182,11 @@ def set_form_variables end @agencies = - Project.where(id: current_user.projects.select(:id)) - .or(Project.where(id: @workshop_log.project_id)) - .distinct - .order(:name) - agency = params[:agency_id].present? ? Project.where(id: params[:agency_id]).last : @agencies.first + Organization.where(id: current_user.organizations.select(:id)) + .or(Organization.where(id: @workshop_log.organization_id)) + .distinct + .order(:name) + agency = params[:agency_id].present? ? Organization.where(id: params[:agency_id]).last : @agencies.first @agency_id = agency.id if agency end @@ -210,7 +210,7 @@ def set_workshop def workshop_log_params params.require(:workshop_log).permit( :children_ongoing, :children_first_time, :teens_ongoing, :teens_first_time, - :adults_ongoing, :adults_first_time, :owner_id, :owner_type, :user_id, :project_id, :date, + :adults_ongoing, :adults_first_time, :owner_id, :owner_type, :user_id, :organization_id, :date, :workshop_name, :workshop_id, :windows_type_id, :other_description, # :user, quotable_item_quotes_attributes: [ :id, :quotable_type, :quotable_id, :_destroy, diff --git a/app/controllers/workshops_controller.rb b/app/controllers/workshops_controller.rb index 6b4bd05c9..6953dbcff 100644 --- a/app/controllers/workshops_controller.rb +++ b/app/controllers/workshops_controller.rb @@ -34,7 +34,7 @@ def summary types = reports.map do |r| r.windows_type end - @workshop_logs = current_user.project_monthly_workshop_logs( + @workshop_logs = current_user.organization_monthly_workshop_logs( reports.first.date, *types, ) @@ -43,7 +43,7 @@ def summary @total_first_time = logs.reduce(0) { |sum, l| sum += l.num_first_time } combined_windows_type = WindowsType.where(short_name: "COMBINED").first - @combined_workshop_logs = current_user.project_workshop_logs( + @combined_workshop_logs = current_user.organization_workshop_logs( @report.date, combined_windows_type, current_user.agency_id ) end diff --git a/app/decorators/facilitator_decorator.rb b/app/decorators/facilitator_decorator.rb index c0fb138b6..8ddbbabfb 100644 --- a/app/decorators/facilitator_decorator.rb +++ b/app/decorators/facilitator_decorator.rb @@ -4,7 +4,7 @@ def title end def detail(length: nil) - text = user.project_users.active.map { |pu| "#{pu.title.presence || pu.position}, #{pu.project.name}" }.join(", ") if user + text = user.organization_users.active.map { |pu| "#{pu.title.presence || pu.position}, #{pu.organization.name}" }.join(", ") if user length ? text&.truncate(length) : text end diff --git a/app/decorators/project_decorator.rb b/app/decorators/organization_decorator.rb similarity index 95% rename from app/decorators/project_decorator.rb rename to app/decorators/organization_decorator.rb index 4ac3de12a..7f8a76095 100644 --- a/app/decorators/project_decorator.rb +++ b/app/decorators/organization_decorator.rb @@ -1,4 +1,4 @@ -class ProjectDecorator < ApplicationDecorator +class OrganizationDecorator < ApplicationDecorator def detail(length: nil) length ? description&.truncate(length) : description end diff --git a/app/decorators/organization_status_decorator.rb b/app/decorators/organization_status_decorator.rb new file mode 100644 index 000000000..5c8d0ac80 --- /dev/null +++ b/app/decorators/organization_status_decorator.rb @@ -0,0 +1,3 @@ +class OrganizationStatusDecorator < Draper::Decorator + delegate_all +end diff --git a/app/decorators/organization_user_decorator.rb b/app/decorators/organization_user_decorator.rb new file mode 100644 index 000000000..ff7bd9386 --- /dev/null +++ b/app/decorators/organization_user_decorator.rb @@ -0,0 +1,5 @@ +class OrganizationUserDecorator < ApplicationDecorator + def detail(length: nil) + "#{user.full_name}: #{title.presence || position} - #{organization.name}" + end +end diff --git a/app/decorators/project_status_decorator.rb b/app/decorators/project_status_decorator.rb deleted file mode 100644 index b295e8491..000000000 --- a/app/decorators/project_status_decorator.rb +++ /dev/null @@ -1,3 +0,0 @@ -class ProjectStatusDecorator < Draper::Decorator - delegate_all -end diff --git a/app/decorators/project_user_decorator.rb b/app/decorators/project_user_decorator.rb deleted file mode 100644 index eeeb34ac7..000000000 --- a/app/decorators/project_user_decorator.rb +++ /dev/null @@ -1,5 +0,0 @@ -class ProjectUserDecorator < ApplicationDecorator - def detail(length: nil) - "#{user.full_name}: #{title.presence || position} - #{project.name}" - end -end diff --git a/app/decorators/workshop_decorator.rb b/app/decorators/workshop_decorator.rb index e04655de4..9d91fb57b 100644 --- a/app/decorators/workshop_decorator.rb +++ b/app/decorators/workshop_decorator.rb @@ -143,7 +143,7 @@ def labels_spanish creation_spanish: "Creación", closing_spanish: "Clausura", misc_instructions_spanish: "Instrucciones de misceláneos", - project_spanish: "Projecto", + organization_spanish: "Organización", description_spanish: "Descripción", notes_spanish: "Notas", tips_spanish: "Consejos", diff --git a/app/decorators/workshop_idea_decorator.rb b/app/decorators/workshop_idea_decorator.rb index 1a9d09081..477d7fd89 100644 --- a/app/decorators/workshop_idea_decorator.rb +++ b/app/decorators/workshop_idea_decorator.rb @@ -33,7 +33,7 @@ def labels_spanish creation_spanish: "Creación", closing_spanish: "Clausura", misc_instructions_spanish: "Instrucciones de misceláneos", - project_spanish: "Projecto", + organization_spanish: "Organización", description_spanish: "Descripción", notes_spanish: "Notas", tips_spanish: "Consejos" diff --git a/app/helpers/admin_cards_helper.rb b/app/helpers/admin_cards_helper.rb index aa91949e0..88e8f4792 100644 --- a/app/helpers/admin_cards_helper.rb +++ b/app/helpers/admin_cards_helper.rb @@ -13,7 +13,7 @@ def system_cards custom_card("Tagging counts", taggings_matrix_path, icon: "🧮", color: :lime), model_card(:resources, icon: "📚"), model_card(:workshops, icon: "🎨"), - model_card(:projects, icon: "🏫"), + model_card(:organizations, icon: "🏫"), model_card(:users, icon: "👥", title: "User accounts") ] end @@ -50,7 +50,7 @@ def reference_cards intensity: 100, title: "Service populations", params: { published_search: true }), - custom_card("Project statuses", project_statuses_path, icon: "🧮", color: :emerald, intensity: 100), + custom_card("Organization statuses", organization_statuses_path, icon: "🧮", color: :emerald, intensity: 100), custom_card("Windows types", windows_types_path, icon: "🪟") ] end diff --git a/app/models/bookmark.rb b/app/models/bookmark.rb index 80e6ee0bf..9bca85ad3 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", "Facilitator", "Organization", "Resource", "Story", "StoryIdea", "Workshop", "WorkshopIdea", "WorkshopLog", "WorkshopVariation" ] scope :for_workshops, -> { where(bookmarkable_type: "Workshop") } @@ -55,7 +55,7 @@ def self.sort_by_title 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 projects ON projects.id = bookmarks.bookmarkable_id AND bookmarks.bookmarkable_type = 'Project' + LEFT JOIN organizations ON organizations.id = bookmarks.bookmarkable_id AND bookmarks.bookmarkable_type = 'Organization' 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' LEFT JOIN story_ideas ON story_ideas.id = bookmarks.bookmarkable_id AND bookmarks.bookmarkable_type = 'StoryIdea' @@ -70,7 +70,7 @@ def self.sort_by_title community_news.title, events.title, CONCAT(facilitators.first_name, ' ', facilitators.last_name), - projects.name, + organizations.name, resources.title, stories.title, story_ideas.title, @@ -93,7 +93,7 @@ def self.title(title) 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 projects ON projects.id = bookmarks.bookmarkable_id AND bookmarks.bookmarkable_type = 'Project' + LEFT JOIN organizations ON organizations.id = bookmarks.bookmarkable_id AND bookmarks.bookmarkable_type = 'Organization' 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' LEFT JOIN story_ideas ON story_ideas.id = bookmarks.bookmarkable_id AND bookmarks.bookmarkable_type = 'StoryIdea' @@ -105,7 +105,7 @@ def self.title(title) 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 + facilitators.last_name LIKE :title OR organizations.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..2d330b541 100644 --- a/app/models/community_news.rb +++ b/app/models/community_news.rb @@ -1,7 +1,7 @@ class CommunityNews < ApplicationRecord include TagFilterable, Trendable, WindowsTypeFilterable, RichTextSearchable - belongs_to :project, optional: true + belongs_to :organization, optional: true belongs_to :windows_type, optional: true belongs_to :author, class_name: "User", optional: true belongs_to :created_by, class_name: "User" diff --git a/app/models/facilitator.rb b/app/models/facilitator.rb index 51e4834ea..6ce5f5614 100644 --- a/app/models/facilitator.rb +++ b/app/models/facilitator.rb @@ -57,10 +57,10 @@ class Facilitator < ApplicationRecord scope :published, -> { active.searchable } scope :published, ->(published = nil) { published ? active.searchable(published) : active.searchable } scope :searchable, ->(searchable = nil) { searchable ? where(profile_is_searchable: searchable) : where(profile_is_searchable: true) } - scope :project_name, ->(project_name) { - return all if project_name.blank? - left_joins(user: { project_users: :project }) - .where("projects.name LIKE ?", "%#{sanitize_sql_like(project_name)}%") + scope :organization_name, ->(organization_name) { + return all if organization_name.blank? + left_joins(user: { organization_users: :organization }) + .where("organizations.name LIKE ?", "%#{sanitize_sql_like(organization_name)}%") .distinct } scope :category_names, ->(names) { tag_names(:categories, names) } scope :sector_names, ->(names) { tag_names(:sectors, names) } @@ -70,7 +70,7 @@ def self.search_by_params(params) results = results.search(params[:contact_info]) if params[:contact_info].present? results = results.sector_names(params[:sector_names]) if params[:sector_names].present? results = results.sector_names(params[:category_names]) if params[:category_names].present? - results = results.project_name(params[:project_name]) if params[:project_name].present? + results = results.organization_name(params[:organization_name]) if params[:organization_name].present? results = results.windows_type_name(params[:windows_type_name]) if params[:windows_type_name].present? results end diff --git a/app/models/project.rb b/app/models/organization.rb similarity index 67% rename from app/models/project.rb rename to app/models/organization.rb index febe5528c..50fe80d1a 100644 --- a/app/models/project.rb +++ b/app/models/organization.rb @@ -1,14 +1,14 @@ -class Project < ApplicationRecord +class Organization < ApplicationRecord include TagFilterable, Trendable, WindowsTypeFilterable - belongs_to :project_status - belongs_to :project_obligation, optional: true + belongs_to :organization_status + belongs_to :organization_obligation, optional: true belongs_to :location, optional: true # TODO - remove Location if unused belongs_to :windows_type, optional: true has_many :addresses, as: :addressable, dependent: :destroy has_many :bookmarks, as: :bookmarkable, dependent: :destroy - has_many :project_users, dependent: :restrict_with_error - has_many :users, through: :project_users + has_many :organization_users, dependent: :restrict_with_error + has_many :users, through: :organization_users has_many :reports, through: :users has_many :workshop_logs, through: :users @@ -26,12 +26,12 @@ class Project < ApplicationRecord content_type: %w[image/png image/jpeg image/webp], size: { less_than: 5.megabytes } validates :name, presence: true - validates :project_status_id, presence: true + validates :organization_status_id, presence: true # Nested attributes accepts_nested_attributes_for :addresses, allow_destroy: true, reject_if: :all_blank accepts_nested_attributes_for :sectorable_items, allow_destroy: true, reject_if: :all_blank - accepts_nested_attributes_for :project_users, allow_destroy: true, reject_if: :all_blank + accepts_nested_attributes_for :organization_users, allow_destroy: true, reject_if: :all_blank # SearchCop include SearchCop @@ -60,20 +60,21 @@ class Project < ApplicationRecord wildcard: wildcard, exact: exact) end scope :active, ->(active = nil) { active ? where(inactive: !active) : where(inactive: false) } - scope :project_ids, ->(project_ids) { where(id: project_ids.to_s.split("-").map(&:to_i)) } + scope :by_most_viewed, ->(limit = 10) { order(view_count: :desc).limit(limit) } + scope :organization_ids, ->(organization_ids) { where(id: organization_ids.to_s.split("-").map(&:to_i)) } scope :published, ->(published = nil) { published ? active(published) : active } scope :category_names, ->(names) { tag_names(:categories, names) } scope :sector_names, ->(names) { tag_names(:sectors, names) } def self.search_by_params(params) - projects = self.all - projects = projects.search(params[:query]) if params[:query].present? - projects = projects.sector_names(params[:sector_names]) if params[:sector_names].present? - projects = projects.category_names(params[:category_names]) if params[:category_names].present? - projects = projects.address(params[:address]) if params[:address].present? - projects = projects.windows_type_name(params[:windows_type_name]) if params[:windows_type_name].present? - projects = projects.project_ids(params[:project_ids]) if params[:project_ids].present? - projects + organizations = self.all + organizations = organizations.search(params[:query]) if params[:query].present? + organizations = organizations.sector_names(params[:sector_names]) if params[:sector_names].present? + organizations = organizations.category_names(params[:category_names]) if params[:category_names].present? + organizations = organizations.address(params[:address]) if params[:address].present? + organizations = organizations.windows_type_name(params[:windows_type_name]) if params[:windows_type_name].present? + organizations = organizations.organization_ids(params[:organization_ids]) if params[:organization_ids].present? + organizations end # Methods @@ -101,6 +102,6 @@ def sector_list private def leader - project_users.find_by(position: 2) + organization_users.find_by(position: 2) end end diff --git a/app/models/project_obligation.rb b/app/models/organization_obligation.rb similarity index 79% rename from app/models/project_obligation.rb rename to app/models/organization_obligation.rb index 0eed854e9..2203d1df7 100644 --- a/app/models/project_obligation.rb +++ b/app/models/organization_obligation.rb @@ -1,4 +1,4 @@ -class ProjectObligation < ApplicationRecord +class OrganizationObligation < ApplicationRecord OBLIGATION_TYPES = [ "Current Grant Funded", "Previous Grant Funded", "Voluntary Reporting", "Intermittent Reporting", "Active Non-Reporting" ] diff --git a/app/models/organization_status.rb b/app/models/organization_status.rb new file mode 100644 index 000000000..fde753171 --- /dev/null +++ b/app/models/organization_status.rb @@ -0,0 +1,7 @@ +class OrganizationStatus < ApplicationRecord + ORGANIZATION_STATUSES = [ "Active", "Inactive", "Pending", "Reinstate", "Suspended", "Unknown" ] + + has_many :organizations + + validates :name, presence: true, uniqueness: true +end diff --git a/app/models/project_user.rb b/app/models/organization_user.rb similarity index 63% rename from app/models/project_user.rb rename to app/models/organization_user.rb index 8e9716f74..e41e72dee 100644 --- a/app/models/project_user.rb +++ b/app/models/organization_user.rb @@ -1,10 +1,9 @@ -class ProjectUser < ApplicationRecord - belongs_to :project +class OrganizationUser < ApplicationRecord + belongs_to :organization belongs_to :user # Validations - validates_presence_of :project_id - validates_presence_of :title + validates_presence_of :organization_id # Enum enum :position, { default: 0, liaison: 1, leader: 2, assistant: 3 } diff --git a/app/models/project_status.rb b/app/models/project_status.rb deleted file mode 100644 index 0e1d6a949..000000000 --- a/app/models/project_status.rb +++ /dev/null @@ -1,7 +0,0 @@ -class ProjectStatus < ApplicationRecord - PROJECT_STATUSES = [ "Active", "Inactive", "Pending", "Reinstate", "Suspended", "Unknown" ] - - has_many :projects - - validates :name, presence: true, uniqueness: true -end diff --git a/app/models/report.rb b/app/models/report.rb index a569d5851..a7261d851 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -1,7 +1,7 @@ class Report < ApplicationRecord belongs_to :owner, polymorphic: true, optional: true belongs_to :user - belongs_to :project + belongs_to :organization belongs_to :windows_type has_one :form, as: :owner has_many :bookmarks, as: :bookmarkable, dependent: :destroy @@ -152,8 +152,8 @@ def set_has_attachment end def set_windows_type - return unless project && windows_type.nil? - update(windows_type_id: project.windows_type.id) + return unless organization && windows_type.nil? + update(windows_type_id: organization.windows_type.id) end def create_notification diff --git a/app/models/story.rb b/app/models/story.rb index 6320c1a9b..35072ba95 100644 --- a/app/models/story.rb +++ b/app/models/story.rb @@ -4,7 +4,7 @@ class Story < ApplicationRecord belongs_to :created_by, class_name: "User" belongs_to :updated_by, class_name: "User" belongs_to :windows_type - belongs_to :project, optional: true + belongs_to :organization, optional: true belongs_to :spotlighted_facilitator, class_name: "Facilitator", foreign_key: "spotlighted_facilitator_id", optional: true belongs_to :story_idea, optional: true @@ -73,15 +73,15 @@ def name end def organization_name - project&.name + organization&.name end def organization_locality - project&.organization_locality + organization&.organization_locality end def organization_description - project&.organization_description + organization&.organization_description end def attach_assets_from_idea! diff --git a/app/models/story_idea.rb b/app/models/story_idea.rb index 757b79390..fe37ea1d5 100644 --- a/app/models/story_idea.rb +++ b/app/models/story_idea.rb @@ -7,7 +7,7 @@ class StoryIdea < ApplicationRecord belongs_to :created_by, class_name: "User" belongs_to :updated_by, class_name: "User" - belongs_to :project + belongs_to :organization belongs_to :windows_type belongs_to :workshop, optional: true has_many :bookmarks, as: :bookmarkable, dependent: :destroy @@ -23,7 +23,7 @@ class StoryIdea < ApplicationRecord # Validations validates :created_by_id, presence: true validates :updated_by_id, presence: true - validates :project_id, presence: true + validates :organization_id, presence: true validates :windows_type_id, presence: true validates :body, presence: true validates :permission_given, presence: true @@ -57,14 +57,14 @@ def author_credit end def organization_name - project.name + organization.name end def organization_locality - project&.organization_locality + organization&.organization_locality end def organization_description - project&.organization_description + organization&.organization_description end end diff --git a/app/models/tag.rb b/app/models/tag.rb index e2d60052e..afbb6b258 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -30,10 +30,10 @@ class Tag path: -> { Rails.application.routes.url_helpers.facilitators_path }, klass: Facilitator }, - projects: { + organizations: { icon: "🏫", - path: -> { Rails.application.routes.url_helpers.projects_path }, - klass: ::Project + path: -> { Rails.application.routes.url_helpers.organizations_path }, + klass: Organization }, quotes: { icon: "💬", diff --git a/app/models/user.rb b/app/models/user.rb index 4c9fa87d9..b86f1c8df 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -14,7 +14,7 @@ class User < ApplicationRecord has_many :bookmarks, dependent: :destroy has_many :event_registrations, foreign_key: :registrant_id, dependent: :destroy has_many :notifications, as: :noticeable - has_many :project_users, dependent: :destroy + has_many :organization_users, dependent: :destroy has_many :reports has_many :resources has_many :user_forms, dependent: :destroy @@ -32,30 +32,30 @@ class User < ApplicationRecord has_many :bookmarked_workshops, through: :bookmarks, source: :bookmarkable, source_type: "Workshop" has_many :bookmarked_resources, through: :bookmarks, source: :bookmarkable, source_type: "Resource" has_many :bookmarked_events, through: :bookmarks, source: :bookmarkable, source_type: "Event" - has_many :colleagues, -> { select(:user_id, :position, :project_id).distinct }, - through: :projects, source: :project_users - has_many :communal_reports, through: :projects, source: :reports + has_many :colleagues, -> { select(:user_id, :position, :organization_id).distinct }, + through: :organizations, source: :organization_users + has_many :communal_reports, through: :organizations, source: :reports has_many :events, through: :event_registrations - has_many :projects, through: :project_users + has_many :organizations, through: :organization_users has_many :user_form_form_fields, through: :user_forms, dependent: :destroy - has_many :windows_types, through: :projects + has_many :windows_types, through: :organizations # Images has_one_attached :avatar # Nested attributes accepts_nested_attributes_for :user_forms - accepts_nested_attributes_for :project_users, allow_destroy: true, - reject_if: proc { |attrs| attrs["project_id"].blank? && attrs["title"].blank? } + accepts_nested_attributes_for :organization_users, allow_destroy: true, + reject_if: proc { |attrs| attrs["organization_id"].blank? || attrs["title"].blank? } # Validations validates :email, presence: true, uniqueness: { case_sensitive: false } - validates_associated :project_users + validates_associated :organization_users # Search Cop include SearchCop search_scope :search do attributes [ :email, :first_name, :last_name, :phone ] - attributes user: "projects.name" + attributes user: "organizations.name" end scope :active, -> { where(inactive: false) } @@ -72,8 +72,8 @@ def admin? super_user end - def has_liasion_position_for?(project_id) - !project_users.where(project_id: project_id, position: 1).first.nil? + def has_liasion_position_for?(organization_id) + !organization_users.where(organization_id: organization_id, position: 1).first.nil? end def active_for_authentication? @@ -100,8 +100,8 @@ def devise_email_name facilitator&.first_name.presence || first_name.presence || email end - def submitted_monthly_report(submitted_date = Date.today, windows_type, project_id) - Report.where(project_id: project_id, type: "MonthlyReport", date: submitted_date, + def submitted_monthly_report(submitted_date = Date.today, windows_type, organization_id) + Report.where(organization_id: organization_id, type: "MonthlyReport", date: submitted_date, windows_type: windows_type).last end @@ -123,11 +123,11 @@ def recent_activity(activity_limit = 10) recent.sort_by { |item| item.try(:updated_at) || item.created_at }.reverse.first(activity_limit * 8) end - def project_monthly_workshop_logs(date, *windows_type) + def organization_monthly_workshop_logs(date, *windows_type) where = windows_type.map { |wt| "windows_type_id = ?" } - logs = projects.map do |project| - project.workshop_logs.where(where.join(" OR "), *windows_type) + logs = organizations.map do |organization| + organization.workshop_logs.where(where.join(" OR "), *windows_type) end.flatten logs = logs.select do |log| log.date && log.date.month == date.month.to_i && @@ -136,9 +136,9 @@ def project_monthly_workshop_logs(date, *windows_type) logs.uniq.group_by { |log| log.date } end - def project_workshop_logs(date, windows_type, project_id) - if project_id - logs = workshop_logs.where(project_id: project_id, windows_type_id: windows_type.id) + def organization_workshop_logs(date, windows_type, organization_id) + if organization_id + logs = workshop_logs.where(organization_id: organization_id, windows_type_id: windows_type.id) logs = logs.select do |log| log.date && log.date.month == date.month.to_i && log.date.year == date.year.to_i diff --git a/app/models/workshop_log.rb b/app/models/workshop_log.rb index 9bab0523a..cb7b80d66 100644 --- a/app/models/workshop_log.rb +++ b/app/models/workshop_log.rb @@ -14,7 +14,7 @@ class WorkshopLog < Report # Scopes scope :workshop_id, ->(workshop_id) { where(workshop_id: workshop_id) if workshop_id.present? } - scope :project_id, ->(project_id) { where(project_id: project_id) if project_id.present? } + scope :organization_id, ->(organization_id) { where(organization_id: organization_id) if organization_id.present? } scope :user_id, ->(user_id) { where(user_id: user_id.to_i) if user_id.present? } scope :month_and_year, ->(month_and_year) { if month_and_year.present? @@ -34,7 +34,7 @@ def self.search(params) logs = logs.month_and_year(params[:month_and_year]) if params[:month_and_year].present? logs = logs.year(params[:year]) if params[:year].present? logs = logs.workshop_id(params[:workshop_id]) if params[:workshop_id].present? - logs = logs.project_id(params[:project_id]) if params[:project_id].present? + logs = logs.organization_id(params[:organization_id]) if params[:organization_id].present? logs.ordered_by_date end diff --git a/app/services/facilitator_from_user_service.rb b/app/services/facilitator_from_user_service.rb index 1e6976817..e1c57a69c 100644 --- a/app/services/facilitator_from_user_service.rb +++ b/app/services/facilitator_from_user_service.rb @@ -12,7 +12,7 @@ def call hydrate_facilitator hydrate_addresses hydrate_contact_methods - hydrate_projects + hydrate_organizations facilitator end @@ -30,7 +30,7 @@ def hydrate_facilitator ) end - def hydrate_projects + def hydrate_organizations # t.integer "agency_id" end diff --git a/app/services/tagging_search_service.rb b/app/services/tagging_search_service.rb index 0c3eabfe7..1f4a35bde 100644 --- a/app/services/tagging_search_service.rb +++ b/app/services/tagging_search_service.rb @@ -61,13 +61,13 @@ def self.call(sector_names:, category_names: nil, .paginate(page: pages[:facilitators] || 1, per_page: number_of_items_per_page) .decorate, - projects: Project + organizations: Organization .includes(:sectors) .published .sector_names(sector_names) .category_names(category_names) .order(:name) - .paginate(page: pages[:projects] || 1, per_page: number_of_items_per_page) + .paginate(page: pages[:organizations] || 1, per_page: number_of_items_per_page) .decorate, quotes: Quote diff --git a/app/views/admin/analytics/index.html.erb b/app/views/admin/analytics/index.html.erb index 67a2638a1..101354e1d 100644 --- a/app/views/admin/analytics/index.html.erb +++ b/app/views/admin/analytics/index.html.erb @@ -162,11 +162,11 @@ <%= render "admin/analytics/popular_list", - title: "Projects", - records: @most_viewed_projects, - path_method: :project_path, + title: "Organizations", + records: @most_viewed_organizations, + path_method: :organization_path, metric: :view_count, - color: :projects + color: :organizations %> diff --git a/app/views/community_news/_community_news_results.html.erb b/app/views/community_news/_community_news_results.html.erb index b5f8d60df..efc60fbef 100644 --- a/app/views/community_news/_community_news_results.html.erb +++ b/app/views/community_news/_community_news_results.html.erb @@ -6,7 +6,7 @@ Title Author - Project + Organization Updated Actions @@ -41,7 +41,7 @@ <%= news.author&.full_name || "—" %> - <%= news.project&.name || "—" %> + <%= news.organization&.name || "—" %> <%= news.updated_at.strftime("%b %d, %Y") %> @@ -75,9 +75,9 @@ <% if current_user.super_user? %>
- <%= link_to "Create a post", - new_community_news_path, - class: "btn btn-primary" %> + <%= link_to "Create a community news", + new_community_news_path, + class: "btn btn-primary" %>
<% end %> diff --git a/app/views/community_news/_form.html.erb b/app/views/community_news/_form.html.erb index ed1ba1048..aa8428318 100644 --- a/app/views/community_news/_form.html.erb +++ b/app/views/community_news/_form.html.erb @@ -37,12 +37,12 @@
- <%= f.input :project_id, + <%= f.input :organization_id, as: :select, label: "Organization", required: false, collection: @organizations, - selected: f.object.project_id, + selected: f.object.organization_id, input_html: { class: "block w-full rounded-md border-gray-300 shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm" } %> <%= f.input :author_id, diff --git a/app/views/community_news/_results_skeleton.html.erb b/app/views/community_news/_results_skeleton.html.erb index e73f60884..6b23fda73 100644 --- a/app/views/community_news/_results_skeleton.html.erb +++ b/app/views/community_news/_results_skeleton.html.erb @@ -50,7 +50,7 @@
- +
diff --git a/app/views/community_news/index.html.erb b/app/views/community_news/index.html.erb index 44d4d9ffa..8017c2a6e 100644 --- a/app/views/community_news/index.html.erb +++ b/app/views/community_news/index.html.erb @@ -7,7 +7,7 @@
<% if current_user.super_user? %> - <%= link_to "New Post", + <%= link_to "New community news", new_community_news_path, class: "admin-only bg-blue-100 btn btn-primary-outline" %> <% end %> @@ -20,8 +20,12 @@ <% result_src = community_news_index_path + "?" + request.query_string %> - <%= turbo_frame_tag "community_news_results", src: result_src do %> - <%= render "results_skeleton" %> + <% if turbo_frame_request? %> + <%= render "community_news_results" %> + <% else %> + <%= turbo_frame_tag "community_news_results", src: result_src do %> + <%= render "results_skeleton" %> + <% end %> <% end %>
diff --git a/app/views/community_news/show.html.erb b/app/views/community_news/show.html.erb index 68ece7f22..7ce096730 100644 --- a/app/views/community_news/show.html.erb +++ b/app/views/community_news/show.html.erb @@ -35,7 +35,7 @@

By: <%= @community_news.created_by.full_name %>

-

Organization Name: <%= @community_news.project&.name %>

+

Organization Name: <%= @community_news.organization&.name %>

diff --git a/app/views/facilitators/_form.html.erb b/app/views/facilitators/_form.html.erb index 205370c22..df104e436 100644 --- a/app/views/facilitators/_form.html.erb +++ b/app/views/facilitators/_form.html.erb @@ -154,27 +154,27 @@
<% if current_user.super_user? %>
- <%= u.fields_for :project_users do |project_user_form| %> - <%= render "project_user_fields", - f: project_user_form, - projects: u.object.projects, + <%= u.fields_for :organization_users do |organization_user_form| %> + <%= render "organization_user_fields", + f: organization_user_form, + organizations: u.object.organizations, user: u.object %> <% end %>
<%= link_to_add_association "➕ Add Role", u, - :project_users, - html_options: { locals: { projects: u.object.projects } }, + :organization_users, + html_options: { locals: { organizations: u.object.organizations } }, class: "btn btn-secondary-outline" %>
<% else %> - <% f.object.user && f.object.user.project_users.each do |pu| %> + <% f.object.user && f.object.user.organization_users.each do |ou| %>
-
  • <%= pu.title || pu.position %> - <%= pu.persisted? ? (link_to pu.project&.name, - project_path(pu.project), - class: "underline") : pu.project&.name %>
  • +
  • <%= ou.title || ou.position %> - <%= ou.persisted? ? (link_to ou.organization&.name, + organization_path(ou.organization), + class: "underline") : ou.organization&.name %>
  • <% end %> <% end %> diff --git a/app/views/facilitators/_project_user_fields.html.erb b/app/views/facilitators/_organization_user_fields.html.erb similarity index 85% rename from app/views/facilitators/_project_user_fields.html.erb rename to app/views/facilitators/_organization_user_fields.html.erb index 3b88de27f..36f7ac856 100644 --- a/app/views/facilitators/_project_user_fields.html.erb +++ b/app/views/facilitators/_organization_user_fields.html.erb @@ -2,11 +2,11 @@
    - <%= f.input :project_id, + <%= f.input :organization_id, as: :select, label: "Organization", - collection: @projects_array, - selected: f.object.project_id, + collection: @organizations_array, + selected: f.object.organization_id, input_html: { class: "block w-full rounded-md border-gray-300 focus:ring-blue-500 focus:border-blue-500" }, @@ -40,6 +40,6 @@
    <% else %>
    -
  • <%= f.object.project&.name %> (<%= f.object.title || f.object.position %>)
  • +
  • <%= f.object.organization&.name %> (<%= f.object.title || f.object.position %>)
  • <% end %> diff --git a/app/views/facilitators/_search_boxes.html.erb b/app/views/facilitators/_search_boxes.html.erb index ac3a7d45f..928170e11 100644 --- a/app/views/facilitators/_search_boxes.html.erb +++ b/app/views/facilitators/_search_boxes.html.erb @@ -34,11 +34,11 @@
    - +
    - <%= label_tag :project_name, "Organization", class: "block text-sm font-medium text-gray-700 mb-1" %> + <%= label_tag :organization_name, "Organization", class: "block text-sm font-medium text-gray-700 mb-1" %>
    - <%= text_field_tag :project_name, params[:project_name], + <%= text_field_tag :organization_name, params[:organization_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: "", diff --git a/app/views/facilitators/index.html.erb b/app/views/facilitators/index.html.erb index 32f2876d0..87071fc60 100644 --- a/app/views/facilitators/index.html.erb +++ b/app/views/facilitators/index.html.erb @@ -58,10 +58,10 @@ - <% if facilitator.user&.projects&.any? %> - <% user_project_names = facilitator.user.projects.map(&:name).join(", ") %> - - <%= truncate(user_project_names, length: 120) %> + <% if facilitator.user&.organizations&.any? %> + <% user_organization_names = facilitator.user.organizations.map(&:name).join(", ") %> + + <%= truncate(user_organization_names, length: 120) %> <% else %> -- diff --git a/app/views/facilitators/show.html.erb b/app/views/facilitators/show.html.erb index 6164b4b89..6402e5768 100644 --- a/app/views/facilitators/show.html.erb +++ b/app/views/facilitators/show.html.erb @@ -82,14 +82,14 @@ <% if @facilitator.profile_show_affiliations? %>

    Organizational affiliations

    - <% if @facilitator.user && @facilitator.user.project_users.active.any? %> + <% if @facilitator.user && @facilitator.user.organization_users.active.any? %>
      - <% @facilitator.user.project_users.active.each do |pu| %> + <% @facilitator.user.organization_users.active.each do |pu| %>
    • <% if pu.title.present? || pu.position.present? %> <%= pu.title.presence || pu.position.humanize %> - <% end %> - <%= link_to pu.project.name, project_path(pu.project), + <%= link_to pu.organization.name, organization_path(pu.organization), class: "text-blue-600 hover:underline font-medium" %>
    • <% end %> diff --git a/app/views/monthly_reports/_form.html.erb b/app/views/monthly_reports/_form.html.erb index f07e622ff..03fc79edd 100644 --- a/app/views/monthly_reports/_form.html.erb +++ b/app/views/monthly_reports/_form.html.erb @@ -71,7 +71,7 @@
      Please contact AWBW if your agency is not listed.
    <% agency = @agencies.find_by(windows_type_id: f.object.windows_type.id) %> - <%= f.collection_select :project_id, @agencies, :id, :name, + <%= f.collection_select :organization_id, @agencies, :id, :name, { selected: agency ? agency.id : nil,class: 'js-agency-select' }, class:"selectpicker form-control form-control-custom", onchange: "window.location = $.replaceUrlParam(window.location.toString(),'agency_id',$(this).val() )" %>
    @@ -261,7 +261,7 @@ if ($.urlParam('agency_id') != null){ - $("#report_project_id").val("<%=params[:agency_id] %>"); + $("#report_organization_id").val("<%=params[:agency_id] %>"); } function validateOptions(event, div_id, input_type) { diff --git a/app/views/monthly_reports/edit.html.erb b/app/views/monthly_reports/edit.html.erb index ee76f120e..fe22dca49 100644 --- a/app/views/monthly_reports/edit.html.erb +++ b/app/views/monthly_reports/edit.html.erb @@ -54,9 +54,9 @@ A monthly report has already been submitted for this month. Please contact your
    Please contact AWBW if your agency is not listed.
    <% agency = @agency_id %> - <%= f.collection_select :project_id, @agencies, :id, :name, + <%= f.collection_select :organization_id, @agencies, :id, :name, { selected: agency, class: 'js-agency-select' }, - class:"selectpicker form-control form-control-custom", onchange: 'redirectToNewProject()' %> + class:"selectpicker form-control form-control-custom", onchange: 'redirectToNewOrganization()' %> <%= render 'sectorable_items' %> @@ -238,7 +238,7 @@ A monthly report has already been submitted for this month. Please contact your }); - $('#report_project_id').on("change", function(){ + $('#report_organization_id').on("change", function(){ var agency_id = this.value; var year = <%= @year %>; var month = <%= @month %>; @@ -248,7 +248,7 @@ A monthly report has already been submitted for this month. Please contact your }); $("#edit_report :input").attr("disabled", true); - $("#report_project_id").attr("disabled", false); + $("#report_organization_id").attr("disabled", false); $("#report_date").attr("disabled", false); fillOutDates(); diff --git a/app/views/monthly_reports/new.html.erb b/app/views/monthly_reports/new.html.erb index 3cc976a7e..43a025857 100644 --- a/app/views/monthly_reports/new.html.erb +++ b/app/views/monthly_reports/new.html.erb @@ -42,6 +42,6 @@ <% else %> $("#new_report :input").attr("disabled", true); $("#report_date").attr("disabled", false); - $("#report_project_id").attr("disabled", false); + $("#report_organization_id").attr("disabled", false); <% end %> diff --git a/app/views/monthly_reports/show.html.erb b/app/views/monthly_reports/show.html.erb index 0b5f73d51..1d76a37bb 100644 --- a/app/views/monthly_reports/show.html.erb +++ b/app/views/monthly_reports/show.html.erb @@ -24,7 +24,7 @@

    Facilitator: <%= @monthly_report.user&.name || "—" %>

    -

    Organization: <%= @monthly_report.project&.name || "—" %>

    +

    Organization: <%= @monthly_report.organization&.name || "—" %>

    Report date: <%= @monthly_report.date&.strftime("%B %d, %Y") || "—" %>

    diff --git a/app/views/project_statuses/_form.html.erb b/app/views/organization_statuses/_form.html.erb similarity index 60% rename from app/views/project_statuses/_form.html.erb rename to app/views/organization_statuses/_form.html.erb index a69ea4067..22afb4ff3 100644 --- a/app/views/project_statuses/_form.html.erb +++ b/app/views/organization_statuses/_form.html.erb @@ -1,12 +1,12 @@ -<%= simple_form_for(@project_status) do |f| %> +<%= simple_form_for(@organization_status) do |f| %>
    <%= f.error_notification %> - <%= render "shared/errors", resource: @project_status if @project_status.errors.any? %> + <%= render "shared/errors", resource: @organization_status if @organization_status.errors.any? %>
    - <% @project_status.attribute_names.reject { |a| ["id", "created_at", "updated_at"].include?(a) }.each do |attr| %> + <% @organization_status.attribute_names.reject { |a| ["id", "created_at", "updated_at"].include?(a) }.each do |attr| %> <% next if ["id", "created_at", "updated_at"].include?(attr) %>
    <%= f.input attr.to_sym, input_html: { class: "form-control" } %> @@ -16,11 +16,11 @@
    - <% if @project_status.persisted? && current_user.super_user? %> - <%= link_to "Delete", @project_status, method: :delete, + <% if @organization_status.persisted? && current_user.super_user? %> + <%= link_to "Delete", @organization_status, method: :delete, class: "btn btn-danger-outline", data: { confirm: "Are you sure?" } %> <% end %> - <%= link_to "Cancel", project_statuses_path, class: "btn btn-secondary-outline" %> + <%= link_to "Cancel", organization_statuses_path, class: "btn btn-secondary-outline" %> <%= f.button :submit, class: "bg-blue-600 text-white px-6 py-2 rounded-lg hover:bg-blue-700 transition-colors duration-150" %> diff --git a/app/views/project_statuses/edit.html.erb b/app/views/organization_statuses/edit.html.erb similarity index 75% rename from app/views/project_statuses/edit.html.erb rename to app/views/organization_statuses/edit.html.erb index a04763e32..afc354d0d 100644 --- a/app/views/project_statuses/edit.html.erb +++ b/app/views/organization_statuses/edit.html.erb @@ -2,14 +2,14 @@
    -

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

    - <%= link_to "View", project_status_path(@project_status), +

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

    + <%= link_to "View", organization_status_path(@organization_status), class: "btn btn-secondary-outline" %>
    - <%= render "form", project_status: @project_status %> + <%= render "form" %>
    diff --git a/app/views/project_statuses/index.html.erb b/app/views/organization_statuses/index.html.erb similarity index 66% rename from app/views/project_statuses/index.html.erb rename to app/views/organization_statuses/index.html.erb index f989610e5..60523fce1 100644 --- a/app/views/project_statuses/index.html.erb +++ b/app/views/organization_statuses/index.html.erb @@ -1,17 +1,17 @@
    -
    border border-gray-200 rounded-xl shadow-lg hover:shadow-xl transition-shadow duration-200 p-6">

    - <%= ProjectStatus.model_name.human.pluralize %> (<%= @count_display %>) + <%= OrganizationStatus.model_name.human.pluralize %> (<%= @count_display %>)

    - <%= link_to("New #{ ProjectStatus.model_name.human.downcase }", - new_project_status_path, + <%= link_to("New #{ OrganizationStatus.model_name.human.downcase }", + new_organization_status_path, class: "btn btn-primary-outline") %>
    @@ -27,24 +27,24 @@ - <% @project_statuses.each do |project_status| %> + <% @organization_statuses.each do |organization_status| %> - <%= project_status.name %> + <%= organization_status.name %> - <%= link_to project_status.projects.count, - projects_path(project_status_id: project_status.id, - project_ids: project_status.projects.pluck(:id).join("-")), + <%= link_to organization_status.organizations.count, + organizations_path(organization_status_id: organization_status.id, + organization_ids: organization_status.organizations.pluck(:id).join("-")), class: "btn btn-secondary-default" %>
    <%= link_to "Edit", - edit_project_status_path(project_status), + edit_organization_status_path(organization_status), class: "btn btn-secondary-outline" %>
    @@ -55,15 +55,15 @@
    - <% unless @project_statuses.any? %> + <% unless @organization_statuses.any? %>

    - No <%= ProjectStatus.model_name.human.pluralize.downcase %> found. + No <%= OrganizationStatus.model_name.human.pluralize.downcase %> found.

    <% end %>
    diff --git a/app/views/project_statuses/new.html.erb b/app/views/organization_statuses/new.html.erb similarity index 82% rename from app/views/project_statuses/new.html.erb rename to app/views/organization_statuses/new.html.erb index c90d575ec..8d68d638f 100644 --- a/app/views/project_statuses/new.html.erb +++ b/app/views/organization_statuses/new.html.erb @@ -2,14 +2,14 @@
    -

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

    +

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

    - <%= render "form", project_status: @project_status %> + <%= render "form" %>
    diff --git a/app/views/project_statuses/show.html.erb b/app/views/organization_statuses/show.html.erb similarity index 66% rename from app/views/project_statuses/show.html.erb rename to app/views/organization_statuses/show.html.erb index c3300f580..4eb1cdf39 100644 --- a/app/views/project_statuses/show.html.erb +++ b/app/views/organization_statuses/show.html.erb @@ -4,14 +4,14 @@

    - <%= @project_status.class.model_name.human %> Details + <%= @organization_status.class.model_name.human %> Details

    - <%= link_to("Index", project_statuses_path, class: "btn btn-secondary-outline") %> + <%= link_to("Index", organization_statuses_path, class: "btn btn-secondary-outline") %> <% if current_user.super_user? %> - <%= link_to("Edit", edit_project_status_path(@project_status), class: "btn btn-primary-outline") %> + <%= link_to("Edit", edit_organization_status_path(@organization_status), class: "btn btn-primary-outline") %> <% end %>
    @@ -21,37 +21,37 @@

    Name:

    -

    <%= @project_status.name %>

    +

    <%= @organization_status.name %>

    - +

    - Associated Projects + Associated Organizations

    - <% if @project_status.projects.any? %> + <% if @organization_status.organizations.any? %>
      - <% @project_status.projects.order(:name).each do |project| %> + <% @organization_status.organizations.order(:name).each do |organization| %>
    • - <%= project.name %> + <%= organization.name %> <%= link_to "View", - project_path(project), + organization_path(organization), class: "text-sm text-indigo-600 hover:underline" %>
    • <% end %>
    <% else %>

    - No projects are currently associated with this status. + No organizations are currently associated with this status.

    <% end %>
    diff --git a/app/views/projects/_address_fields.html.erb b/app/views/organizations/_address_fields.html.erb similarity index 100% rename from app/views/projects/_address_fields.html.erb rename to app/views/organizations/_address_fields.html.erb diff --git a/app/views/projects/_form.html.erb b/app/views/organizations/_form.html.erb similarity index 88% rename from app/views/projects/_form.html.erb rename to app/views/organizations/_form.html.erb index bd8316059..a895d025e 100644 --- a/app/views/projects/_form.html.erb +++ b/app/views/organizations/_form.html.erb @@ -1,15 +1,15 @@ -<%= simple_form_for(@project) do |f| %> - <%= render 'shared/errors', resource: @project if @project.errors.any? %> +<%= simple_form_for(@organization) do |f| %> + <%= render 'shared/errors', resource: @organization if @organization.errors.any? %>
    - +
    <%= f.input :name, - label: "Project Name", + label: "Organization Name", as: :text, required: true, input_html: { @@ -21,12 +21,12 @@
    - <%= f.input :project_status_id, - label: "Project status", + <%= f.input :organization_status_id, + label: "Organization status", as: :select, required: true, - collection: @project_statuses, - selected: f.object.project_status_id, + collection: @organization_statuses, + selected: f.object.organization_status_id, input_html: { class: "w-full rounded-md border-gray-300 shadow-sm focus:ring-blue-500 focus:border-blue-500" @@ -113,9 +113,9 @@ <% if current_user.super_user? %>
    - <%= f.input :project_status_id, + <%= f.input :organization_status_id, as: :select, - collection: @project_statuses, + collection: @organization_statuses, include_blank: true, label: "Status", required: true, @@ -125,9 +125,9 @@
    <% else %>
    - Project status: + Organization status:
    - <%= f.object.project_status&.name %> + <%= f.object.organization_status&.name %> <% end %>
    @@ -179,7 +179,7 @@ <% if current_user.super_user? %>
    <%= f.input :internal_id, - label: "Internal Project ID", + label: "Internal Organization ID", input_html: { class: "rounded-md border-gray-300 shadow-sm focus:ring-blue-500 focus:border-blue-500" } %> @@ -247,20 +247,20 @@
    <% if current_user.super_user? %>
    - <%= f.fields_for :project_users do |project_user_form| %> - <%= render "project_user_fields", - f: project_user_form %> + <%= f.fields_for :organization_users do |organization_user_form| %> + <%= render "organization_user_fields", + f: organization_user_form %> <% end %>
    <%= link_to_add_association "➕ Add Role", f, - :project_users, + :organization_users, class: "btn btn-secondary-outline" %>
    <% else %> - <% f.object.user && f.object.user.project_users.each do |pu| %> + <% f.object.user && f.object.user.organization_users.each do |pu| %>
  • <%= pu.title || pu.position %> - <%= facilitator_profile_button(pu.user.facilitator) if pu.persisted? && pu.user.facilitator %> @@ -273,11 +273,11 @@
    - <% if @project.persisted? && current_user.super_user? %> - <%= link_to "Delete", @project, class: "btn btn-danger-outline", + <% if @organization.persisted? && current_user.super_user? %> + <%= link_to "Delete", @organization, class: "btn btn-danger-outline", method: :delete, data: { confirm: "Are you sure?" } %> <% end %> - <%= link_to "Cancel", projects_path, class: "btn btn-utility-outline" %> + <%= link_to "Cancel", organizations_path, class: "btn btn-utility-outline" %> <%= f.button :submit, class: "btn btn-primary" %>
    <% end %> diff --git a/app/views/projects/_project_user_fields.html.erb b/app/views/organizations/_organization_user_fields.html.erb similarity index 94% rename from app/views/projects/_project_user_fields.html.erb rename to app/views/organizations/_organization_user_fields.html.erb index 424ed1913..18a19dc9c 100644 --- a/app/views/projects/_project_user_fields.html.erb +++ b/app/views/organizations/_organization_user_fields.html.erb @@ -39,6 +39,6 @@
  • <% else %>
    -
  • <%= f.object.project&.name %> (<%= f.object.title || f.object.position %>)
  • +
  • <%= f.object.organization&.name %> (<%= f.object.title || f.object.position %>)
  • <% end %> diff --git a/app/views/projects/_search_boxes.html.erb b/app/views/organizations/_search_boxes.html.erb similarity index 85% rename from app/views/projects/_search_boxes.html.erb rename to app/views/organizations/_search_boxes.html.erb index 18f5c2d94..9610ca72c 100644 --- a/app/views/projects/_search_boxes.html.erb +++ b/app/views/organizations/_search_boxes.html.erb @@ -1,5 +1,5 @@
    - <%= form_with url: projects_path, method: :get, local: true, class: "flex flex-wrap items-end gap-3" do %> + <%= form_with url: organizations_path, method: :get, local: true, class: "flex flex-wrap items-end gap-3" do %>
    <%= label_tag :query, "Name", class: "text-sm font-medium text-gray-700 mb-1 block" %> <%= text_field_tag :query, params[:query], @@ -28,9 +28,9 @@ <% if current_user.super_user? %>
    <%= label_tag :status, "Status", class: "text-sm font-medium text-gray-700 mb-1 block" %> - <%= select_tag :project_status, - options_for_select(@project_statuses.map { |ps| [ps.name, ps.id] }, - params[:project_status_id].to_s), + <%= select_tag :organization_status, + options_for_select(@organization_statuses.map { |ps| [ps.name, ps.id] }, + params[:organization_status_id].to_s), include_blank: "All statuses", class: "w-40 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", @@ -38,7 +38,7 @@
    <% end %> - <%= link_to "Clear filters", projects_path, + <%= link_to "Clear filters", organizations_path, class: "btn btn-utility-outline w-full sm:w-auto" %> <% end %>
    \ No newline at end of file diff --git a/app/views/projects/_sectorable_item_fields.html.erb b/app/views/organizations/_sectorable_item_fields.html.erb similarity index 100% rename from app/views/projects/_sectorable_item_fields.html.erb rename to app/views/organizations/_sectorable_item_fields.html.erb diff --git a/app/views/projects/_social_media_buttons.html.erb b/app/views/organizations/_social_media_buttons.html.erb similarity index 72% rename from app/views/projects/_social_media_buttons.html.erb rename to app/views/organizations/_social_media_buttons.html.erb index 36fe6a7fb..465319f12 100644 --- a/app/views/projects/_social_media_buttons.html.erb +++ b/app/views/organizations/_social_media_buttons.html.erb @@ -1,8 +1,8 @@ -<% return if project.blank? %> +<% return if organization.blank? %>
    - <% if project.linked_in_url.present? %> - <%= link_to project.linked_in_url, target: "_blank", rel: "noopener noreferrer", + <% if organization.linked_in_url.present? %> + <%= link_to organization.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 %> @@ -10,8 +10,8 @@ <% end %> <% end %> - <% if project.instagram_url.present? %> - <%= link_to project.instagram_url, target: "_blank", rel: "noopener noreferrer", + <% if organization.instagram_url.present? %> + <%= link_to organization.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] @@ -20,8 +20,8 @@ <% end %> <% end %> - <% if project.facebook_url.present? %> - <%= link_to project.facebook_url, target: "_blank", rel: "noopener noreferrer", + <% if organization.facebook_url.present? %> + <%= link_to organization.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 %> @@ -29,8 +29,8 @@ <% end %> <% end %> - <% if project.twitter_url.present? %> - <%= link_to project.twitter_url, target: "_blank", rel: "noopener noreferrer", + <% if organization.twitter_url.present? %> + <%= link_to organization.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 %> @@ -38,8 +38,8 @@ <% end %> <% end %> - <% if project.youtube_url.present? %> - <%= link_to project.youtube_url, target: "_blank", rel: "noopener noreferrer", + <% if organization.youtube_url.present? %> + <%= link_to organization.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/projects/edit.html.erb b/app/views/organizations/edit.html.erb similarity index 84% rename from app/views/projects/edit.html.erb rename to app/views/organizations/edit.html.erb index aa1f2637a..20188a4a9 100644 --- a/app/views/projects/edit.html.erb +++ b/app/views/organizations/edit.html.erb @@ -3,13 +3,13 @@

    Edit Organization

    - <%= link_to 'View', project_path(@project), + <%= link_to 'View', organization_path(@organization), class: "btn btn-secondary-outline" %>
    - <%= render "form", project: @project %> + <%= render "form" %>
    diff --git a/app/views/projects/index.html.erb b/app/views/organizations/index.html.erb similarity index 73% rename from app/views/projects/index.html.erb rename to app/views/organizations/index.html.erb index b30eb889a..eee6b1a3e 100644 --- a/app/views/projects/index.html.erb +++ b/app/views/organizations/index.html.erb @@ -1,14 +1,14 @@
    -
    +

    - Organizations (<%= number_with_delimiter(@projects_count) %>) + Organizations (<%= number_with_delimiter(@organizations_count) %>)

    <% if current_user.super_user? %> <%= link_to "New Organization", - new_project_path, + new_organization_path, class: "admin-only bg-blue-100 btn btn-primary-outline" %> <% end %>
    @@ -16,7 +16,7 @@ <%= render "search_boxes" %> - +
    @@ -34,17 +34,17 @@ - <% @projects.each do |project| %> + <% @organizations.each do |organization| %> @@ -112,7 +112,7 @@
    diff --git a/app/views/projects/new.html.erb b/app/views/organizations/new.html.erb similarity index 91% rename from app/views/projects/new.html.erb rename to app/views/organizations/new.html.erb index ff157e229..d7a4cf0c0 100644 --- a/app/views/projects/new.html.erb +++ b/app/views/organizations/new.html.erb @@ -9,7 +9,7 @@
    - <%= render "form", project: @project %> + <%= render "form" %>
    diff --git a/app/views/projects/show.html.erb b/app/views/organizations/show.html.erb similarity index 72% rename from app/views/projects/show.html.erb rename to app/views/organizations/show.html.erb index 8796ec645..e74476f89 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -4,12 +4,12 @@
    - <%= link_to "Organizations", projects_path, class: "btn btn-secondary-outline" %> + <%= link_to "Organizations", organizations_path, class: "btn btn-secondary-outline" %> - <%= render "bookmarks/editable_bookmark_button", resource: @project %> + <%= render "bookmarks/editable_bookmark_button", resource: @organization %> <% if current_user.super_user? %> - <%= link_to "Edit", edit_project_path(@project), + <%= link_to "Edit", edit_organization_path(@organization), class: "admin-only bg-green-100 btn btn-primary-outline" %> <% end %>
    @@ -17,8 +17,8 @@
    - <% if @project.logo&.attached? %> - <%= image_tag url_for(@project.logo), + <% if @organization.logo&.attached? %> + <%= image_tag url_for(@organization.logo), class: "w-32 h-32 rounded-full object-cover border border-gray-200 shadow-sm" %> <% else %> <%= image_tag "missing.png", @@ -28,10 +28,10 @@

    - <%= @project.name %> + <%= @organization.name %>

    - <% @project.addresses.each do |address| %> + <% @organization.addresses.each do |address| %>

    <% if address.locality.present? %>
    @@ -54,22 +54,22 @@

    <% end %> - <% if @project.start_date.present? %> + <% if @organization.start_date.present? %>

    Affiliated since - <%= @project.start_date.year %> + <%= @organization.start_date.year %>

    <% end %>
    - <%= render "projects/social_media_buttons", project: @project if false %> + <%= render "organizations/social_media_buttons", organization: @organization if false %>
    - <% @project.decorate.badges.each do |(label, color)| %> + <% @organization.decorate.badges.each do |(label, color)| %> <%= label %> @@ -85,9 +85,9 @@

    Windows facilitators

    - <% if @project.project_users.active.any? %> + <% if @organization.organization_users.active.any? %>
      - <% @project.project_users.active.each do |pu| %> + <% @organization.organization_users.active.each do |pu| %>
    • <%= pu.user.facilitator ? facilitator_profile_button(pu.user.facilitator) : pu.user.name %> <% if pu.position.present? %> @@ -102,13 +102,13 @@
    - <% if true || @project.profile_show_sectors? %> + <% if true || @organization.profile_show_sectors? %>

    Service Populations

    - <% if @project.sectorable_items.any? %> + <% if @organization.sectorable_items.any? %>

    - <% @project.sectorable_items.joins(:sector).order("sectors.name").map do |si| %> + <% @organization.sectorable_items.joins(:sector).order("sectors.name").map do |si| %> <%= render "sectors/tagging_label", sector: si.sector, display_leader: true, @@ -124,23 +124,23 @@
    - <% if true || @project.profile_show_email? || @project.profile_show_phone? %> + <% if true || @organization.profile_show_email? || @organization.profile_show_phone? %>

    Contact Information

    - <% if true || @project.profile_show_email? %> + <% if true || @organization.profile_show_email? %>

    - 📧 <%#= mail_to @project.email, @project.email, + 📧 <%#= mail_to @organization.email, @organization.email, class: "text-blue-600 hover:underline" %>

    <% end %> - <% if true || @project.profile_show_phone? && @project.phone.present? %> + <% if true || @organization.profile_show_phone? && @organization.phone.present? %>

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

    <% end %> - <% if true || @project.profile_show_website? && @project.website_url.present? %> + <% if true || @organization.profile_show_website? && @organization.website_url.present? %>

    - 🌎 <%#= link_to @project.website_url, + 🌎 <%#= link_to @organization.website_url, class: "text-blue-600 hover:underline" %>

    <% end %> @@ -151,18 +151,18 @@
    - <% if true || @project.profile_show_description? && @project.description.present? %> + <% if true || @organization.profile_show_description? && @organization.description.present? %>

    Description

    - <%= sanitize(@project.description, tags: %w[p br strong em a ul ol li b i], attributes: %w[href]) %> + <%= sanitize(@organization.description, tags: %w[p br strong em a ul ol li b i], attributes: %w[href]) %>
    <% end %> - <% if true || @project.profile_show_workshops? %> + <% if true || @organization.profile_show_workshops? %>

    Workshops authored

    - <% if false && @project.workshops.any? %> - <% @project.workshops.each do |workshop| %> + <% if false && @organization.workshops.any? %> + <% @organization.workshops.each do |workshop| %> <%= link_to workshop.name, workshop_path(workshop), class: "btn btn-secondary-outline" %> <% end %> <% else %> @@ -172,10 +172,10 @@ <% end %> - <% if true || @project.profile_show_stories? %> + <% if true || @organization.profile_show_stories? %>

    Stories

    - <%# stories = @project.stories_as_creator + @project.stories_as_spotlighted_project %> + <%# stories = @organization.stories_as_creator + @organization.stories_as_spotlighted_organization %> <%# if stories.any? %> <%# stories.each do |story| %> <%#= link_to story.title, story_path(story), class: "btn btn-secondary-outline" %> @@ -187,7 +187,7 @@ <% end %> - <% if true || @project.profile_show_events_registered? %> + <% if true || @organization.profile_show_events_registered? %>

    Events hosted

    <%# if Event.all.any? %> @@ -203,14 +203,14 @@
    - <% if current_user.super_user || @project.project_users.pluck(:user_id).include?(current_user.id) %> -
    + <% if current_user.super_user || @organization.organization_users.pluck(:user_id).include?(current_user.id) %> +
    - <% if true || @project.profile_show_workshop_logs? %> + <% if true || @organization.profile_show_workshop_logs? %>

    Workshop Logs submitted

    - <% if false && @project.workshop_logs.any? %> - <% @project.workshop_logs.order(date: :desc, created_at: :desc).each do |workshop_log| %> + <% if false && @organization.workshop_logs.any? %> + <% @organization.workshop_logs.order(date: :desc, created_at: :desc).each do |workshop_log| %> <%= link_to workshop_log.full_name, workshop_log_path(workshop_log), class: "btn btn-secondary-outline" %> <% end %> diff --git a/app/views/reports/_form.html.erb b/app/views/reports/_form.html.erb index 469964195..ef3eb952d 100644 --- a/app/views/reports/_form.html.erb +++ b/app/views/reports/_form.html.erb @@ -52,9 +52,9 @@
    Please contact AWBW if your agency is not listed.
    <% agency = agencies.find_by(windows_type_id: f.object.windows_type.id) %> - <%= f.collection_select :project_id, agencies, :id, :name, + <%= f.collection_select :organization_id, agencies, :id, :name, { selected: agency ? agency.id : nil,class: 'js-agency-select' }, - class:"selectpicker form-control form-control-custom", onchange: 'redirectToNewProject()' %> + class:"selectpicker form-control form-control-custom", onchange: 'redirectToNewOrganization()' %>
    <%= f.hidden_field :owner_id, value: @form_builder.id %> diff --git a/app/views/reports/edit.html.erb b/app/views/reports/edit.html.erb index 66938b1d9..22e141205 100644 --- a/app/views/reports/edit.html.erb +++ b/app/views/reports/edit.html.erb @@ -47,9 +47,9 @@
    Please contact AWBW if your agency is not listed.
    <% agency = @agencies.find_by(windows_type_id: f.object.windows_type.id) %> - <%= f.collection_select :project_id, @agencies, :id, :name, + <%= f.collection_select :organization_id, @agencies, :id, :name, { selected: agency ? agency.id : nil,class: 'js-agency-select' }, - class:"selectpicker form-control form-control-custom", onchange: 'redirectToNewProject()' %> + class:"selectpicker form-control form-control-custom", onchange: 'redirectToNewOrganization()' %>
    <%= render 'sectorable_items' %> diff --git a/app/views/reports/edit_story.html.erb b/app/views/reports/edit_story.html.erb index 8484c6c36..53a45eb6a 100644 --- a/app/views/reports/edit_story.html.erb +++ b/app/views/reports/edit_story.html.erb @@ -26,9 +26,9 @@
    <% agency = @agencies.find_by(windows_type_id: f.object.windows_type.id) %> - <%= f.collection_select :project_id, @agencies, :id, :name, + <%= f.collection_select :organization_id, @agencies, :id, :name, { selected: agency ? agency.id : nil,class: 'js-agency-select' }, - class:"selectpicker form-control form-control-custom", onchange: 'redirectToNewProject()' %> + class:"selectpicker form-control form-control-custom", onchange: 'redirectToNewOrganization()' %>
    diff --git a/app/views/reports/fill_out_form.html.erb b/app/views/reports/fill_out_form.html.erb index f60a4fb81..8cefeedda 100644 --- a/app/views/reports/fill_out_form.html.erb +++ b/app/views/reports/fill_out_form.html.erb @@ -1,6 +1,6 @@

    <%= @form_builder.name %>

    -<%= render "form", report: @report, form_fields: @form_builder.form_fields, agencies: current_user.projects %> +<%= render "form", report: @report, form_fields: @form_builder.form_fields, agencies: current_user.organizations %>
    - <%= link_to project_path(project) do %> - <% if project.logo.attached? %> + <%= link_to organization_path(organization) do %> + <% if organization.logo.attached? %> <%= image_tag( - project.logo, + organization.logo, class: "w-10 h-10 rounded-full object-cover border border-gray-300 shadow-sm mx-auto" ) %> <% else %> - <%= link_to project_path(project) do %> + <%= link_to organization_path(organization) do %> - <%= link_to project.name, project_path(project), class: "hover:underline" %> + <%= link_to organization.name, organization_path(organization), class: "hover:underline" %> - <%= project.windows_type&.short_name&.titleize %> + <%= organization.windows_type&.short_name&.titleize %> - <%= project.addresses.active.map(&:locality).join("
    ") %> + <%= organization.addresses.active.map(&:locality).join("
    ") %>
    - <% if project.start_date || project.end_date %> - <%= project.start_date&.strftime("%b %Y") %> – - <%= project.end_date&.strftime("%b %Y") || "Present" %> + <% if organization.start_date || organization.end_date %> + <%= organization.start_date&.strftime("%b %Y") %> – + <%= organization.end_date&.strftime("%b %Y") || "Present" %> <% end %> "> - <%= project.project_status&.name %> + <%= organization.organization_status&.name %> - <% if project.inactive? %> + <% if organization.inactive? %> <% else %> @@ -96,10 +96,10 @@ <% if current_user.super_user? %> - <%= link_to "Edit", edit_project_path(project), + <%= link_to "Edit", edit_organization_path(organization), class: "admin-only bg-blue-100 btn btn-secondary-outline text-xs px-2 py-1" %> <% end %> - <%= link_to "Profile", project_path(project), + <%= link_to "Profile", organization_path(organization), class: "btn btn-secondary-outline text-xs px-2 py-1" %>