Browse Source

added simple view, scheme seed and authentication

pull/648/head
JG 3 years ago
parent
commit
b7235c769e
  1. 1
      app/controllers/schemes_controller.rb
  2. 30
      app/views/schemes/index.html.erb
  3. 7
      db/seeds.rb

1
app/controllers/schemes_controller.rb

@ -1,4 +1,5 @@
class SchemesController < ApplicationController
before_action :authenticate_user!
def index
@all_schemes = Scheme.all

30
app/views/schemes/index.html.erb

@ -0,0 +1,30 @@
<section class="app-table-group" tabindex="0">
<%= govuk_table do |table| %>
<%= table.head do |head| %>
<%= head.row do |row| %>
<% row.cell(header: true, text: "Code", html_attributes: {
scope: "col",
}) %>
<% row.cell(header: true, text: "Service", html_attributes: {
scope: "col",
}) %>
<% row.cell(header: true, text: "Managing agent", html_attributes: {
scope: "col",
}) %>
<% row.cell(header: true, text: "Created", html_attributes: {
scope: "col",
}) %>
<% end %>
<% end %>
<% @all_schemes.each do |scheme| %>
<%= table.body do |body| %>
<%= body.row do |row| %>
<% row.cell(text: scheme.code) %>
<% row.cell(text: scheme.service) %>
<% row.cell(text: scheme.organisation.name) %>
<% row.cell(text: scheme.created_at.to_formatted_s(:govuk_date)) %>
<% end %>
<% end %>
<% end %>
<% end %>
</section>

7
db/seeds.rb

@ -54,6 +54,13 @@ unless Rails.env.test?
pp "Seeded 3 dummy users"
end
Scheme.create!(
code: "7XYZ",
service: "Beulahside Care",
organisation: org,
created_at: Time.zone.now,
)
if LaRentRange.count.zero?
Dir.glob("config/rent_range_data/*.csv").each do |path|
start_year = File.basename(path, ".csv")

Loading…
Cancel
Save