Browse Source

hide change location answers for providers

pull/1642/head
Phil Lee 3 years ago
parent
commit
bf2398b500
  1. 24
      app/views/locations/check_answers.html.erb
  2. 11
      spec/views/locations/check_answers.html.erb_spec.rb

24
app/views/locations/check_answers.html.erb

@ -15,20 +15,22 @@
<%= render partial: "organisations/headings", locals: { main: "Check your answers", sub: "Add a location to #{@scheme.service_name}" } %> <%= render partial: "organisations/headings", locals: { main: "Check your answers", sub: "Add a location to #{@scheme.service_name}" } %>
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop"> <div class="govuk-grid-column-two-thirds-from-desktop">
<%= govuk_summary_list do |summary_list| %> <%= govuk_summary_list do |summary_list| %>
<% display_location_attributes_for_check_answers(@location).each do |attr| %> <% display_location_attributes_for_check_answers(@location).each do |attr| %>
<%= summary_list.row do |row| %> <%= summary_list.row do |row| %>
<% row.key { attr[:name] } %> <% row.key { attr[:name] } %>
<% row.value { details_html(attr) } %> <% row.value { details_html(attr) } %>
<% row.action(text: action_text_helper(attr, @location), href: location_edit_path(@location, attr[:attribute])) %> <% if LocationPolicy.new(current_user, @location).update? %>
<% end %> <% row.action(text: action_text_helper(attr, @location), href: location_edit_path(@location, attr[:attribute])) %>
<% end %> <% end %>
<% end %> <% end %>
</div> <% end %>
<% end %>
</div>
</div> </div>
<% if LocationPolicy.new(current_user, Location).create? %> <% if LocationPolicy.new(current_user, @location).create? %>
<div class="govuk-button-group"> <div class="govuk-button-group">
<%= govuk_button_to "Save and return to locations", scheme_location_confirm_path(@scheme, @location, route: params[:route]), method: :patch %> <%= govuk_button_to "Save and return to locations", scheme_location_confirm_path(@scheme, @location, route: params[:route]), method: :patch %>
<%= govuk_button_link_to "Cancel", scheme_locations_path(@scheme), secondary: true %> <%= govuk_button_link_to "Cancel", scheme_locations_path(@scheme), secondary: true %>

11
spec/views/locations/check_answers.html.erb_spec.rb

@ -54,5 +54,16 @@ RSpec.describe "locations/check_answers.html.erb" do
expect(rendered).not_to have_content("Save and return to locations") expect(rendered).not_to have_content("Save and return to locations")
end end
it "does not see change answer links" do
assign(:scheme, scheme)
assign(:location, location)
allow(view).to receive(:current_user).and_return(user)
render
expect(rendered).not_to have_content("Change")
end
end end
end end

Loading…
Cancel
Save