Browse Source

Remove turbo

pull/406/head
baarkerlounger 3 years ago
parent
commit
971c5c4e19
  1. 4
      Gemfile
  2. 9
      Gemfile.lock
  3. 1
      app/frontend/application.js
  4. 47
      app/views/case_logs/edit.html.erb
  5. 44
      app/views/form/check_answers.html.erb
  6. 84
      app/views/form/page.html.erb
  7. 4
      app/views/layouts/application.html.erb
  8. 2
      package.json
  9. 18
      yarn.lock

4
Gemfile

@ -25,8 +25,8 @@ gem "govuk_design_system_formbuilder"
gem "govuk_markdown" gem "govuk_markdown"
# GOV UK Notify # GOV UK Notify
gem "notifications-ruby-client" gem "notifications-ruby-client"
# Turbo and Stimulus # A modest javascript framework for the html you already have
gem "hotwire-rails" gem "stimulus-rails"
# Administration framework # Administration framework
gem "activeadmin" gem "activeadmin"
# Admin charts # Admin charts

9
Gemfile.lock

@ -188,10 +188,6 @@ GEM
actionpack (>= 5.2) actionpack (>= 5.2)
activesupport (>= 5.2) activesupport (>= 5.2)
hashdiff (1.0.1) hashdiff (1.0.1)
hotwire-rails (0.1.3)
rails (>= 6.0.0)
stimulus-rails
turbo-rails
i18n (1.10.0) i18n (1.10.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
inherited_resources (1.13.1) inherited_resources (1.13.1)
@ -430,9 +426,6 @@ GEM
thor (1.2.1) thor (1.2.1)
timecop (0.9.5) timecop (0.9.5)
timeout (0.2.0) timeout (0.2.0)
turbo-rails (1.0.1)
actionpack (>= 6.0.0)
railties (>= 6.0.0)
tzinfo (2.0.4) tzinfo (2.0.4)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
uk_postcode (2.1.7) uk_postcode (2.1.7)
@ -480,7 +473,6 @@ DEPENDENCIES
govuk-components govuk-components
govuk_design_system_formbuilder govuk_design_system_formbuilder
govuk_markdown govuk_markdown
hotwire-rails
jsbundling-rails jsbundling-rails
json-schema json-schema
listen (~> 3.3) listen (~> 3.3)
@ -507,6 +499,7 @@ DEPENDENCIES
sentry-rails sentry-rails
sentry-ruby sentry-ruby
simplecov simplecov
stimulus-rails
timecop (~> 0.9.4) timecop (~> 0.9.4)
two_factor_authentication! two_factor_authentication!
tzinfo-data tzinfo-data

1
app/frontend/application.js

@ -16,6 +16,5 @@ require.context("govuk-frontend/govuk/assets")
import { initAll } from "govuk-frontend" import { initAll } from "govuk-frontend"
import "./styles/application.scss" import "./styles/application.scss"
import "./controllers" import "./controllers"
import "@hotwired/turbo-rails"
initAll() initAll()

47
app/views/case_logs/edit.html.erb

@ -4,30 +4,27 @@
content_for(:title) => "" content_for(:title) => ""
}) %> }) %>
<%= turbo_frame_tag "case_log_form", target: "_top" do %> <div class="govuk-grid-row">
<div class="govuk-grid-row"> <div class="govuk-grid-column-two-thirds-from-desktop">
<div class="govuk-grid-column-two-thirds-from-desktop"> <h1 class="govuk-heading-xl">
<h1 class="govuk-heading-xl"> <%= content_for(:title) %>
<%= content_for(:title) %> </h1>
</h1>
<% if @case_log.status == "in_progress" %> <% if @case_log.status == "in_progress" %>
<p class="govuk-body govuk-!-margin-bottom-7"><%= get_subsections_count(@case_log, :completed) %> of <%= get_subsections_count(@case_log, :all) %> sections completed.</p> <p class="govuk-body govuk-!-margin-bottom-7"><%= get_subsections_count(@case_log, :completed) %> of <%= get_subsections_count(@case_log, :all) %> sections completed.</p>
<p class="govuk-body govuk-!-margin-bottom-2"> <p class="govuk-body govuk-!-margin-bottom-2">
<% next_incomplete_section = get_next_incomplete_section(@case_log) %> <% next_incomplete_section = get_next_incomplete_section(@case_log) %>
</p> </p>
<p> <p>
<% if next_incomplete_section.present? %> <% if next_incomplete_section.present? %>
<a class="app-section-skip-link" href="#<%= next_incomplete_section.id.dasherize %>"> <a class="app-section-skip-link" href="#<%= next_incomplete_section.id.dasherize %>">
Skip to next incomplete section: <%= next_incomplete_section.label %> Skip to next incomplete section: <%= next_incomplete_section.label %>
</a> </a>
<% end %> <% end %>
</p> </p>
<% elsif @case_log.status == "not_started" %> <% elsif @case_log.status == "not_started" %>
<p class="govuk-body">This log has not been started.</p> <p class="govuk-body">This log has not been started.</p>
<% end %> <% end %>
<%= render "tasklist" %>
<%= render "tasklist" %>
</div>
</div> </div>
<% end %> </div>

