Browse Source

more change in wip

pull/671/head
JG 3 years ago
parent
commit
bbaf792280
  1. 8
      app/controllers/schemes_controller.rb
  2. 2
      app/views/schemes/check_answers.html.erb
  3. 11
      app/views/schemes/confirm_secondary.html.erb
  4. 18
      app/views/schemes/details.html.erb
  5. 4
      app/views/schemes/new.html.erb
  6. 8
      app/views/schemes/primary_client_group.html.erb
  7. 8
      app/views/schemes/secondary_client_group.html.erb
  8. 10
      app/views/schemes/support.html.erb
  9. 16
      config/routes.rb

8
app/controllers/schemes_controller.rb

@ -69,10 +69,16 @@ class SchemesController < ApplicationController
render "schemes/support"
end
def details
@scheme = Scheme.find_by(id: params[:scheme_id])
render "schemes/details"
end
def check_answers
@scheme = Scheme.find_by(id: params[:scheme_id])
if params[:scheme]
required_params = params.require(:scheme).permit(:intended_stay, :support_type)
required_params = params.require(:scheme).permit(:intended_stay, :support_type, :service_name, :sensitive, :organisation_id, :scheme_type, :registered_under_care_act, :total_units, :id, :confirmed)
required_params[:sensitive] = required_params[:sensitive].to_i if required_params[:sensitive]
@scheme.update(required_params)
end
render "schemes/check_answers"

2
app/views/schemes/check_answers.html.erb

@ -7,6 +7,8 @@
) %>
<% end %>
<%= render partial: "organisations/headings", locals: { main: "Check your changes before updating this scheme", sub: @scheme.service_name } %>
<%= govuk_tabs(title: "Check your answers before creating this scheme") do |component| %>
<% component.tab(label: 'Scheme') do %>
<%= govuk_summary_list do |summary_list| %>

11
app/views/schemes/confirm_secondary.html.erb

@ -1,26 +1,25 @@
<% content_for :title, "What client group is this scheme intended for?" %>
<% content_for :before_content do %>
<%= govuk_back_link(
text: "Back",
href: "/schemes/#{@scheme.id}/primary",
href: "/schemes/#{@scheme.id}/primary-client-group",
) %>
<% end %>
<%= render partial: "organisations/headings", locals: { main: "Does this scheme provide for another client group?", sub: @scheme.service_name } %>
<%= form_for(:confirmed, method: :patch, url: scheme_secondary_path(scheme_id: @scheme.id)) do |f| %>
<%= form_for(:confirmed, method: :patch, url: scheme_secondary_client_group_path(scheme_id: @scheme.id)) do |f| %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l">
<%= content_for(:title) %>
</h1>
<% selection = ["Yes", "No"].map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } %>
<%= f.govuk_collection_radio_buttons :selection,
selection,
:id,
:name,
{ checked: "Yes" },
legend: nil
%>

18
app/views/schemes/details.html.erb

@ -1,28 +1,27 @@
<% content_for :title, "Create a new supported housing scheme" %>
<% content_for :title, "Scheme details" %>
<% content_for :before_content do %>
<%= govuk_back_link(
text: "Back",
href: 'javascript:history.go(-1);',
href: "/schemes/#{@scheme.id}/secondary",
) %>
<% end %>
<%= form_for(@scheme, method: :patch, url: scheme_details_path(scheme_id: @scheme.id)) do |f| %>
<%= render partial: "organisations/headings", locals: { main: "Scheme details", sub: @scheme.service_name } %>
<%= form_for(@scheme, method: :patch, url: scheme_check_answers_path(scheme_id: @scheme.id)) do |f| %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= f.govuk_error_summary %>
<h1 class="govuk-heading-l">
<%= content_for(:title) %>
</h1>
<%= 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,
0,
1,
0,
checked: @scheme.sensitive?,
multiple: false,
label: { text: "This scheme contains confidential information" } %>
@ -41,7 +40,8 @@
:name,
label: { text: "Which organisation manages this scheme", size: "m" },
hint: { text: "Enter organisation name" },
options: { disabled: [""], selected: selected_option(answer_options) },
selected: selected_option(@scheme.organisation.id),
options: { disabled: [""], selected: selected_option(@scheme.organisation.name) },
"data-controller": %w[accessible-autocomplete conditional-filter] %>
<% end %>

