Skip to content

Commit

Permalink
Rename field to one_step_invite_and_approve
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-truong-main committed Feb 2, 2024
1 parent bd2ef08 commit 4156f43
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion app/controllers/organizations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/models/organization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/views/organizations/_details.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@
</p>
</div>
<div class="mb-4">
<h3 class='font-bold'>Use Single-step Invite and Approve Partner Process?</h3>
<h3 class='font-bold'>Use One step Partner invite and approve process?</h3>
<p>
<%= humanize_boolean(@organization.use_single_step_invite_and_approve_partner_process) %>
<%= humanize_boolean(@organization.one_step_partner_invite) %>
</p>
</div>
<% if @organization.logo.attached? %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/organizations/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 <code>%{partner_name}</code>, <code>%{delivery_method}</code>, <code>%{distribution_date}</code>, and <code>%{comment}</code> 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 %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/partners/_partner_row.html.erb
Original file line number Diff line number Diff line change
@@ -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 %>
<tr>
<td class='text-blue-500'><%= link_to partner_row.name, partner_path(partner_row) %></td>
<td><%= link_to partner_row.email, "mailto:#{partner_row.email}" %></td>
Expand All @@ -26,7 +26,7 @@
<td>
<% 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 %>
Expand Down
Original file line number Diff line number Diff line change
@@ -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

This file was deleted.

2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/organizations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/models/organization_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/system/organization_system_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 4156f43

Please sign in to comment.