-
-
Tasklist for log
- <%= @case_log.id %>
+<%= turbo_frame_tag "case_log_form" do %>
+
+
+
Tasklist for log
+ <%= @case_log.id %>
-
This submission is
- <%= @case_log.status %>
-
You've completed 0 of 9 sections.
-
- Skip to next incomplete section
-
+
This submission is
+ <%= @case_log.status %>
+
You've completed 0 of 9 sections.
+
+ Skip to next incomplete section
+
- <%= render "tasklist" %>
+ <%= render "tasklist" %>
+
-
+<% end %>
diff --git a/app/views/case_logs/household/tenant_age.html.erb b/app/views/case_logs/household/tenant_age.html.erb
index a21603edb..35aa64708 100644
--- a/app/views/case_logs/household/tenant_age.html.erb
+++ b/app/views/case_logs/household/tenant_age.html.erb
@@ -1,8 +1,11 @@
- <%= form_with model: @case_log, method: "patch", builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %>
+<%= turbo_frame_tag "case_log_form" do %>
+ <%= form_with action: '/form', method: "next_question", builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %>
<%= f.govuk_number_field :tenant_age,
hint: { text: "More detail" },
label: { text: "What is the tenant's age?", size: "l"},
min: 0, max: 150, step: 1, width: 20
%>
+ <%= f.hidden_field :previous_question, value: :tenant_age %>
<%= f.govuk_submit "Save and continue" %>
-<% end %>
\ No newline at end of file
+ <% end %>
+<% end %>
diff --git a/app/views/case_logs/household/tenant_code.html.erb b/app/views/case_logs/household/tenant_code.html.erb
index 56e50a01e..3b3774a8b 100644
--- a/app/views/case_logs/household/tenant_code.html.erb
+++ b/app/views/case_logs/household/tenant_code.html.erb
@@ -1,8 +1,11 @@
-<%= form_with model: @case_log, method: "patch", builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %>
- <%= f.govuk_text_field :tenant_code,
- hint: { text: "More detail" },
- label: { text: "What is the tenant code?", size: "l"},
- width: 20
- %>
- <%= f.govuk_submit "Save and continue" %>
-<% end %>
\ No newline at end of file
+<%= turbo_frame_tag "case_log_form" do %>
+ <%= form_with action: '/form', method: "next_question", builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %>
+ <%= f.govuk_text_field :tenant_code,
+ hint: { text: "More detail" },
+ label: { text: "What is the tenant code?", size: "l"},
+ width: 20
+ %>
+ <%= f.hidden_field :previous_question, value: :tenant_code %>
+ <%= f.govuk_submit "Save and continue" %>
+ <% end %>
+<% end %>
diff --git a/app/views/case_logs/household/tenant_gender.html.erb b/app/views/case_logs/household/tenant_gender.html.erb
index 54aa49f28..d98d7da8c 100644
--- a/app/views/case_logs/household/tenant_gender.html.erb
+++ b/app/views/case_logs/household/tenant_gender.html.erb
@@ -4,8 +4,11 @@
OpenStruct.new(id: 2, name: "Non-binary"),
OpenStruct.new(id: 3, name: "Prefer not to say")
] %>
-
- <%= form_with model: @case_log, method: "patch", builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %>
+
+<%= turbo_frame_tag "case_log_form" do %>
+ <%= form_with action: '/form', method: "next_question", builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %>
<%= f.govuk_collection_radio_buttons :tenant_gender, genders, :id, :name, legend: { text: "Which of these best describes the tenant's gender identity?", size: "l" } %>
+ <%= f.hidden_field :previous_question, value: :tenant_gender %>
<%= f.govuk_submit "Save and continue" %>
-<% end %>
\ No newline at end of file
+ <% end %>
+<% end %>
diff --git a/app/views/case_logs/show.html.erb b/app/views/case_logs/show.html.erb
deleted file mode 100644
index f9f76fa7f..000000000
--- a/app/views/case_logs/show.html.erb
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
Tasklist for log
- <%= @case_log.id %>
-
-
This submission is
- <%= @case_log.status %>
-
You've completed 0 of 9 sections.
-
- Skip to next incomplete section
-
-
- <%= render "tasklist" %>
-
-
-
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 16521773c..733dfc2cb 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -2,6 +2,8 @@ Rails.application.routes.draw do
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
get "about", to: "about#index"
get "/", to: "test#index"
+ get "form", to: "form#next_question"
+ post "form", to: "form#next_question"
resources :case_logs
end
diff --git a/package.json b/package.json
index 1811460fb..4a3ba390c 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "data-collector",
"private": true,
"dependencies": {
- "@hotwired/stimulus": "^3.0.0-beta.1",
+ "@hotwired/stimulus": "^3.0.0-beta.2",
"@hotwired/turbo": "^7.0.0-rc.3",
"@hotwired/turbo-rails": "^7.0.0-rc.3",
"@rails/actioncable": "^6.0.0",
diff --git a/yarn.lock b/yarn.lock
index d63b65c07..b7dd73218 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -885,14 +885,14 @@
resolved "https://registry.npmjs.org/@csstools/convert-colors/-/convert-colors-1.4.0.tgz"
integrity sha512-5a6wqoJV/xEdbRNKVo6I4hO3VjyDq//8q2f9I6PBAvMesJHFauXDorcNCsr9RzvsZnaWi5NYCcfyqP1QeFHFbw==
-"@hotwired/stimulus@^3.0.0-beta.1":
- version "3.0.0-beta.1"
- resolved "https://registry.npmjs.org/@hotwired/stimulus/-/stimulus-3.0.0-beta.1.tgz"
- integrity sha512-CrKSNYwwWJ1rCZiKgPADrLwRlmBQdvdbTgYlATjZP4MaU2SvGQ0wo1vsjjr7qzfEUvP/14GBnuQfMuhvHGrCNQ==
+"@hotwired/stimulus@^3.0.0-beta.2":
+ version "3.0.0-beta.2"
+ resolved "https://registry.yarnpkg.com/@hotwired/stimulus/-/stimulus-3.0.0-beta.2.tgz#64ca67af9cc473ca97bb99d98fee5bc08e4c3914"
+ integrity sha512-rp2XojlugD0mvqi3qbqM660PbjqS7hnq/8FYa7SK/DL2rvWDu0/Ka3KW8cyXtcB1RiVG4nX5Oh4oq3nmuDjENQ==
"@hotwired/turbo-rails@^7.0.0-rc.3":
version "7.0.0-rc.3"
- resolved "https://registry.npmjs.org/@hotwired/turbo-rails/-/turbo-rails-7.0.0-rc.3.tgz"
+ resolved "https://registry.yarnpkg.com/@hotwired/turbo-rails/-/turbo-rails-7.0.0-rc.3.tgz#ebb088a0c9f6eed23a99b396c2ae59d0c57644e0"
integrity sha512-J5NLTGSvlFW86pRxEm2WlYKdNeIkmQT9ZmIo1Rputj7BLymZYDCglaZ2vhMVFnQJ4qXEq4ttS3xeQt3cCG2Tdg==
dependencies:
"@hotwired/turbo" "^7.0.0-rc.3"