diff --git a/app/controllers/partners/profiles_controller.rb b/app/controllers/partners/profiles_controller.rb index f0cfb1138c..e92085c037 100644 --- a/app/controllers/partners/profiles_controller.rb +++ b/app/controllers/partners/profiles_controller.rb @@ -20,7 +20,11 @@ def update if result.success? flash[:success] = "Details were successfully updated." if Flipper.enabled?("partner_step_form") - redirect_to edit_partners_profile_path + if params[:save_review] + redirect_to partners_profile_path + else + redirect_to edit_partners_profile_path + end else redirect_to partners_profile_path end diff --git a/app/helpers/partners_helper.rb b/app/helpers/partners_helper.rb index 86b93dfdcc..74974649f3 100644 --- a/app/helpers/partners_helper.rb +++ b/app/helpers/partners_helper.rb @@ -27,10 +27,6 @@ def humanize_boolean_3state(boolean) end end - def show_submit_for_approval?(partner) - partner.invited? || partner.recertification_required? - end - # In step-wise editing of the partner profile, the partial name is used as the section header by default. # This helper allows overriding the header with a custom display name if needed. def partial_display_name(partial) diff --git a/app/views/partners/profiles/step/_form_actions.html.erb b/app/views/partners/profiles/step/_form_actions.html.erb index 7d68f4d8c2..a98860c120 100644 --- a/app/views/partners/profiles/step/_form_actions.html.erb +++ b/app/views/partners/profiles/step/_form_actions.html.erb @@ -1,9 +1,6 @@ <%# locals: (f:, partner:) %>
- <%= f.button :submit, "Save Progress", class: 'btn btn-primary mr-2', data: { action: "click->accordion#disableOpenClose" } %> - - <% if show_submit_for_approval?(current_partner) %> - <%= link_to 'Submit Profile for Approval', partners_approval_request_path, method: :post, class: 'btn btn-success' %> - <% end %> + <%= f.submit "Save Progress", class: 'btn btn-primary mr-2', data: { action: "click->accordion#disableOpenClose" } %> + <%= f.submit "Save and Review", name: "save_review", class: 'btn btn-success' %>
diff --git a/spec/helpers/partners_helper_spec.rb b/spec/helpers/partners_helper_spec.rb index b195bf5d1e..f9c2b46131 100644 --- a/spec/helpers/partners_helper_spec.rb +++ b/spec/helpers/partners_helper_spec.rb @@ -1,21 +1,4 @@ describe PartnersHelper, type: :helper do - describe "show_submit_for_approval?" do - it "returns true if invited" do - partner = build_stubbed(:partner, status: :invited) - expect(helper.show_submit_for_approval?(partner)).to be_truthy - end - - it "returns true if recertification required" do - partner = build_stubbed(:partner, status: :recertification_required) - expect(helper.show_submit_for_approval?(partner)).to be_truthy - end - - it "returns false if awaiting review" do - partner = build_stubbed(:partner, status: :awaiting_review) - expect(helper.show_submit_for_approval?(partner)).to be_falsey - end - end - describe "partial_display_name" do it "returns the humanized name by default" do expect(helper.partial_display_name("agency_stability")).to eq("Agency stability") diff --git a/spec/system/partners/profile_edit_system_spec.rb b/spec/system/partners/profile_edit_system_spec.rb index eeda8566a8..3d35a5e580 100644 --- a/spec/system/partners/profile_edit_system_spec.rb +++ b/spec/system/partners/profile_edit_system_spec.rb @@ -43,12 +43,10 @@ all("input[type='submit'][value='Save Progress']").last.click expect(page).to have_css(".alert-success", text: "Details were successfully updated.") - # Submit for Approval - expect(page).to have_link("Submit Profile for Approval", href: partners_approval_request_path) - first(:link, "Submit Profile for Approval").click + # Submit and Review + all("input[type='submit'][value='Save and Review']").last.click expect(current_path).to eq(partners_profile_path) - expect(page).to have_css(".alert-success", text: "You have submitted your details for approval.") - expect(page).to have_css(".badge", text: "Awaiting Review") + expect(page).to have_css(".alert-success", text: "Details were successfully updated.") end it "displays the edit view with sections containing validation errors expanded" do @@ -86,8 +84,19 @@ expect(page).to have_css("#pick_up_person.accordion-collapse.collapse.show", visible: true) expect(page).to have_css("#partner_settings.accordion-collapse.collapse.show", visible: true) - # Submit for Approval is still enabled - expect(page).to have_link("Submit Profile for Approval", href: partners_approval_request_path) + # Try to Submit and Review from error state + all("input[type='submit'][value='Save and Review']").last.click + + # Expect an alert-danger message containing validation errors + expect(page).to have_css(".alert-danger", text: /There is a problem/) + expect(page).to have_content("No social media presence must be checked if you have not provided any of Website, Twitter, Facebook, or Instagram.") + expect(page).to have_content("Enable child based requests At least one request type must be set") + expect(page).to have_content("Pick up email can't have more than three email addresses") + + # Expect media section, executive director section, and partner settings section to be opened + expect(page).to have_css("#media_information.accordion-collapse.collapse.show", visible: true) + expect(page).to have_css("#pick_up_person.accordion-collapse.collapse.show", visible: true) + expect(page).to have_css("#partner_settings.accordion-collapse.collapse.show", visible: true) end end end