From 4357d6cb800c056430719009e928a1738c422ee1 Mon Sep 17 00:00:00 2001 From: Edwin Mak Date: Sun, 20 Apr 2025 11:30:54 +0900 Subject: [PATCH 1/9] Fix step to migrating to contacts naming --- app/helpers/partners_helper.rb | 5 +++ app/models/partner.rb | 1 + .../partners/profiles/edit/_contacts.html.erb | 38 ++++++++++++++++++ .../edit/_executive_director.html.erb | 40 +------------------ .../profiles/step/_contacts_form.html.erb | 26 ++++++++++++ .../step/_executive_director_form.html.erb | 27 +------------ app/views/profiles/step/edit.html.erb | 4 +- 7 files changed, 76 insertions(+), 65 deletions(-) create mode 100644 app/views/partners/profiles/edit/_contacts.html.erb create mode 100644 app/views/partners/profiles/step/_contacts_form.html.erb diff --git a/app/helpers/partners_helper.rb b/app/helpers/partners_helper.rb index 74974649f3..93876cc7bb 100644 --- a/app/helpers/partners_helper.rb +++ b/app/helpers/partners_helper.rb @@ -34,6 +34,11 @@ def partial_display_name(partial) 'attached_documents' => 'Additional Documents' } + # TODO: temporary change of name for the contacts partial before migration + if partial == 'executive_director' + return 'Contacts' + end + custom_names[partial] || partial.humanize end diff --git a/app/models/partner.rb b/app/models/partner.rb index 0f0cdb12f0..bb85180c40 100644 --- a/app/models/partner.rb +++ b/app/models/partner.rb @@ -152,6 +152,7 @@ def agency_info end def partials_to_show + # Must migrate to change the partner_form_fields to say "contacts" instead of "executive_director" organization.partner_form_fields.presence || ALL_PARTIALS end diff --git a/app/views/partners/profiles/edit/_contacts.html.erb b/app/views/partners/profiles/edit/_contacts.html.erb new file mode 100644 index 0000000000..e7ec72c652 --- /dev/null +++ b/app/views/partners/profiles/edit/_contacts.html.erb @@ -0,0 +1,38 @@ +
+
+
+
+
+
+

Executive Director

+
+
+ <%= form.input :executive_director_name, label: "Executive Director Name", class: "form-control", wrapper: :input_group %> + <%= form.input :executive_director_phone, label: "Executive Director Phone", class: "form-control", wrapper: :input_group %> + <%= form.input :executive_director_email, label: "Executive Director Email", class: "form-control", wrapper: :input_group %> +
+
+
+
+
+
+ +
+
+
+
+
+
+

Primary Contact

+
+
+ <%= form.input :primary_contact_name, label: "Primary Contact Name", class: "form-control", wrapper: :input_group %> + <%= form.input :primary_contact_phone, label: "Primary Contact Phone", class: "form-control", wrapper: :input_group %> + <%= form.input :primary_contact_mobile, label: "Primary Contact Cell", class: "form-control", wrapper: :input_group %> + <%= form.input :primary_contact_email, label: "Primary Contact Email", class: "form-control", wrapper: :input_group %> +
+
+
+
+
+
diff --git a/app/views/partners/profiles/edit/_executive_director.html.erb b/app/views/partners/profiles/edit/_executive_director.html.erb index e7ec72c652..614d0ca991 100644 --- a/app/views/partners/profiles/edit/_executive_director.html.erb +++ b/app/views/partners/profiles/edit/_executive_director.html.erb @@ -1,38 +1,2 @@ -
-
-
-
-
-
-

Executive Director

-
-
- <%= form.input :executive_director_name, label: "Executive Director Name", class: "form-control", wrapper: :input_group %> - <%= form.input :executive_director_phone, label: "Executive Director Phone", class: "form-control", wrapper: :input_group %> - <%= form.input :executive_director_email, label: "Executive Director Email", class: "form-control", wrapper: :input_group %> -
-
-
-
-
-
- -
-
-
-
-
-
-

Primary Contact