44
app/views/form/check_answers.html.erb

@ -5,31 +5,29 @@
subsection.label => "" subsection.label => ""
}) %> }) %>
<%= turbo_frame_tag "case_log_form", target: "_top" do %> <div class="govuk-grid-row">
<div class="govuk-grid-row"> <div class="govuk-grid-column-three-quarters-from-desktop">
<div class="govuk-grid-column-three-quarters-from-desktop"> <h1 class="govuk-heading-l">
<h1 class="govuk-heading-l"> <span class="govuk-caption-l"><%= subsection.label %></span>
<span class="govuk-caption-l"><%= subsection.label %></span> Check your answers
Check your answers </h1>
</h1>
<%= display_answered_questions_summary(subsection, @case_log) %> <%= display_answered_questions_summary(subsection, @case_log) %>
<dl class="govuk-summary-list"> <dl class="govuk-summary-list">
<% subsection.applicable_questions(@case_log).each do |question| %> <% subsection.applicable_questions(@case_log).each do |question| %>
<%= render partial: 'form/check_answers_table', locals: { question: question, case_log: @case_log } %> <%= render partial: 'form/check_answers_table', locals: { question: question, case_log: @case_log } %>
<% end %> <% end %>
</dl> </dl>
<%= form_with model: @case_log, method: "get" do |f| %> <%= form_with model: @case_log, method: "get" do |f| %>
<%= f.govuk_submit 'Save and return to log' do %> <%= f.govuk_submit 'Save and return to log' do %>
<% if @case_log.status == "in_progress" && @case_log.status == "completed" || @case_log.form.all_subsections_except_declaration_completed?(@case_log) == false %> <% if @case_log.status == "in_progress" && @case_log.status == "completed" || @case_log.form.all_subsections_except_declaration_completed?(@case_log) == false %>
<%= govuk_button_link_to 'Save and go to next incomplete section', "/logs/#{@case_log.id}/#{@case_log.form.next_incomplete_section_redirect_path(subsection, @case_log)}", secondary: true %> <%= govuk_button_link_to 'Save and go to next incomplete section', "/logs/#{@case_log.id}/#{@case_log.form.next_incomplete_section_redirect_path(subsection, @case_log)}", secondary: true %>
<% elsif @case_log.status == "completed" || @case_log.form.all_subsections_except_declaration_completed?(@case_log) %> <% elsif @case_log.status == "completed" || @case_log.form.all_subsections_except_declaration_completed?(@case_log) %>
<%= govuk_button_link_to 'Save and go to submit', "/logs/#{@case_log.id}/#{@case_log.form.next_incomplete_section_redirect_path(subsection, @case_log)}", secondary: true %> <%= govuk_button_link_to 'Save and go to submit', "/logs/#{@case_log.id}/#{@case_log.form.next_incomplete_section_redirect_path(subsection, @case_log)}", secondary: true %>
<% end%> <% end%>
<% end %>
<% end %> <% end %>
</div> <% end %>
</div> </div>
<% end %> </div>

84
app/views/form/page.html.erb

