Skip to content
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/helpers/partners_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ def partial_display_name(partial)
'attached_documents' => 'Additional Documents'
}

# TODO: temporary change of name for the contacts partial before migration
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once this is merged and deployed, we can remove these extra bits of code.

if partial == 'executive_director'
return 'Contacts'
end

custom_names[partial] || partial.humanize
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/organization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
38 changes: 38 additions & 0 deletions app/views/partners/profiles/edit/_contacts.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header bg-white">
<h3 class="card-title"><strong>Executive Director</strong></h3>
</div>
<div class="card-body">
<%= 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 %>
</div>
</div>
</div>
</div>
</div>
</section>

<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header bg-white">
<h3 class="card-title"><strong>Primary Contact</strong></h3>
</div>
<div class="card-body">
<%= 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 %>
</div>
</div>
</div>
</div>
</div>
</section>
40 changes: 2 additions & 38 deletions app/views/partners/profiles/edit/_executive_director.html.erb
Original file line number Diff line number Diff line change
@@ -1,38 +1,2 @@
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header bg-white">
<h3 class="card-title"><strong>Executive Director</strong></h3>
</div>
<div class="card-body">
<%= 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 %>
</div>
</div>
</div>
</div>
</div>
</section>

<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header bg-white">
<h3 class="card-title"><strong>Primary Contact</strong></h3>
</div>
<div class="card-body">
<%= 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 %>
</div>
</div>
</div>
</div>
</div>
</section>
<% # TODO: remove this after migration to the other partials %>
<%= render "partners/profiles/edit/contacts", form: form %>
31 changes: 31 additions & 0 deletions app/views/partners/profiles/show/_contacts.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<div class="card mb-4">
<h5 class="card-header bg-primary text-white">Contacts</h5>
<div class="card-body">
<h5 class='font-weight-bold'>Executive Director</h5>
<dl>
<dt>Name</dt>
<dd><%= profile.executive_director_name %></dd>

<dt>Phone Number</dt>
<dd><%= profile.executive_director_phone %></dd>

<dt>Email</dt>
<dd><%= profile.executive_director_email %></dd>
</dl>

<h5 class='font-weight-bold'>Primary Contact</h5>
<dl>
<dt>Name</dt>
<dd><%= profile.primary_contact_name %></dd>

<dt>Phone Number</dt>
<dd><%= profile.primary_contact_phone %></dd>

<dt>Mobile Phone Number</dt>
<dd><%= profile.primary_contact_mobile %></dd>

<dt>Email</dt>
<dd><%= profile.primary_contact_email %></dd>
</dl>
</div>
</div>
31 changes: 1 addition & 30 deletions app/views/partners/profiles/show/_executive_director.html.erb
Original file line number Diff line number Diff line change
@@ -1,30 +1 @@
<div class="card mb-4">
<h5 class="card-header bg-primary text-white">Executive Director</h5>
<div class="card-body">
<dl>
<dt>Name</dt>
<dd><%= profile.executive_director_name %></dd>

<dt>Phone Number</dt>
<dd><%= profile.executive_director_phone %></dd>

<dt>Email</dt>
<dd><%= profile.executive_director_email %></dd>
</dl>

<h6>Primary Contact Person</h6>
<dl>
<dt>Name</dt>
<dd><%= profile.primary_contact_name %></dd>

<dt>Phone Number</dt>
<dd><%= profile.primary_contact_phone %></dd>

<dt>Mobile Phone Number</dt>
<dd><%= profile.primary_contact_mobile %></dd>

<dt>Email</dt>
<dd><%= profile.primary_contact_email %></dd>
</dl>
</div>
</div>
<%= render "partners/profiles/show/contacts", profile: profile %>
27 changes: 27 additions & 0 deletions app/views/partners/profiles/step/_contacts_form.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<%= f.fields_for :profile, profile do |pf| %>
<h3 class="pt-3"><strong>Executive Director</strong></h3>
<div class="form-group">
<%= pf.input :executive_director_name, label: "Executive Director Name", class: "form-control" %>
</div>
<div class="form-group">
<%= pf.input :executive_director_phone, label: "Executive Director Phone", class: "form-control" %>
</div>
<div class="form-group">
<%= pf.input :executive_director_email, label: "Executive Director Email", class: "form-control" %>
</div>

<h3 class="pt-3"><strong>Primary Contact</strong></h3>

<div class="form-group">
<%= pf.input :primary_contact_name, label: "Primary Contact Name", class: "form-control" %>
</div>
<div class="form-group">
<%= pf.input :primary_contact_phone, label: "Primary Contact Phone", class: "form-control" %>
</div>
<div class="form-group">
<%= pf.input :primary_contact_mobile, label: "Primary Contact Cell", class: "form-control" %>
</div>
<div class="form-group">
<%= pf.input :primary_contact_email, label: "Primary Contact Email", class: "form-control" %>
</div>
<% end %>
Original file line number Diff line number Diff line change
@@ -1,26 +1 @@
<%= f.fields_for :profile, profile do |pf| %>
<div class="form-group">
<%= pf.input :executive_director_name, label: "Executive Director Name", class: "form-control" %>
</div>
<div class="form-group">
<%= pf.input :executive_director_phone, label: "Executive Director Phone", class: "form-control" %>
</div>
<div class="form-group">
<%= pf.input :executive_director_email, label: "Executive Director Email", class: "form-control" %>
</div>

<h3 class="pt-3"><strong>Primary Contact</strong></h3>

<div class="form-group">
<%= pf.input :primary_contact_name, label: "Primary Contact Name", class: "form-control" %>
</div>
<div class="form-group">
<%= pf.input :primary_contact_phone, label: "Primary Contact Phone", class: "form-control" %>
</div>
<div class="form-group">
<%= pf.input :primary_contact_mobile, label: "Primary Contact Cell", class: "form-control" %>
</div>
<div class="form-group">
<%= pf.input :primary_contact_email, label: "Primary Contact Email", class: "form-control" %>
</div>
<% end %>
<%= render "partners/profiles/step/contacts_form", f: f, profile: profile %>
4 changes: 3 additions & 1 deletion app/views/profiles/step/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
class MigrateOrganizationPartnerFormFieldsExecutiveDirectorToContacts < ActiveRecord::Migration[8.0]
class Organization < ApplicationRecord
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unlikely the Organization name would change, but this is a way to allow us to use the model name in the migration.

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
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Loading