-
-
- <%= form.input :primary_contact_name, label: "Primary Contact Name", class: "form-control", wrapper: :input_group %> - <%= form.input :primary_contact_phone, label: "Primary Contact Phone", class: "form-control", wrapper: :input_group %> - <%= form.input :primary_contact_mobile, label: "Primary Contact Cell", class: "form-control", wrapper: :input_group %> - <%= form.input :primary_contact_email, label: "Primary Contact Email", class: "form-control", wrapper: :input_group %> -
-
-
-
-
-
+<% # TODO: remove this after migration to the other partials %> +<%= render "partners/profiles/edit/contacts", form: form %> diff --git a/app/views/partners/profiles/step/_contacts_form.html.erb b/app/views/partners/profiles/step/_contacts_form.html.erb new file mode 100644 index 0000000000..2cb5e963dd --- /dev/null +++ b/app/views/partners/profiles/step/_contacts_form.html.erb @@ -0,0 +1,26 @@ +<%= f.fields_for :profile, profile do |pf| %> +
+ <%= pf.input :executive_director_name, label: "Executive Director Name", class: "form-control" %> +
+
+ <%= pf.input :executive_director_phone, label: "Executive Director Phone", class: "form-control" %> +
+
+ <%= pf.input :executive_director_email, label: "Executive Director Email", class: "form-control" %> +
+ +

Primary Contact

+ +
+ <%= pf.input :primary_contact_name, label: "Primary Contact Name", class: "form-control" %> +
+
+ <%= pf.input :primary_contact_phone, label: "Primary Contact Phone", class: "form-control" %> +
+
+ <%= pf.input :primary_contact_mobile, label: "Primary Contact Cell", class: "form-control" %> +
+
+ <%= pf.input :primary_contact_email, label: "Primary Contact Email", class: "form-control" %> +
+<% end %> diff --git a/app/views/partners/profiles/step/_executive_director_form.html.erb b/app/views/partners/profiles/step/_executive_director_form.html.erb index 2cb5e963dd..140d560013 100644 --- a/app/views/partners/profiles/step/_executive_director_form.html.erb +++ b/app/views/partners/profiles/step/_executive_director_form.html.erb @@ -1,26 +1 @@ -<%= f.fields_for :profile, profile do |pf| %> -
- <%= pf.input :executive_director_name, label: "Executive Director Name", class: "form-control" %> -
-
- <%= pf.input :executive_director_phone, label: "Executive Director Phone", class: "form-control" %> -
-
- <%= pf.input :executive_director_email, label: "Executive Director Email", class: "form-control" %> -
- -

Primary Contact

