Browse Source

feat: make the locations table (plus related content above & below) 2/3 width

pull/987/head
Sam Seed 4 years ago
parent
commit
8703ffc47c
  1. 72
      app/views/locations/index.html.erb

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

@ -11,41 +11,45 @@
<%= render partial: "organisations/headings", locals: { main: @scheme.service_name, sub: nil } %> <%= render partial: "organisations/headings", locals: { main: @scheme.service_name, sub: nil } %>
<%= render SubNavigationComponent.new(items: scheme_items(request.path, @scheme.id, "Locations")) %> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop">
<h2 class="govuk-visually-hidden">Locations</h2> <%= render SubNavigationComponent.new(items: scheme_items(request.path, @scheme.id, "Locations")) %>
<%= render SearchComponent.new(current_user:, search_label: "Search by location name or postcode", value: @searched) %> <h2 class="govuk-visually-hidden">Locations</h2>
<%= govuk_section_break(visible: true, size: "m") %> <%= render SearchComponent.new(current_user:, search_label: "Search by location name or postcode", value: @searched) %>
<%= govuk_table do |table| %> <%= govuk_section_break(visible: true, size: "m") %>
<%= table.caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular]) do |caption| %>
<%= render(SearchResultCaptionComponent.new(searched: @searched, count: @pagy.count, item_label:, total_count: @total_count, item: "locations", path: request.path)) %> <%= govuk_table do |table| %>
<% end %> <%= table.caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular]) do |caption| %>
<%= table.head do |head| %> <%= render(SearchResultCaptionComponent.new(searched: @searched, count: @pagy.count, item_label:, total_count: @total_count, item: "locations", path: request.path)) %>
<%= head.row do |row| %> <% end %>
<% row.cell(header: true, text: "Code", html_attributes: { <%= table.head do |head| %>
scope: "col", <%= head.row do |row| %>
}) %> <% row.cell(header: true, text: "Code", html_attributes: {
<% row.cell(header: true, text: "Postcode", html_attributes: { scope: "col",
scope: "col", }) %>
}) %> <% row.cell(header: true, text: "Postcode", html_attributes: {
<% row.cell(header: true, text: "Status", html_attributes: { scope: "col",
scope: "col", }) %>
}) %> <% row.cell(header: true, text: "Status", html_attributes: {
<% end %> scope: "col",
<% end %> }) %>
<% @locations.each do |location| %> <% end %>
<%= table.body do |body| %> <% end %>
<%= body.row do |row| %> <% @locations.each do |location| %>
<% row.cell(text: location.id) %> <%= table.body do |body| %>
<% row.cell(text: simple_format(location_cell_postcode(location, "/schemes/#{@scheme.id}/locations/#{location.id}"), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %> <%= body.row do |row| %>
<% row.cell(text: status_tag(location.status)) %> <% row.cell(text: location.id) %>
<% row.cell(text: simple_format(location_cell_postcode(location, "/schemes/#{@scheme.id}/locations/#{location.id}"), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %>
<% row.cell(text: status_tag(location.status)) %>
<% end %>
<% end %> <% end %>
<% end %>
<% end %> <% end %>
<% end %> <%= govuk_button_link_to "Add a location", new_scheme_location_path(scheme_id: @scheme.id), secondary: true %>
<% end %> </div>
<%= govuk_button_link_to "Add a location", new_scheme_location_path(scheme_id: @scheme.id), secondary: true %> </div>
<%== render partial: "pagy/nav", locals: { pagy: @pagy, item_name: "locations" } %> <%== render partial: "pagy/nav", locals: { pagy: @pagy, item_name: "locations" } %>

Loading…
Cancel
Save