Browse Source

feat: add new tags to helper and reorganise page (with hardcoded active status)

CLDC-1665-add-scheme-status^2
natdeanlewissoftwire 2 years ago
parent
commit
69e2cede57
  1. 10
      app/helpers/tag_helper.rb
  2. 14
      app/views/schemes/_scheme_list.html.erb

10
app/helpers/tag_helper.rb

@ -6,6 +6,11 @@ module TagHelper
cannot_start_yet: "Cannot start yet", cannot_start_yet: "Cannot start yet",
in_progress: "In progress", in_progress: "In progress",
completed: "Completed", completed: "Completed",
active: "Active",
incomplete: "Incomplete",
deactivates_soon: "Deactivates soon",
reactivates_soon: "Reactivates soon",
deactivated: "Deactivated",
}.freeze }.freeze
COLOUR = { COLOUR = {
@ -13,6 +18,11 @@ module TagHelper
cannot_start_yet: "grey", cannot_start_yet: "grey",
in_progress: "blue", in_progress: "blue",
completed: "green", completed: "green",
active: "green",
incomplete: "red",
deactivates_soon: "yellow",
reactivates_soon: "blue",
deactivated: "grey",
}.freeze }.freeze
def status_tag(status, classes = []) def status_tag(status, classes = [])

14
app/views/schemes/_scheme_list.html.erb

@ -5,19 +5,16 @@
<% end %> <% end %>
<%= table.head do |head| %> <%= table.head do |head| %>
<%= head.row do |row| %> <%= head.row do |row| %>
<% row.cell(header: true, text: "Code", html_attributes: {
scope: "col",
}) %>
<% row.cell(header: true, text: "Scheme", html_attributes: { <% row.cell(header: true, text: "Scheme", html_attributes: {
scope: "col", scope: "col",
}) %> }) %>
<% row.cell(header: true, text: "Locations", html_attributes: { <% row.cell(header: true, text: "Code", html_attributes: {
scope: "col", scope: "col",
}) %> }) %>
<% row.cell(header: true, text: "Support provided by", html_attributes: { <% row.cell(header: true, text: "Locations", html_attributes: {
scope: "col", scope: "col",
}) %> }) %>
<% row.cell(header: true, text: "Created", html_attributes: { <% row.cell(header: true, text: "Status", html_attributes: {
scope: "col", scope: "col",
}) %> }) %>
<% end %> <% end %>
@ -25,11 +22,10 @@
<% @schemes.each do |scheme| %> <% @schemes.each do |scheme| %>
<%= table.body do |body| %> <%= table.body do |body| %>
<%= body.row do |row| %> <%= body.row do |row| %>
<% row.cell(text: scheme.id_to_display) %>
<% row.cell(text: simple_format(scheme_cell(scheme), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %> <% row.cell(text: simple_format(scheme_cell(scheme), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %>
<% row.cell(text: scheme.id_to_display) %>
<% row.cell(text: scheme.locations&.count) %> <% row.cell(text: scheme.locations&.count) %>
<% row.cell(text: scheme.managing_organisation&.name) %> <% row.cell(text: status_tag("active")) %>
<% row.cell(text: scheme.confirmed? ? scheme.created_at.to_formatted_s(:govuk_date) : govuk_tag(colour: "grey", text: "Incomplete")) %>
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>

Loading…
Cancel
Save