From 4156f430444f8fe21b63abe8dc43990baf7d7a1d Mon Sep 17 00:00:00 2001
From: Vincent Truong
Date: Fri, 2 Feb 2024 13:09:39 -0600
Subject: [PATCH] Rename field to one_step_invite_and_approve
---
app/controllers/organizations_controller.rb | 2 +-
app/models/organization.rb | 2 +-
app/views/organizations/_details.html.erb | 4 ++--
app/views/organizations/edit.html.erb | 2 +-
app/views/partners/_partner_row.html.erb | 4 ++--
...131202431_add_one_step_partner_invite_to_organization.rb | 6 ++++++
...ep_invite_and_approve_partner_process_to_organization.rb | 6 ------
db/schema.rb | 2 +-
spec/factories/organizations.rb | 2 +-
spec/models/organization_spec.rb | 2 +-
spec/system/organization_system_spec.rb | 4 ++--
11 files changed, 18 insertions(+), 18 deletions(-)
create mode 100644 db/migrate/20240131202431_add_one_step_partner_invite_to_organization.rb
delete mode 100644 db/migrate/20240131202431_add_use_single_step_invite_and_approve_partner_process_to_organization.rb
diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb
index 3b5c541c7e..6108aed47d 100644
--- a/app/controllers/organizations_controller.rb
+++ b/app/controllers/organizations_controller.rb
@@ -97,7 +97,7 @@ def organization_params
:repackage_essentials, :distribute_monthly,
:ndbn_member_id, :enable_child_based_requests,
:enable_individual_requests, :enable_quantity_based_requests,
- :ytd_on_distribution_printout,:use_single_step_invite_and_approve_partner_process ,
+ :ytd_on_distribution_printout,:one_step_partner_invite,
partner_form_fields: []
)
end
diff --git a/app/models/organization.rb b/app/models/organization.rb
index c9dd539346..d5927c7c3d 100644
--- a/app/models/organization.rb
+++ b/app/models/organization.rb
@@ -23,7 +23,7 @@
# state :string
# street :string
# url :string
-# use_single_step_invite_and_approve_partner_process :boolean default(FALSE), not null
+# one_step_partner_invite :boolean default(FALSE), not null
# ytd_on_distribution_printout :boolean default(TRUE), not null
# zipcode :string
# created_at :datetime not null
diff --git a/app/views/organizations/_details.html.erb b/app/views/organizations/_details.html.erb
index fe5ca41967..4ed537df42 100644
--- a/app/views/organizations/_details.html.erb
+++ b/app/views/organizations/_details.html.erb
@@ -153,9 +153,9 @@
-
Use Single-step Invite and Approve Partner Process?
+
Use One step Partner invite and approve process?
- <%= humanize_boolean(@organization.use_single_step_invite_and_approve_partner_process) %>
+ <%= humanize_boolean(@organization.one_step_partner_invite) %>
<% if @organization.logo.attached? %>
diff --git a/app/views/organizations/edit.html.erb b/app/views/organizations/edit.html.erb
index b9b2ad7ff5..c182d26dee 100644
--- a/app/views/organizations/edit.html.erb
+++ b/app/views/organizations/edit.html.erb
@@ -86,7 +86,7 @@
<%= f.input :enable_individual_requests, label: 'Enable partners to make requests for individuals?', as: :radio_buttons, collection: [[true, 'Yes'], [false, 'No']], label_method: :second, value_method: :first %>
<%= f.input :enable_quantity_based_requests, label: 'Enable partners to make quantity-based requests?', as: :radio_buttons, collection: [[true, 'Yes'], [false, 'No']], label_method: :second, value_method: :first %>
<%= f.input :ytd_on_distribution_printout, label: 'Show Year-to-date values on distribution printout?', as: :radio_buttons, collection: [[true, 'Yes'], [false, 'No']], label_method: :second, value_method: :first %>
- <%= f.input :use_single_step_invite_and_approve_partner_process, label: 'Use single step invite and approve partner process?', as: :radio_buttons, collection: [[true, 'Yes'], [false, 'No']], label_method: :second, value_method: :first %>
+ <%= f.input :one_step_partner_invite, label: 'Use one step invite and approve partner process?', as: :radio_buttons, collection: [[true, 'Yes'], [false, 'No']], label_method: :second, value_method: :first %>
<% default_email_text_hint = "You can use the variables %{partner_name}
, %{delivery_method}
, %{distribution_date}
, and %{comment}
to include the partner's name, delivery method, distribution date, and comments sent in the request." %>
<%= f.input :default_email_text, label: "Distribution Email Content", hint: default_email_text_hint.html_safe do %>
diff --git a/app/views/partners/_partner_row.html.erb b/app/views/partners/_partner_row.html.erb
index 92defdfd4d..2b64c0c451 100644
--- a/app/views/partners/_partner_row.html.erb
+++ b/app/views/partners/_partner_row.html.erb
@@ -1,5 +1,5 @@
<% status = partner_row.status%>
-<% can_single_step_invite_and_approve = partner_row.organization.use_single_step_invite_and_approve_partner_process %>
+<% can_one_step_invite_and_approve = partner_row.organization.one_step_partner_invite %>
<%= link_to partner_row.name, partner_path(partner_row) %> |
<%= link_to partner_row.email, "mailto:#{partner_row.email}" %> |
@@ -26,7 +26,7 @@
<% case status %>
<% when "uninvited" %>
- <% if can_single_step_invite_and_approve %>
+ <% if can_one_step_invite_and_approve %>
<% button_options = { icon: "envelope", type: "info", text: "Invite and Approve", size: "xs", confirm: "One step invite and approve #{partner_row.name} to begin using the partner application?" } %>
<%= invite_button_to(invite_and_approve_partner_path(partner_row), button_options) %>
<% else %>
diff --git a/db/migrate/20240131202431_add_one_step_partner_invite_to_organization.rb b/db/migrate/20240131202431_add_one_step_partner_invite_to_organization.rb
new file mode 100644
index 0000000000..79fcd23775
--- /dev/null
+++ b/db/migrate/20240131202431_add_one_step_partner_invite_to_organization.rb
@@ -0,0 +1,6 @@
+class AddOneStepPartnerInviteToOrganization < ActiveRecord::Migration[7.0]
+ def change
+ add_column :organizations, :one_step_partner_invite, :boolean, null: false
+ change_column_default :organizations, :one_step_partner_invite, false
+ end
+end
diff --git a/db/migrate/20240131202431_add_use_single_step_invite_and_approve_partner_process_to_organization.rb b/db/migrate/20240131202431_add_use_single_step_invite_and_approve_partner_process_to_organization.rb
deleted file mode 100644
index c8219efd23..0000000000
--- a/db/migrate/20240131202431_add_use_single_step_invite_and_approve_partner_process_to_organization.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class AddUseSingleStepInviteAndApprovePartnerProcessToOrganization < ActiveRecord::Migration[7.0]
- def change
- add_column :organizations, :use_single_step_invite_and_approve_partner_process, :boolean, null: false
- change_column_default :organizations, :use_single_step_invite_and_approve_partner_process, false
- end
-end
diff --git a/db/schema.rb b/db/schema.rb
index 567d89495a..e87c982f35 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -478,7 +478,7 @@
t.boolean "enable_individual_requests", default: true, null: false
t.boolean "enable_quantity_based_requests", default: true, null: false
t.boolean "ytd_on_distribution_printout", default: true, null: false
- t.boolean "use_single_step_invite_and_approve_partner_process", default: false, null: false
+ t.boolean "one_step_partner_invite", default: false, null: false
t.index ["latitude", "longitude"], name: "index_organizations_on_latitude_and_longitude"
t.index ["short_name"], name: "index_organizations_on_short_name"
end
diff --git a/spec/factories/organizations.rb b/spec/factories/organizations.rb
index d85f0a79fa..2614552e12 100644
--- a/spec/factories/organizations.rb
+++ b/spec/factories/organizations.rb
@@ -23,7 +23,7 @@
# state :string
# street :string
# url :string
-# use_single_step_invite_and_approve_partner_process :boolean default(FALSE), not null
+# one_step_partner_invite :boolean default(FALSE), not null
# ytd_on_distribution_printout :boolean default(TRUE), not null
# zipcode :string
# created_at :datetime not null
diff --git a/spec/models/organization_spec.rb b/spec/models/organization_spec.rb
index d6dc2f3e00..6a8bc16688 100644
--- a/spec/models/organization_spec.rb
+++ b/spec/models/organization_spec.rb
@@ -23,7 +23,7 @@
# state :string
# street :string
# url :string
-# use_single_step_invite_and_approve_partner_process :boolean default(FALSE), not null
+# one_step_partner_invite :boolean default(FALSE), not null
# ytd_on_distribution_printout :boolean default(TRUE), not null
# zipcode :string
# created_at :datetime not null
diff --git a/spec/system/organization_system_spec.rb b/spec/system/organization_system_spec.rb
index 3bd709d752..f5c3801f88 100644
--- a/spec/system/organization_system_spec.rb
+++ b/spec/system/organization_system_spec.rb
@@ -119,14 +119,14 @@
end
it "can disable if the org does NOT use single step invite and approve partner process" do
- choose("organization[use_single_step_invite_and_approve_partner_process]", option: false)
+ choose("organization[one_step_partner_invite]", option: false)
click_on "Save"
expect(page).to have_content("No")
end
it "can enable if the org uses single step invite and approve partner process" do
- choose("organization[use_single_step_invite_and_approve_partner_process]", option: true)
+ choose("organization[one_step_partner_invite]", option: true)
click_on "Save"
expect(page).to have_content("Yes")
|