Browse Source

Update hint message about created locations, and restrict location creation to relevant org statuses

pull/2764/head
Rachael Booth 8 months ago
parent
commit
07044775cf
  1. 7
      app/helpers/schemes_helper.rb
  2. 15
      app/views/locations/index.html.erb

7
app/helpers/schemes_helper.rb

@ -84,7 +84,12 @@ module SchemesHelper
when :deactivating_soon when :deactivating_soon
"This scheme deactivates on #{scheme.last_deactivation_date.to_formatted_s(:govuk_date)}. Any locations you add will be deactivated on the same date. Reactivate the scheme to add locations active after this date." "This scheme deactivates on #{scheme.last_deactivation_date.to_formatted_s(:govuk_date)}. Any locations you add will be deactivated on the same date. Reactivate the scheme to add locations active after this date."
when :deactivated when :deactivated
"This scheme deactivated on #{scheme.last_deactivation_date.to_formatted_s(:govuk_date)}. Any locations you add will be deactivated on the same date. Reactivate the scheme to add locations active after this date." case scheme.organisation.status
when :active
"This scheme deactivated on #{scheme.last_deactivation_date.to_formatted_s(:govuk_date)}. Any locations you add will be deactivated on the same date. Reactivate the scheme to add locations active after this date."
when :merged
"This scheme has been deactivated due to its organisation merging on #{scheme.organisation.merge_date.to_formatted_s(:govuk_date)}. Any locations you add will be deactivated on the same date. Use the new (after merge) organisation for schemes and locations active after this date."
end
end end
end end

15
app/views/locations/index.html.erb

@ -56,14 +56,13 @@
<% end %> <% end %>
<% end %> <% end %>
<% if status_hint_message = scheme_status_hint(@scheme) %> <% if LocationPolicy.new(current_user, @scheme.locations.new).create? && [:active, :merged].include?(@scheme.organisation.status) %>
<div class="govuk-hint"> <% if status_hint_message = scheme_status_hint(@scheme) %>
<%= status_hint_message %> <div class="govuk-hint">
</div> <%= status_hint_message %>
<br> </div>
<% end %> <br>
<% end %>
<% if LocationPolicy.new(current_user, @scheme.locations.new).create? %>
<%= govuk_button_to "Add a location", scheme_locations_path(@scheme), method: "post" %> <%= govuk_button_to "Add a location", scheme_locations_path(@scheme), method: "post" %>
<% end %> <% end %>
<br> <br>

Loading…
Cancel
Save