Browse Source

Do not display save buttons (#2072)

pull/2079/head
kosiakkatrina 1 year ago committed by GitHub
parent
commit
fdf6bb87b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 26
      app/views/form/page.html.erb
  2. 1
      spec/features/form/validations_spec.rb

26
app/views/form/page.html.erb

@ -63,18 +63,20 @@
<%= f.hidden_field :interruption_page_referrer_type, value: @interruption_page_referrer_type %> <%= f.hidden_field :interruption_page_referrer_type, value: @interruption_page_referrer_type %>
<div class="govuk-button-group"> <div class="govuk-button-group">
<% if accessed_from_duplicate_logs?(request.query_parameters["referrer"]) %> <% if !@page.interruption_screen? %>
<%= f.govuk_submit "Save changes" %> <% if accessed_from_duplicate_logs?(request.query_parameters["referrer"]) %>
<%= govuk_link_to "Cancel", send("#{@log.class.name.underscore}_duplicate_logs_path", @log, original_log_id: request.query_parameters["original_log_id"]) %> <%= f.govuk_submit "Save changes" %>
<% elsif returning_to_question_page?(@page, request.query_parameters["referrer"]) %> <%= govuk_link_to "Cancel", send("#{@log.class.name.underscore}_duplicate_logs_path", @log, original_log_id: request.query_parameters["original_log_id"]) %>
<%= f.govuk_submit "Save changes" %> <% elsif returning_to_question_page?(@page, request.query_parameters["referrer"]) %>
<%= govuk_link_to "Cancel", send(@log.form.cancel_path(@page, @log), @log) %> <%= f.govuk_submit "Save changes" %>
<% else %> <%= govuk_link_to "Cancel", send(@log.form.cancel_path(@page, @log), @log) %>
<%= f.govuk_submit "Save and continue" %> <% else %>
<%= govuk_link_to( <%= f.govuk_submit "Save and continue" %>
(@page.skip_text || "Skip for now"), <%= govuk_link_to(
(@page.skip_href(@log) || send(@log.form.next_page_redirect_path(@page, @log, current_user), @log)), (@page.skip_text || "Skip for now"),
) %> (@page.skip_href(@log) || send(@log.form.next_page_redirect_path(@page, @log, current_user), @log)),
) %>
<% end %>
<% end %> <% end %>
</div> </div>
</div> </div>

1
spec/features/form/validations_spec.rb

@ -149,6 +149,7 @@ RSpec.describe "validations" do
expect(page).to have_current_path("/lettings-logs/#{lettings_log.id}/net-income-value-check") expect(page).to have_current_path("/lettings-logs/#{lettings_log.id}/net-income-value-check")
expect(page).to have_content("You told us the lead tenant’s income is £750.00 weekly.") expect(page).to have_content("You told us the lead tenant’s income is £750.00 weekly.")
expect(page).to have_content("This is higher than we would expect for their working situation.") expect(page).to have_content("This is higher than we would expect for their working situation.")
expect(page).not_to have_button("Save changes")
click_button("Confirm and continue") click_button("Confirm and continue")
expect(page).to have_current_path("/lettings-logs/#{lettings_log.id}/net-income-uc-proportion") expect(page).to have_current_path("/lettings-logs/#{lettings_log.id}/net-income-uc-proportion")
end end

Loading…
Cancel
Save