From c16b28fbcd1321ed4030814a76ee653803c8cf65 Mon Sep 17 00:00:00 2001 From: Kat Date: Fri, 24 Jun 2022 15:57:04 +0100 Subject: [PATCH] remove details view and path Co-authored-by: baarkerlounger --- app/controllers/schemes_controller.rb | 15 +----- app/views/schemes/details.html.erb | 69 --------------------------- config/routes.rb | 1 - 3 files changed, 2 insertions(+), 83 deletions(-) delete mode 100644 app/views/schemes/details.html.erb diff --git a/app/controllers/schemes_controller.rb b/app/controllers/schemes_controller.rb index 38d83b427..a9dcca628 100644 --- a/app/controllers/schemes_controller.rb +++ b/app/controllers/schemes_controller.rb @@ -31,8 +31,7 @@ class SchemesController < ApplicationController end def create - @scheme = Scheme.new(clean_params) - @scheme.save! + @scheme = Scheme.create!(clean_params) @path = scheme_confirm_secondary_client_group_path(scheme_id: @scheme.id) render "schemes/primary_client_group" @@ -57,6 +56,7 @@ class SchemesController < ApplicationController end def confirm_secondary_client_group + @scheme = Scheme.find_by(id: params[:scheme_id]) @path = params[:check_answers] ? scheme_secondary_client_group_path(scheme_id: @scheme.id, check_answers: true) : scheme_secondary_client_group_path(scheme_id: @scheme.id) if params[:scheme] @@ -95,17 +95,6 @@ class SchemesController < ApplicationController render "schemes/support" end - def details - @scheme = Scheme.find_by(id: params[:scheme_id]) - @path = if params[:check_answers] - scheme_check_your_answers_path(scheme_id: @scheme.id) - else - scheme_primary_client_group_path(scheme_id: @scheme.id) - end - - render "schemes/details" - end - def check_answers @scheme = Scheme.find_by(id: params[:scheme_id]) if params[:scheme] diff --git a/app/views/schemes/details.html.erb b/app/views/schemes/details.html.erb deleted file mode 100644 index d3c251e6b..000000000 --- a/app/views/schemes/details.html.erb +++ /dev/null @@ -1,69 +0,0 @@ -<% content_for :title, "Create a new supported housing scheme" %> - -<% content_for :before_content do %> - <%= govuk_back_link( - text: "Back", - href: :back, - ) %> -<% end %> - -<%= render partial: "organisations/headings", locals: { main: "Create a new supported housing scheme", sub: nil } %> - -<%= form_for(@scheme, method: :patch, url: @path) do |f| %> -
-
- <%= f.govuk_error_summary %> - - <%= f.govuk_text_field :service_name, - label: { text: "Scheme name", size: "m" }, - hint: { text: "This is how you’ll refer to this supported housing scheme within your organisation. For example, the name could relate to the address or location. You’ll be able to see the client group when selecting it." } %> - - <%= f.govuk_check_box :sensitive, - 1, - 0, - checked: @scheme.sensitive?, - multiple: false, - label: { text: "This scheme contains confidential information" } %> - - <% if current_user.support? %> - <% answer_options = Organisation.all.map { |org| OpenStruct.new(id: org.id, name: org.name) } %> - - <%= f.govuk_collection_select :organisation_id, - answer_options, - :id, - :name, - label: { text: "Which organisation manages this scheme", size: "m" }, - hint: { text: "Enter organisation name" }, - options: { required: true }, - "data-controller": %w[accessible-autocomplete conditional-filter] %> - <% end %> - - <% if current_user.data_coordinator? %> - <%= f.hidden_field :organisation_id, value: current_user.organisation.id %> - <% end %> - - <% scheme_types_selection = Scheme.scheme_types.keys.excluding("Missing").map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } %> - - <%= f.govuk_collection_radio_buttons :scheme_type, - scheme_types_selection, - :id, - :name, - legend: { text: "What is this type of scheme?", size: "m" } %> - - <% care_acts_selection = Scheme.registered_under_care_acts.keys.reverse.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } %> - - <%= f.govuk_collection_radio_buttons :registered_under_care_act, - care_acts_selection, - :id, - :name, - legend: { text: "Is this scheme registered under the Care Standards Act 2000?", size: "m" } %> - - <%= f.govuk_number_field :total_units, - width: 2, - label: { text: "Total number of units", size: "m" }, - hint: { text: "For example, a unit can be a bedroom in a shared house or flat, or a house with 4 bedrooms. Do not include bedrooms used for wardens, managers, volunteers or sleep-in staff." } %> - - <%= f.govuk_submit "Save and continue" %> -
-
-<% end %> diff --git a/config/routes.rb b/config/routes.rb index a0efdee0e..b9be442b3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -44,7 +44,6 @@ Rails.application.routes.draw do get "secondary-client-group", to: "schemes#secondary_client_group" patch "support", to: "schemes#support" get "support", to: "schemes#support" - get "details", to: "schemes#details" patch "check-your-answers", to: "schemes#check_answers" get "check-your-answers", to: "schemes#check_answers" get "update", to: "schemes#update"