- -
- <%= pf.input :primary_contact_name, label: "Primary Contact Name", class: "form-control" %> -
-
- <%= pf.input :primary_contact_phone, label: "Primary Contact Phone", class: "form-control" %> -
-
- <%= pf.input :primary_contact_mobile, label: "Primary Contact Cell", class: "form-control" %> -
-
- <%= pf.input :primary_contact_email, label: "Primary Contact Email", class: "form-control" %> -
-<% end %> +<%= render "partners/profiles/step/contacts_form", f: f, profile: profile %> diff --git a/app/views/profiles/step/edit.html.erb b/app/views/profiles/step/edit.html.erb index fe706c9e59..fa677dab28 100644 --- a/app/views/profiles/step/edit.html.erb +++ b/app/views/profiles/step/edit.html.erb @@ -26,7 +26,9 @@ <%= render 'partners/profiles/step/accordion_section', f: f, partner: @partner, section_id: 'agency_information', section_title: 'Agency Information', icon_class: 'fa-edit', partial_name: 'agency_information', sections_with_errors: @sections_with_errors %> <%= render 'partners/profiles/step/accordion_section', f: f, partner: @partner, section_id: 'program_delivery_address', section_title: 'Program / Delivery Address', icon_class: 'fa-map', partial_name: 'program_delivery_address', sections_with_errors: @sections_with_errors %> <% @partner.partials_to_show.each do |partial| %> - <%= render 'partners/profiles/step/accordion_section', f: f, partner: @partner, section_id: partial, section_title: partial_display_name(partial), icon_class: 'fa-cogs', partial_name: partial, sections_with_errors: @sections_with_errors %> + <%= render 'partners/profiles/step/accordion_section', f: f, partner: @partner, section_id: partial, section_title: partial_display_name(partial), icon_class: 'fa-cogs', + partial_name: partial, + sections_with_errors: @sections_with_errors %> <% end %> <%= render 'partners/profiles/step/accordion_section', f: f, partner: @partner, section_id: 'partner_settings', section_title: 'Settings', icon_class: 'fa-cog', partial_name: 'partner_settings', sections_with_errors: @sections_with_errors %> From 5c3e06a619b4d1ee1702fbf989be327f72961e91 Mon Sep 17 00:00:00 2001 From: Edwin Mak Date: Sun, 20 Apr 2025 12:11:45 +0900 Subject: [PATCH 2/9] More copy changes --- .../partners/profiles/show/_contacts.html.erb | 31 +++++++++++++++++++ .../show/_executive_director.html.erb | 31 +------------------ .../profiles/step/_contacts_form.html.erb | 1 + 3 files changed, 33 insertions(+), 30 deletions(-) create mode 100644 app/views/partners/profiles/show/_contacts.html.erb diff --git a/app/views/partners/profiles/show/_contacts.html.erb b/app/views/partners/profiles/show/_contacts.html.erb new file mode 100644 index 0000000000..04e4f9bdff --- /dev/null +++ b/app/views/partners/profiles/show/_contacts.html.erb @@ -0,0 +1,31 @@ +
+
Contacts
+
+
Executive Director
+
+
Name
+
<%= profile.executive_director_name %>
+ +
Phone Number
+
<%= profile.executive_director_phone %>
+ +
Email
+
<%= profile.executive_director_email %>
+
+ +
Primary Contact
+
+
Name
+
<%= profile.primary_contact_name %>
+ +
Phone Number
+
<%= profile.primary_contact_phone %>
+ +
Mobile Phone Number
+
<%= profile.primary_contact_mobile %>
+ +
Email
+
<%= profile.primary_contact_email %>
+
+
+
diff --git a/app/views/partners/profiles/show/_executive_director.html.erb b/app/views/partners/profiles/show/_executive_director.html.erb index d8c34b3a29..1c98e2ed0b 100644 --- a/app/views/partners/profiles/show/_executive_director.html.erb +++ b/app/views/partners/profiles/show/_executive_director.html.erb @@ -1,30 +1 @@ -
-
Executive Director
-
-
-
Name
-
<%= profile.executive_director_name %>
- -
Phone Number
-
<%= profile.executive_director_phone %>
- -
Email
-
<%= profile.executive_director_email %>
-
- -
Primary Contact Person
-
-
Name
-
<%= profile.primary_contact_name %>
- -
Phone Number
-
<%= profile.primary_contact_phone %>
- -
Mobile Phone Number
-
<%= profile.primary_contact_mobile %>
- -
Email
-
<%= profile.primary_contact_email %>
-
-
-
+<%= render "partners/profiles/show/contacts", profile: profile %> diff --git a/app/views/partners/profiles/step/_contacts_form.html.erb b/app/views/partners/profiles/step/_contacts_form.html.erb index 2cb5e963dd..8bc57f2bf4 100644 --- a/app/views/partners/profiles/step/_contacts_form.html.erb +++ b/app/views/partners/profiles/step/_contacts_form.html.erb @@ -1,4 +1,5 @@ <%= f.fields_for :profile, profile do |pf| %> +

Executive Director

