Skip to content

Commit f1c7438

Browse files
committed
[#4504] PR feedback: remove approval disabled when form in error state
1 parent df73809 commit f1c7438

File tree

4 files changed

+3
-25
lines changed

4 files changed

+3
-25
lines changed

app/helpers/partners_helper.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ def show_submit_for_approval?(partner)
3131
partner.invited? || partner.recertification_required?
3232
end
3333

34-
def submit_for_approval_disabled?(partner_profile)
35-
partner_profile.errors.any?
36-
end
37-
3834
# In step-wise editing of the partner profile, the partial name is used as the section header by default.
3935
# This helper allows overriding the header with a custom display name if needed.
4036
def partial_display_name(partial)

app/views/partners/profiles/step/_form_actions.html.erb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
<%= f.button :submit, "Save Progress", class: 'btn btn-primary mr-2', data: { action: "click->accordion#disableOpenClose" } %>
55

66
<% if show_submit_for_approval?(current_partner) %>
7-
<% if submit_for_approval_disabled?(current_partner.profile) %>
8-
<span class="btn btn-success disabled">Submit Profile for Approval</span>
9-
<% else %>
10-
<%= link_to 'Submit Profile for Approval', partners_approval_request_path, method: :post, class: 'btn btn-success' %>
11-
<% end %>
7+
<%= link_to 'Submit Profile for Approval', partners_approval_request_path, method: :post, class: 'btn btn-success' %>
128
<% end %>
139
</div>

spec/helpers/partners_helper_spec.rb

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,6 @@
1616
end
1717
end
1818

19-
describe "submit_for_approval_disabled?" do
20-
it "returns true if partner profile has errors" do
21-
profile = build_stubbed(:partner_profile)
22-
profile.errors.add(:base, "Some error message")
23-
24-
expect(helper.submit_for_approval_disabled?(profile)).to be_truthy
25-
end
26-
27-
it "returns false if partner profile is valid" do
28-
profile = build_stubbed(:partner_profile)
29-
expect(helper.submit_for_approval_disabled?(profile)).to be_falsey
30-
end
31-
end
32-
3319
describe "partial_display_name" do
3420
it "returns the humanized name by default" do
3521
expect(helper.partial_display_name("agency_stability")).to eq("Agency stability")

spec/system/partners/profile_edit_system_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@
8686
expect(page).to have_css("#pick_up_person.accordion-collapse.collapse.show", visible: true)
8787
expect(page).to have_css("#partner_settings.accordion-collapse.collapse.show", visible: true)
8888

89-
# Submit for Approval is disabled
90-
expect(page).to have_css("span.btn.btn-success.disabled", text: "Submit Profile for Approval")
89+
# Submit for Approval is still enabled
90+
expect(page).to have_link("Submit Profile for Approval", href: partners_approval_request_path)
9191
end
9292
end
9393
end

0 commit comments

Comments
 (0)