@ -1,7 +1,3 @@
<% content_for :head do %>
<meta name="turbo-cache-control" content="no-cache">
<% end %>
<% content_for :title, @page.header.present? ? @page.header : @page.questions.first().header.html_safe %> <% content_for :title, @page.header.present? ? @page.header : @page.questions.first().header.html_safe %>
<% content_for :before_content do %> <% content_for :before_content do %>
@ -13,48 +9,46 @@
<div data-controller="govukfrontend"></div> <div data-controller="govukfrontend"></div>
<%= turbo_frame_tag "case_log_form", target: "_top" do %> <%= form_with model: @case_log, url: form_case_log_path(@case_log), method: "post" do |f| %>
<%= form_with model: @case_log, url: form_case_log_path(@case_log), method: "post" do |f| %> <div class="govuk-grid-row">
<div class="govuk-grid-row"> <div class=<%= @page.questions[0].type == "interruption_screen" ? "govuk-grid-column-full-from-desktop" : "govuk-grid-column-two-thirds-from-desktop"%>>
<div class=<%= @page.questions[0].type == "interruption_screen" ? "govuk-grid-column-full-from-desktop" : "govuk-grid-column-two-thirds-from-desktop"%>> <% remove_other_page_errors(@case_log, @page) %>
<% remove_other_page_errors(@case_log, @page) %> <%= f.govuk_error_summary %>
<%= f.govuk_error_summary %>
<% if @page.header.present? %>
<h1 class="govuk-heading-l">
<% if !@page.hide_subsection_label %>
<span class="govuk-caption-l"><%= @subsection.label %></span>
<% end %>
<%= @page.header %>
</h1>
<% end %>
<% if @page.description.present? %>
<p class="govuk-body govuk-body-m"><%= @page.description.html_safe %></p>
<% end %>
<% @page.non_conditional_questions.map do |question| %> <% if @page.header.present? %>
<div id=<%= question.id + "_div " %><%= display_question_key_div(@page, question) %> > <h1 class="govuk-heading-l">
<% if question.read_only? %> <% if !@page.hide_subsection_label %>
<hr class="govuk-section-break govuk-section-break--visible govuk-section-break--m"> <span class="govuk-caption-l"><%= @subsection.label %></span>
<% end %> <% end %>
<% if question.type == "interruption_screen" %> <%= @page.header %>
<%= render partial: "form/#{question.type}_question", locals: { question: question, caption_text: @subsection.label, page_header: @page.header, case_log: @case_log, title_text: @page.title_text, informative_text: @page.informative_text, form: @form, f: f, conditional: false } %> </h1>
<% else %> <% end %>
<%= render partial: "form/#{question.type}_question", locals: { question: question, caption_text: @subsection.label, page_header: @page.header, case_log: @case_log, f: f, conditional: false } %>
<% end %> <% if @page.description.present? %>
</div> <p class="govuk-body govuk-body-m"><%= @page.description.html_safe %></p>
<% end %> <% end %>
<%= f.hidden_field :page, value: @page.id %> <% @page.non_conditional_questions.map do |question| %>
<% if @case_log.form.is_last_question?(@page, @subsection, @case_log) %> <div id=<%= question.id + "_div " %><%= display_question_key_div(@page, question) %> >
<%= f.govuk_submit "Submit lettings log", accesskey: "s" %> <% if question.read_only? %>
<%else %> <hr class="govuk-section-break govuk-section-break--visible govuk-section-break--m">
<% if !@page.id.include?("value_check") %>
<%= f.govuk_submit "Save and continue", accesskey: "s" %>
<% end %> <% end %>
<%end %> <% if question.type == "interruption_screen" %>
</div> <%= render partial: "form/#{question.type}_question", locals: { question: question, caption_text: @subsection.label, page_header: @page.header, case_log: @case_log, title_text: @page.title_text, informative_text: @page.informative_text, form: @form, f: f, conditional: false } %>
<% else %>
<%= render partial: "form/#{question.type}_question", locals: { question: question, caption_text: @subsection.label, page_header: @page.header, case_log: @case_log, f: f, conditional: false } %>
<% end %>
</div>
<% end %>
<%= f.hidden_field :page, value: @page.id %>
<% if @case_log.form.is_last_question?(@page, @subsection, @case_log) %>
<%= f.govuk_submit "Submit lettings log", accesskey: "s" %>
<%else %>
<% if !@page.id.include?("value_check") %>
<%= f.govuk_submit "Save and continue", accesskey: "s" %>
<% end %>
<%end %>
</div> </div>
<% end %> </div>
<% end %> <% end %>

4
app/views/layouts/application.html.erb

@ -13,7 +13,7 @@
<%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-152x152.png'), rel: 'apple-touch-icon', type: 'image/png', size: '152x152' %> <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-152x152.png'), rel: 'apple-touch-icon', type: 'image/png', size: '152x152' %>
<%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-167x167.png'), rel: 'apple-touch-icon', type: 'image/png', size: '167x167' %> <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-167x167.png'), rel: 'apple-touch-icon', type: 'image/png', size: '167x167' %>
<%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-180x180.png'), rel: 'apple-touch-icon', type: 'image/png', size: '180x180' %> <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-180x180.png'), rel: 'apple-touch-icon', type: 'image/png', size: '180x180' %>
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> <%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "vendor/html5shiv.min.js" %> <%= javascript_include_tag "vendor/html5shiv.min.js" %>
<%= javascript_tag do -%> <%= javascript_tag do -%>
window.html5.elements = 'output'; window.html5.elements = 'output';
@ -21,7 +21,7 @@
<% end -%> <% end -%>
<%= javascript_include_tag "vendor/polyfill-output-value.js" %> <%= javascript_include_tag "vendor/polyfill-output-value.js" %>
<%= javascript_include_tag "vendor/outerHTML.js" %> <%= javascript_include_tag "vendor/outerHTML.js" %>
<%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %> <%= javascript_include_tag "application", defer: true %>
<% if content_for?(:head) %> <% if content_for?(:head) %>
<%= yield(:head) %> <%= yield(:head) %>

