Skip to content

Commit 1f94522

Browse files
committed
[#4504] replace Submit for Approval link with Save and Review button
1 parent f1c7438 commit 1f94522

File tree

5 files changed

+23
-34
lines changed

5 files changed

+23
-34
lines changed

app/controllers/partners/profiles_controller.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ def update
2020
if result.success?
2121
flash[:success] = "Details were successfully updated."
2222
if Flipper.enabled?("partner_step_form")
23-
redirect_to edit_partners_profile_path
23+
if params[:save_review]
24+
redirect_to partners_profile_path
25+
else
26+
redirect_to edit_partners_profile_path
27+
end
2428
else
2529
redirect_to partners_profile_path
2630
end

app/helpers/partners_helper.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ def humanize_boolean_3state(boolean)
2727
end
2828
end
2929

30-
def show_submit_for_approval?(partner)
31-
partner.invited? || partner.recertification_required?
32-
end
33-
3430
# In step-wise editing of the partner profile, the partial name is used as the section header by default.
3531
# This helper allows overriding the header with a custom display name if needed.
3632
def partial_display_name(partial)
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
<%# locals: (f:, partner:) %>
22

33
<div class="form-group mt-4 d-flex justify-content-start mx-5">
4-
<%= f.button :submit, "Save Progress", class: 'btn btn-primary mr-2', data: { action: "click->accordion#disableOpenClose" } %>
5-
6-
<% if show_submit_for_approval?(current_partner) %>
7-
<%= link_to 'Submit Profile for Approval', partners_approval_request_path, method: :post, class: 'btn btn-success' %>
8-
<% end %>
4+
<%= f.submit "Save Progress", class: 'btn btn-primary mr-2', data: { action: "click->accordion#disableOpenClose" } %>
5+
<%= f.submit "Save and Review", name: "save_review", class: 'btn btn-success' %>
96
</div>

spec/helpers/partners_helper_spec.rb

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,4 @@
11
describe PartnersHelper, type: :helper do
2-
describe "show_submit_for_approval?" do
3-
it "returns true if invited" do
4-
partner = build_stubbed(:partner, status: :invited)
5-
expect(helper.show_submit_for_approval?(partner)).to be_truthy
6-
end
7-
8-
it "returns true if recertification required" do
9-
partner = build_stubbed(:partner, status: :recertification_required)
10-
expect(helper.show_submit_for_approval?(partner)).to be_truthy
11-
end
12-
13-
it "returns false if awaiting review" do
14-
partner = build_stubbed(:partner, status: :awaiting_review)
15-
expect(helper.show_submit_for_approval?(partner)).to be_falsey
16-
end
17-
end
18-
192
describe "partial_display_name" do
203
it "returns the humanized name by default" do
214
expect(helper.partial_display_name("agency_stability")).to eq("Agency stability")

spec/system/partners/profile_edit_system_spec.rb

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,10 @@
4343
all("input[type='submit'][value='Save Progress']").last.click
4444
expect(page).to have_css(".alert-success", text: "Details were successfully updated.")
4545

46-
# Submit for Approval
47-
expect(page).to have_link("Submit Profile for Approval", href: partners_approval_request_path)
48-
first(:link, "Submit Profile for Approval").click
46+
# Submit and Review
47+
all("input[type='submit'][value='Save and Review']").last.click
4948
expect(current_path).to eq(partners_profile_path)
50-
expect(page).to have_css(".alert-success", text: "You have submitted your details for approval.")
51-
expect(page).to have_css(".badge", text: "Awaiting Review")
49+
expect(page).to have_css(".alert-success", text: "Details were successfully updated.")
5250
end
5351

5452
it "displays the edit view with sections containing validation errors expanded" do
@@ -86,8 +84,19 @@
8684
expect(page).to have_css("#pick_up_person.accordion-collapse.collapse.show", visible: true)
8785
expect(page).to have_css("#partner_settings.accordion-collapse.collapse.show", visible: true)
8886

89-
# Submit for Approval is still enabled
90-
expect(page).to have_link("Submit Profile for Approval", href: partners_approval_request_path)
87+
# Try to Submit and Review from error state
88+
all("input[type='submit'][value='Save and Review']").last.click
89+
90+
# Expect an alert-danger message containing validation errors
91+
expect(page).to have_css(".alert-danger", text: /There is a problem/)
92+
expect(page).to have_content("No social media presence must be checked if you have not provided any of Website, Twitter, Facebook, or Instagram.")
93+
expect(page).to have_content("Enable child based requests At least one request type must be set")
94+
expect(page).to have_content("Pick up email can't have more than three email addresses")
95+
96+
# Expect media section, executive director section, and partner settings section to be opened
97+
expect(page).to have_css("#media_information.accordion-collapse.collapse.show", visible: true)
98+
expect(page).to have_css("#pick_up_person.accordion-collapse.collapse.show", visible: true)
99+
expect(page).to have_css("#partner_settings.accordion-collapse.collapse.show", visible: true)
91100
end
92101
end
93102
end

0 commit comments

Comments
 (0)