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" render "schemes/support"
end end
def details
@scheme = Scheme.find_by(id: params[:scheme_id])
render "schemes/details"
end
def check_answers def check_answers
@scheme = Scheme.find_by(id: params[:scheme_id]) @scheme = Scheme.find_by(id: params[:scheme_id])
if params[:scheme] 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) @scheme.update(required_params)
end end
render "schemes/check_answers" render "schemes/check_answers"

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

@ -7,6 +7,8 @@
) %> ) %>
<% end %> <% 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| %> <%= govuk_tabs(title: "Check your answers before creating this scheme") do |component| %>
<% component.tab(label: 'Scheme') do %> <% component.tab(label: 'Scheme') do %>
<%= govuk_summary_list do |summary_list| %> <%= 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 %> <% content_for :before_content do %>
<%= govuk_back_link( <%= govuk_back_link(
text: "Back", text: "Back",
href: "/schemes/#{@scheme.id}/primary", href: "/schemes/#{@scheme.id}/primary-client-group",
) %> ) %>
<% end %> <% end %>
<%= render partial: "organisations/headings", locals: { main: "Does this scheme provide for another client group?", sub: @scheme.service_name } %> <%= 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-row">
<div class="govuk-grid-column-two-thirds"> <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) } %> <% selection = ["Yes", "No"].map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } %>
<%= f.govuk_collection_radio_buttons :selection, <%= f.govuk_collection_radio_buttons :selection,
selection, selection,
:id, :id,
:name, :name,
{ checked: "Yes" },
legend: nil 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 %> <% content_for :before_content do %>
<%= govuk_back_link( <%= govuk_back_link(
text: "Back", text: "Back",
href: 'javascript:history.go(-1);', href: "/schemes/#{@scheme.id}/secondary",
) %> ) %>
<% end %> <% 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-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<%= f.govuk_error_summary %> <%= f.govuk_error_summary %>
<h1 class="govuk-heading-l">
<%= content_for(:title) %>
</h1>
<%= f.govuk_text_field :service_name, <%= f.govuk_text_field :service_name,
label: { text: "Scheme name", size: "m" }, 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." } %> 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, <%= f.govuk_check_box :sensitive,
0,
1, 1,
0,
checked: @scheme.sensitive?,
multiple: false, multiple: false,
label: { text: "This scheme contains confidential information" } %> label: { text: "This scheme contains confidential information" } %>
@ -41,7 +40,8 @@
:name, :name,
label: { text: "Which organisation manages this scheme", size: "m" }, label: { text: "Which organisation manages this scheme", size: "m" },
hint: { text: "Enter organisation name" }, 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] %> "data-controller": %w[accessible-autocomplete conditional-filter] %>
<% end %> <% end %>

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

@ -3,7 +3,7 @@
<% content_for :before_content do %> <% content_for :before_content do %>
<%= govuk_back_link( <%= govuk_back_link(
text: "Back", text: "Back",
href: :back, href: 'javascript:history.go(-1);',
) %> ) %>
<% end %> <% 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." } %> 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, <%= f.govuk_check_box :sensitive,
0,
1, 1,
0,
multiple: false, multiple: false,
label: { text: "This scheme contains confidential information" } %> 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 %> <% content_for :before_content do %>
<%= govuk_back_link( <%= govuk_back_link(
text: "Back", text: "Back",
@ -7,15 +9,11 @@
<%= render partial: "organisations/headings", locals: { main: "What client group is this scheme intended for?", sub: @scheme.service_name } %> <%= 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-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<%= f.govuk_error_summary %> <%= f.govuk_error_summary %>
<h1 class="govuk-heading-l">
<%= content_for(:title) %>
</h1>
<legend class="govuk-fieldset__legend"> <legend class="govuk-fieldset__legend">
</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 %> <% content_for :before_content do %>
<%= govuk_back_link( <%= govuk_back_link(
text: "Back", text: "Back",
href: "/schemes/#{@scheme.id}/confirm_secondary", href: "/schemes/#{@scheme.id}/confirm-secondary-client-group",
) %> ) %>
<% end %> <% end %>
@ -12,10 +14,6 @@
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<%= f.govuk_error_summary %> <%= f.govuk_error_summary %>
<h1 class="govuk-heading-l">
<%= content_for(:title) %>
</h1>
<legend class="govuk-fieldset__legend"> <legend class="govuk-fieldset__legend">
</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 %> <% content_for :before_content do %>
<%= govuk_back_link( <%= govuk_back_link(
text: "Back", text: "Back",
href: "/schemes/#{@scheme.id}/secondary", href: "/schemes/#{@scheme.id}/secondary-client-group",
) %> ) %>
<% end %> <% end %>
<%= render partial: "organisations/headings", locals: { main: "What support does this scheme provide?", sub: @scheme.service_name } %> <%= 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-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<%= f.govuk_error_summary %> <%= f.govuk_error_summary %>
<h1 class="govuk-heading-l">
<%= content_for(:title) %>
</h1>
<legend class="govuk-fieldset__legend"> <legend class="govuk-fieldset__legend">
</legend> </legend>

16
config/routes.rb

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

Loading…
Cancel
Save