Browse Source

refactor: erblinting

pull/1034/head
natdeanlewissoftwire 4 years ago
parent
commit
24ff6b3e89
  1. 18
      app/views/locations/check_answers.html.erb
  2. 2
      app/views/locations/index.html.erb

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

@ -18,14 +18,16 @@
<% next if %w[location_code status].include? attr[:attribute] %> <% next if %w[location_code status].include? attr[:attribute] %>
<%= summary_list.row do |row| %> <%= summary_list.row do |row| %>
<% row.key { attr[:name] } %> <% row.key { attr[:name] } %>
<% row.value { <%= row.value do %>
if attr[:attribute].eql?("status") <% case attr[:attribute]
status_tag(attr[:value]) when "status"
elsif attr[:attribute].eql?("availability") status_tag(attr[:value])
details_html(name: "Availability", value: @location.startdate.present? ? @location.startdate.to_formatted_s(:govuk_date) : nil, attribute: "startdate") when "availability"
else details_html(name: "Availability", value: @location.startdate.present? ? @location.startdate.to_formatted_s(:govuk_date) : nil, attribute: "startdate")
details_html(attr) else
end } %> details_html(attr)
end %>
<% end %>
<% row.action(text: "Change", href: location_edit_path(@location, attr[:attribute])) unless attr[:name] == "Status" %> <% row.action(text: "Change", href: location_edit_path(@location, attr[:attribute])) unless attr[:name] == "Status" %>
<% end %> <% end %>
<% end %> <% end %>

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

@ -52,7 +52,7 @@
<%= table.body do |body| %> <%= table.body do |body| %>
<%= body.row do |row| %> <%= body.row do |row| %>
<% row.cell(text: location.id) %> <% row.cell(text: location.id) %>
<% row.cell(text: simple_format(location_cell_postcode(location, "/schemes/#{@scheme.id}/locations/#{location.id}#{"/check-answers" if location.incomplete?}"), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %> <% row.cell(text: simple_format(location_cell_postcode(location, "/schemes/#{@scheme.id}/locations/#{location.id}#{'/check-answers' if location.incomplete?}"), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %>
<% row.cell(text: location.units) %> <% row.cell(text: location.units) %>
<% row.cell(text: simple_format("<span>#{location.type_of_unit}</span>")) %> <% row.cell(text: simple_format("<span>#{location.type_of_unit}</span>")) %>
<% row.cell(text: location.mobility_type) %> <% row.cell(text: location.mobility_type) %>

Loading…
Cancel
Save