From b7235c769e420a6bee89e227c1f902a91e79e442 Mon Sep 17 00:00:00 2001 From: JG Date: Thu, 9 Jun 2022 07:01:15 +0100 Subject: [PATCH] added simple view, scheme seed and authentication --- app/controllers/schemes_controller.rb | 1 + app/views/schemes/index.html.erb | 30 +++++++++++++++++++++++++++ db/seeds.rb | 7 +++++++ 3 files changed, 38 insertions(+) diff --git a/app/controllers/schemes_controller.rb b/app/controllers/schemes_controller.rb index 3cc2c5d7c..a58e5cdc1 100644 --- a/app/controllers/schemes_controller.rb +++ b/app/controllers/schemes_controller.rb @@ -1,4 +1,5 @@ class SchemesController < ApplicationController + before_action :authenticate_user! def index @all_schemes = Scheme.all diff --git a/app/views/schemes/index.html.erb b/app/views/schemes/index.html.erb index e69de29bb..4284f1aad 100644 --- a/app/views/schemes/index.html.erb +++ b/app/views/schemes/index.html.erb @@ -0,0 +1,30 @@ +
+ <%= 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 %> +
diff --git a/db/seeds.rb b/db/seeds.rb index 54ffb843a..6f9e11f69 100644 --- a/db/seeds.rb +++ b/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")