<%= pf.input :executive_director_name, label: "Executive Director Name", class: "form-control" %>
From 4cff51a049e390c199d4b22ddf25ae2c0b278599 Mon Sep 17 00:00:00 2001 From: Edwin Mak Date: Sun, 20 Apr 2025 12:16:36 +0900 Subject: [PATCH 3/9] Rename Executive Director with contacts --- app/models/organization.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/organization.rb b/app/models/organization.rb index 5c70feaf7c..7102cf5409 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -108,7 +108,7 @@ def flipper_id ['Sources of Funding', 'sources_of_funding'], ['Area Served', 'area_served'], ['Population Served', 'population_served'], - ['Executive Director', 'executive_director'], + ['Contacts', 'contacts'], ['Pickup Person', 'pick_up_person'], ['Agency Distribution Information', 'agency_distribution_information'], ['Attached Documents', 'attached_documents'] From 28694870a3f81aed31f4deff413b8e25b768426c Mon Sep 17 00:00:00 2001 From: Edwin Mak Date: Sun, 20 Apr 2025 12:21:16 +0900 Subject: [PATCH 4/9] Add a migration for the conversion to use the new field name --- ...m_fields_executive_director_to_contacts.rb | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 db/migrate/20250420031735_migrate_organization_partner_form_fields_executive_director_to_contacts.rb diff --git a/db/migrate/20250420031735_migrate_organization_partner_form_fields_executive_director_to_contacts.rb b/db/migrate/20250420031735_migrate_organization_partner_form_fields_executive_director_to_contacts.rb new file mode 100644 index 0000000000..ce620b45d2 --- /dev/null +++ b/db/migrate/20250420031735_migrate_organization_partner_form_fields_executive_director_to_contacts.rb @@ -0,0 +1,27 @@ +class MigrateOrganizationPartnerFormFieldsExecutiveDirectorToContacts < ActiveRecord::Migration[8.0] + class Organization < ApplicationRecord + end + + def up + organizations_to_update = Organization.where.not(partner_form_fields: []) + organizations_to_update.each do |org| + if org.partner_form_fields.include?('executive_director') + org.partner_form_fields.delete('executive_director') + org.partner_form_fields << 'contacts' + org.save! + end + end + end + + def down + organizations_to_update = Organization.where.not(partner_form_fields: []) + organizations_to_update.each do |org| + if org.partner_form_fields.include?('contacts') + org.partner_form_fields.delete('contacts') + org.partner_form_fields << 'executive_director' + org.save! + end + end + end + +end From 1f671598b6e9b535243695cd0a7aa8e745a70f3e Mon Sep 17 00:00:00 2001 From: Edwin Mak Date: Sun, 20 Apr 2025 12:22:10 +0900 Subject: [PATCH 5/9] Update schema --- db/schema.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/schema.rb b/db/schema.rb index 230bcef07c..9457806d82 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2025_04_04_102321) do +ActiveRecord::Schema[8.0].define(version: 2025_04_20_031735) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" From af864e7d898702075ae555a240e5ddab21a57bbf Mon Sep 17 00:00:00 2001 From: Edwin Mak Date: Sun, 20 Apr 2025 12:25:59 +0900 Subject: [PATCH 6/9] Remove some changes --- app/models/partner.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/models/partner.rb b/app/models/partner.rb index bb85180c40..0f0cdb12f0 100644 --- a/app/models/partner.rb +++ b/app/models/partner.rb @@ -152,7 +152,6 @@ def agency_info end def partials_to_show - # Must migrate to change the partner_form_fields to say "contacts" instead of "executive_director" organization.partner_form_fields.presence || ALL_PARTIALS end From 7707cceb9d229df9503247b02fbe30f536f24afa Mon Sep 17 00:00:00 2001 From: Edwin Mak Date: Sun, 4 May 2025 07:37:51 +0900 Subject: [PATCH 7/9] Clean up --- app/views/profiles/_show.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/profiles/_show.html.erb b/app/views/profiles/_show.html.erb index cd2b31733d..ca1f4a77f7 100644 --- a/app/views/profiles/_show.html.erb +++ b/app/views/profiles/_show.html.erb @@ -116,13 +116,13 @@

Poverty Unknown: <%= partner_profile.poverty_unknown %>


<% end %> - <% if partner_profile_fields.include?('executive_director') || partner_profile_fields.empty? %> -

Executive Director

+ <% if partner_profile_fields.include?('contacts') || partner_profile_fields.empty? %> +

Contacts

+ Executive Director

Executive Director Name: <%= partner_profile.executive_director_name %>

Executive Director Phone: <%= partner_profile.executive_director_phone %>