2
package.json

@ -10,8 +10,6 @@
"@babel/plugin-transform-runtime": "^7.17.0", "@babel/plugin-transform-runtime": "^7.17.0",
"@babel/preset-env": "^7.16.11", "@babel/preset-env": "^7.16.11",
"@hotwired/stimulus": "^3.0.0", "@hotwired/stimulus": "^3.0.0",
"@hotwired/turbo": "^7.1.0",
"@hotwired/turbo-rails": "^7.1.0",
"@stimulus/polyfills": "^2.0.0", "@stimulus/polyfills": "^2.0.0",
"@webcomponents/webcomponentsjs": "^2.6.0", "@webcomponents/webcomponentsjs": "^2.6.0",
"accessible-autocomplete": "^2.0.3", "accessible-autocomplete": "^2.0.3",

18
yarn.lock

@ -926,19 +926,6 @@
resolved "https://registry.yarnpkg.com/@hotwired/stimulus/-/stimulus-3.0.1.tgz#141f15645acaa3b133b7c247cad58ae252ffae85" resolved "https://registry.yarnpkg.com/@hotwired/stimulus/-/stimulus-3.0.1.tgz#141f15645acaa3b133b7c247cad58ae252ffae85"
integrity sha512-oHsJhgY2cip+K2ED7vKUNd2P+BEswVhrCYcJ802DSsblJFv7mPFVk3cQKvm2vHgHeDVdnj7oOKrBbzp1u8D+KA== integrity sha512-oHsJhgY2cip+K2ED7vKUNd2P+BEswVhrCYcJ802DSsblJFv7mPFVk3cQKvm2vHgHeDVdnj7oOKrBbzp1u8D+KA==
"@hotwired/turbo-rails@^7.1.0":
version "7.1.1"
resolved "https://registry.yarnpkg.com/@hotwired/turbo-rails/-/turbo-rails-7.1.1.tgz#35c03b92b5c86f0137ed08bef843d955ec9bbe83"
integrity sha512-ZXpxUjCfkdbuXfoGrsFK80qsVzACs8xCfie9rt2jMTSN6o1olXVA0Nrk8u02yNEwSiVJm/4QSOa8cUcMj6VQjg==
dependencies:
"@hotwired/turbo" "^7.1.0"
"@rails/actioncable" "^7.0"
"@hotwired/turbo@^7.1.0":
version "7.1.0"
resolved "https://registry.yarnpkg.com/@hotwired/turbo/-/turbo-7.1.0.tgz#27e44e0e3dc5bd1d4bda0766d579cf5a14091cd7"
integrity sha512-Q8kGjqwPqER+CtpQudbH+3Zgs2X4zb6pBAlr6NsKTXadg45pAOvxI9i4QpuHbwSzR2+x87HUm+rot9F/Pe8rxA==
"@jridgewell/resolve-uri@^3.0.3": "@jridgewell/resolve-uri@^3.0.3":
version "3.0.5" version "3.0.5"
resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.0.5.tgz#68eb521368db76d040a6315cdb24bf2483037b9c" resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.0.5.tgz#68eb521368db76d040a6315cdb24bf2483037b9c"
@ -978,11 +965,6 @@
"@nodelib/fs.scandir" "2.1.5" "@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0" fastq "^1.6.0"
"@rails/actioncable@^7.0":
version "7.0.2"
resolved "https://registry.yarnpkg.com/@rails/actioncable/-/actioncable-7.0.2.tgz#69a6d999f4087e0537dd38fe0963db1f4305d650"
integrity sha512-G26maXW1Kx0LxQdmNNuNjQlRO/QlXNr3QfuwKiOKb5FZQGYe2OwtHTGXBAjSoiu4dW36XYMT/+L1Wo1Yov4ZXA==
"@stimulus/polyfills@^2.0.0": "@stimulus/polyfills@^2.0.0":
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/@stimulus/polyfills/-/polyfills-2.0.0.tgz#64b3e247c762330f80d88e993d1d26b24e3c13b1" resolved "https://registry.yarnpkg.com/@stimulus/polyfills/-/polyfills-2.0.0.tgz#64b3e247c762330f80d88e993d1d26b24e3c13b1"

Loading…
Cancel
Save