4
app/views/schemes/new.html.erb

@ -3,7 +3,7 @@
<% content_for :before_content do %>
<%= govuk_back_link(
text: "Back",
href: :back,
href: 'javascript:history.go(-1);',
) %>
<% end %>
@ -21,8 +21,8 @@
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,
0,
1,
0,
multiple: false,
label: { text: "This scheme contains confidential information" } %>

8
app/views/schemes/primary_client_group.html.erb

@ -1,3 +1,5 @@
<% content_for :title, "What client group is this scheme intended for?" %>
<% content_for :before_content do %>
<%= govuk_back_link(
text: "Back",
@ -7,15 +9,11 @@
<%= render partial: "organisations/headings", locals: { main: "What client group is this scheme intended for?", sub: @scheme.service_name } %>
<%= form_for(@scheme, method: :patch, url: scheme_confirm_secondary_path(scheme_id: @scheme.id)) do |f| %>
<%= form_for(@scheme, method: :patch, url: scheme_confirm_secondary_client_group_path(scheme_id: @scheme.id)) do |f| %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= f.govuk_error_summary %>
<h1 class="govuk-heading-l">
<%= content_for(:title) %>
</h1>
<legend class="govuk-fieldset__legend">
</legend>

8
app/views/schemes/secondary_client_group.html.erb

@ -1,7 +1,9 @@
<% content_for :title, "What is the other client group?" %>
<% content_for :before_content do %>
<%= govuk_back_link(
text: "Back",
href: "/schemes/#{@scheme.id}/confirm_secondary",
href: "/schemes/#{@scheme.id}/confirm-secondary-client-group",
) %>
<% end %>
@ -12,10 +14,6 @@
<div class="govuk-grid-column-two-thirds">
<%= f.govuk_error_summary %>
<h1 class="govuk-heading-l">
<%= content_for(:title) %>
</h1>
<legend class="govuk-fieldset__legend">
</legend>

10
app/views/schemes/support.html.erb

@ -1,21 +1,19 @@
<% content_for :title, "What support does this scheme provide?" %>
<% content_for :before_content do %>
<%= govuk_back_link(
text: "Back",
href: "/schemes/#{@scheme.id}/secondary",
href: "/schemes/#{@scheme.id}/secondary-client-group",
) %>
<% end %>
<%= render partial: "organisations/headings", locals: { main: "What support does this scheme provide?", sub: @scheme.service_name } %>
<%= form_for(@scheme, method: :patch, url: scheme_check_answers_path(scheme_id: @scheme.id)) do |f| %>
<%= form_for(@scheme, method: :patch, url: scheme_check_your_answers_path(scheme_id: @scheme.id)) do |f| %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= f.govuk_error_summary %>
<h1 class="govuk-heading-l">
<%= content_for(:title) %>
</h1>
<legend class="govuk-fieldset__legend">
</legend>

16
config/routes.rb

@ -36,17 +36,17 @@ Rails.application.routes.draw do
end
resources :schemes do
patch "primary", to: "schemes#primary_client_group"
get "primary", to: "schemes#primary_client_group"
patch "secondary", to: "schemes#secondary_client_group"
get "secondary", to: "schemes#secondary_client_group"
patch "primary-client-group", to: "schemes#primary_client_group"
get "primary-client-group", to: "schemes#primary_client_group"
patch "secondary-client-group", to: "schemes#secondary_client_group"
get "secondary-client-group", to: "schemes#secondary_client_group"
patch "support", to: "schemes#support"
get "support", to: "schemes#support"
get "update", to: "schemes#update"
patch "check_answers", to: "schemes#check_answers"
get "check_answers", to: "schemes#check_answers"
patch "confirm_secondary", to: "schemes#confirm_secondary_group"
get "confirm_secondary", to: "schemes#confirm_secondary_group"
patch "check-your-answers", to: "schemes#check_answers"
get "check-your-answers", to: "schemes#check_answers"
patch "confirm-secondary-client-group", to: "schemes#confirm_secondary_group"
get "confirm-secondary-client-group", to: "schemes#confirm_secondary_group"
member do
get "locations", to: "schemes#locations"

Loading…
Cancel
Save