Executive Director Email: <%= partner_profile.executive_director_email %>

-
-

Primary Contact Person

+ Primary Contact Person

Primary Contact Name: <%= partner_profile.primary_contact_name %>

Primary Contact Phone: <%= partner_profile.primary_contact_phone %>

Primary Contact Mobile: <%= partner_profile.primary_contact_mobile %>

From d3a2dbb7048ab0bc803d3de611f5898d13bb3fb9 Mon Sep 17 00:00:00 2001 From: Edwin Mak Date: Sun, 4 May 2025 07:41:14 +0900 Subject: [PATCH 8/9] Fix up guide --- docs/user_guide/bank/pm_partner_profiles.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/user_guide/bank/pm_partner_profiles.md b/docs/user_guide/bank/pm_partner_profiles.md index 4c45cfd6ea..b731153cbd 100644 --- a/docs/user_guide/bank/pm_partner_profiles.md +++ b/docs/user_guide/bank/pm_partner_profiles.md @@ -42,8 +42,7 @@ The high level sections of the partner profile are: - Sources of Funding - Area Served (County/Client Share %) - Population Served -- Executive Director -- Primary Contact +- Contacts - Pick up Person - Race/Ethnicity of Client Base - Agency Distribution Information @@ -165,7 +164,7 @@ There is no check on whether the numbers add up to 100 -- because there may be o - % Greater than 2 times FPL - % Poverty Unknown -### Executive Director +### Contacts ![screenshot of expanded executive director section](images/partners/partners_profile_edit_executive.png) ![NOTE] This section currently contains both Executive Director and Primary Contact for the partner. We have splitting them up in our queue. Contact information for the head of the agency: From 82e36af2ed9dc7caba9646506a20bffb459f3821 Mon Sep 17 00:00:00 2001 From: Edwin Mak Date: Sun, 4 May 2025 07:46:06 +0900 Subject: [PATCH 9/9] Fix linting erb errors --- app/views/partners/profiles/edit/_executive_director.html.erb | 2 +- app/views/profiles/step/edit.html.erb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/partners/profiles/edit/_executive_director.html.erb b/app/views/partners/profiles/edit/_executive_director.html.erb index 614d0ca991..78f0127433 100644 --- a/app/views/partners/profiles/edit/_executive_director.html.erb +++ b/app/views/partners/profiles/edit/_executive_director.html.erb @@ -1,2 +1,2 @@ -<% # TODO: remove this after migration to the other partials %> +<%# TODO: remove this after migration to the other partials %> <%= render "partners/profiles/edit/contacts", form: form %> diff --git a/app/views/profiles/step/edit.html.erb b/app/views/profiles/step/edit.html.erb index fa677dab28..635606aaef 100644 --- a/app/views/profiles/step/edit.html.erb +++ b/app/views/profiles/step/edit.html.erb @@ -26,8 +26,8 @@ <%= render 'partners/profiles/step/accordion_section', f: f, partner: @partner, section_id: 'agency_information', section_title: 'Agency Information', icon_class: 'fa-edit', partial_name: 'agency_information', sections_with_errors: @sections_with_errors %> <%= render 'partners/profiles/step/accordion_section', f: f, partner: @partner, section_id: 'program_delivery_address', section_title: 'Program / Delivery Address', icon_class: 'fa-map', partial_name: 'program_delivery_address', sections_with_errors: @sections_with_errors %> <% @partner.partials_to_show.each do |partial| %> - <%= render 'partners/profiles/step/accordion_section', f: f, partner: @partner, section_id: partial, section_title: partial_display_name(partial), icon_class: 'fa-cogs', - partial_name: partial, + <%= render 'partners/profiles/step/accordion_section', f: f, partner: @partner, section_id: partial, section_title: partial_display_name(partial), icon_class: 'fa-cogs', + partial_name: partial, sections_with_errors: @sections_with_errors %> <% end %> <%= render 'partners/profiles/step/accordion_section', f: f, partner: @partner, section_id: 'partner_settings', section_title: 'Settings', icon_class: 'fa-cog', partial_name: 'partner_settings', sections_with_errors: @sections_with_errors %>