From ce626d4805fcd20ca9c9adf214c9fe9bd75d0d84 Mon Sep 17 00:00:00 2001 From: Kat Date: Tue, 23 Nov 2021 08:04:30 +0000 Subject: [PATCH] WIP --- Gemfile.lock | 443 ++++++++++++++++++++++++++++++++++ app/views/form/print.html.erb | 15 ++ 2 files changed, 458 insertions(+) create mode 100644 Gemfile.lock create mode 100644 app/views/form/print.html.erb diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 000000000..9869e7984 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,443 @@ +GIT + remote: https://github.com/rspec/rspec-core.git + revision: e36aa2a9ebe68acee3ce05190fc2124947b45925 + branch: main + specs: + rspec-core (3.11.0.pre) + rspec-support (= 3.11.0.pre) + +GIT + remote: https://github.com/rspec/rspec-expectations.git + revision: dba67987c63f551d1bf0f7877f069fa8b72d0461 + branch: main + specs: + rspec-expectations (3.11.0.pre) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (= 3.11.0.pre) + +GIT + remote: https://github.com/rspec/rspec-mocks.git + revision: 17cf86ab61544b93232c4e9ca9784ab212dccbf6 + branch: main + specs: + rspec-mocks (3.11.0.pre) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (= 3.11.0.pre) + +GIT + remote: https://github.com/rspec/rspec-rails.git + revision: 1fe6c2e8a56f46ae4c2f13ffa0733cce3b717c2d + branch: main + specs: + rspec-rails (5.1.0.pre) + actionpack (>= 5.2) + activesupport (>= 5.2) + railties (>= 5.2) + rspec-core (= 3.11.0.pre) + rspec-expectations (= 3.11.0.pre) + rspec-mocks (= 3.11.0.pre) + rspec-support (= 3.11.0.pre) + +GIT + remote: https://github.com/rspec/rspec-support.git + revision: 9499cb622f9feef43a53f357809f9e656e7cb6de + branch: main + specs: + rspec-support (3.11.0.pre) + +GEM + remote: https://rubygems.org/ + specs: + actioncable (6.1.4.1) + actionpack (= 6.1.4.1) + activesupport (= 6.1.4.1) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (6.1.4.1) + actionpack (= 6.1.4.1) + activejob (= 6.1.4.1) + activerecord (= 6.1.4.1) + activestorage (= 6.1.4.1) + activesupport (= 6.1.4.1) + mail (>= 2.7.1) + actionmailer (6.1.4.1) + actionpack (= 6.1.4.1) + actionview (= 6.1.4.1) + activejob (= 6.1.4.1) + activesupport (= 6.1.4.1) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (6.1.4.1) + actionview (= 6.1.4.1) + activesupport (= 6.1.4.1) + rack (~> 2.0, >= 2.0.9) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.1.4.1) + actionpack (= 6.1.4.1) + activerecord (= 6.1.4.1) + activestorage (= 6.1.4.1) + activesupport (= 6.1.4.1) + nokogiri (>= 1.8.5) + actionview (6.1.4.1) + activesupport (= 6.1.4.1) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activeadmin (2.9.0) + arbre (~> 1.2, >= 1.2.1) + formtastic (>= 3.1, < 5.0) + formtastic_i18n (~> 0.4) + inherited_resources (~> 1.7) + jquery-rails (~> 4.2) + kaminari (~> 1.0, >= 1.2.1) + railties (>= 5.2, < 6.2) + ransack (~> 2.1, >= 2.1.1) + activejob (6.1.4.1) + activesupport (= 6.1.4.1) + globalid (>= 0.3.6) + activemodel (6.1.4.1) + activesupport (= 6.1.4.1) + activerecord (6.1.4.1) + activemodel (= 6.1.4.1) + activesupport (= 6.1.4.1) + activestorage (6.1.4.1) + actionpack (= 6.1.4.1) + activejob (= 6.1.4.1) + activerecord (= 6.1.4.1) + activesupport (= 6.1.4.1) + marcel (~> 1.0.0) + mini_mime (>= 1.1.0) + activesupport (6.1.4.1) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) + addressable (2.8.0) + public_suffix (>= 2.0.2, < 5.0) + arbre (1.4.0) + activesupport (>= 3.0.0, < 6.2) + ruby2_keywords (>= 0.0.2, < 1.0) + ast (2.4.2) + bcrypt (3.1.16) + bindex (0.8.1) + bootsnap (1.9.1) + msgpack (~> 1.0) + builder (3.2.4) + byebug (11.1.3) + capybara (3.36.0) + addressable + matrix + mini_mime (>= 0.1.3) + nokogiri (~> 1.8) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + regexp_parser (>= 1.5, < 3.0) + xpath (~> 3.2) + chartkick (4.1.2) + childprocess (4.1.0) + coderay (1.1.3) + concurrent-ruby (1.1.9) + crass (1.0.6) + database_cleaner-active_record (2.0.1) + activerecord (>= 5.a) + database_cleaner-core (~> 2.0.0) + database_cleaner-core (2.0.1) + deep_merge (1.2.1) + devise (4.8.0) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 4.1.0) + responders + warden (~> 1.2.3) + diff-lcs (1.4.4) + discard (1.2.0) + activerecord (>= 4.2, < 7) + docile (1.4.0) + dotenv (2.7.6) + dotenv-rails (2.7.6) + dotenv (= 2.7.6) + railties (>= 3.2) + erubi (1.10.0) + factory_bot (6.2.0) + activesupport (>= 5.0.0) + factory_bot_rails (6.2.0) + factory_bot (~> 6.2.0) + railties (>= 5.0.0) + ffi (1.15.4) + formtastic (4.0.0) + actionpack (>= 5.2.0) + formtastic_i18n (0.7.0) + globalid (0.5.2) + activesupport (>= 5.0) + govuk-components (2.1.4) + activemodel (>= 6.0) + railties (>= 6.0) + view_component (~> 2.39.0) + govuk_design_system_formbuilder (2.7.6) + actionview (>= 6.0) + activemodel (>= 6.0) + activesupport (>= 6.0) + deep_merge (~> 1.2.1) + has_scope (0.8.0) + actionpack (>= 5.2) + activesupport (>= 5.2) + hotwire-rails (0.1.3) + rails (>= 6.0.0) + stimulus-rails + turbo-rails + i18n (1.8.11) + concurrent-ruby (~> 1.0) + inherited_resources (1.13.0) + actionpack (>= 5.2, < 6.2) + has_scope (~> 0.6) + railties (>= 5.2, < 6.2) + responders (>= 2, < 4) + iniparse (1.5.0) + jbuilder (2.11.3) + activesupport (>= 5.0.0) + jquery-rails (4.4.0) + rails-dom-testing (>= 1, < 3) + railties (>= 4.2.0) + thor (>= 0.14, < 2.0) + json-schema (2.8.1) + addressable (>= 2.4) + kaminari (1.2.1) + activesupport (>= 4.1.0) + kaminari-actionview (= 1.2.1) + kaminari-activerecord (= 1.2.1) + kaminari-core (= 1.2.1) + kaminari-actionview (1.2.1) + actionview + kaminari-core (= 1.2.1) + kaminari-activerecord (1.2.1) + activerecord + kaminari-core (= 1.2.1) + kaminari-core (1.2.1) + listen (3.7.0) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + loofah (2.12.0) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.1) + mini_mime (>= 0.1.1) + marcel (1.0.2) + matrix (0.4.2) + method_source (1.0.0) + mini_mime (1.1.2) + minitest (5.14.4) + msgpack (1.4.2) + nio4r (2.5.8) + nokogiri (1.12.5-x86_64-darwin) + racc (~> 1.4) + orm_adapter (0.5.0) + overcommit (0.58.0) + childprocess (>= 0.6.3, < 5) + iniparse (~> 1.4) + rexml (~> 3.2) + parallel (1.21.0) + parser (3.0.2.0) + ast (~> 2.4.1) + pg (1.2.3) + pry (0.13.1) + coderay (~> 1.1) + method_source (~> 1.0) + pry-byebug (3.9.0) + byebug (~> 11.0) + pry (~> 0.13.0) + public_suffix (4.0.6) + puma (5.5.2) + nio4r (~> 2.0) + racc (1.6.0) + rack (2.2.3) + rack-mini-profiler (2.3.3) + rack (>= 1.2.0) + rack-proxy (0.7.0) + rack + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (6.1.4.1) + actioncable (= 6.1.4.1) + actionmailbox (= 6.1.4.1) + actionmailer (= 6.1.4.1) + actionpack (= 6.1.4.1) + actiontext (= 6.1.4.1) + actionview (= 6.1.4.1) + activejob (= 6.1.4.1) + activemodel (= 6.1.4.1) + activerecord (= 6.1.4.1) + activestorage (= 6.1.4.1) + activesupport (= 6.1.4.1) + bundler (>= 1.15.0) + railties (= 6.1.4.1) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.4.2) + loofah (~> 2.3) + railties (6.1.4.1) + actionpack (= 6.1.4.1) + activesupport (= 6.1.4.1) + method_source + rake (>= 0.13) + thor (~> 1.0) + rainbow (3.0.0) + rake (13.0.6) + ransack (2.4.2) + activerecord (>= 5.2.4) + activesupport (>= 5.2.4) + i18n + rb-fsevent (0.11.0) + rb-inotify (0.10.1) + ffi (~> 1.0) + regexp_parser (2.1.1) + responders (3.0.1) + actionpack (>= 5.0) + railties (>= 5.0) + rexml (3.2.5) + roo (2.8.3) + nokogiri (~> 1) + rubyzip (>= 1.3.0, < 3.0.0) + rubocop (1.23.0) + parallel (~> 1.10) + parser (>= 3.0.0.0) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml + rubocop-ast (>= 1.12.0, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 1.4.0, < 3.0) + rubocop-ast (1.13.0) + parser (>= 3.0.1.1) + rubocop-govuk (4.2.0) + rubocop (= 1.23.0) + rubocop-ast (= 1.13.0) + rubocop-rails (= 2.12.4) + rubocop-rake (= 0.6.0) + rubocop-rspec (= 2.6.0) + rubocop-performance (1.12.0) + rubocop (>= 1.7.0, < 2.0) + rubocop-ast (>= 0.4.0) + rubocop-rails (2.12.4) + activesupport (>= 4.2.0) + rack (>= 1.1) + rubocop (>= 1.7.0, < 2.0) + rubocop-rake (0.6.0) + rubocop (~> 1.0) + rubocop-rspec (2.6.0) + rubocop (~> 1.19) + ruby-progressbar (1.11.0) + ruby2_keywords (0.0.5) + rubyzip (2.3.2) + sass (3.7.4) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + scss_lint (0.59.0) + sass (~> 3.5, >= 3.5.5) + scss_lint-govuk (0.2.0) + scss_lint + selenium-webdriver (4.0.3) + childprocess (>= 0.5, < 5.0) + rexml (~> 3.2, >= 3.2.5) + rubyzip (>= 1.2.2) + semantic_range (3.0.0) + simplecov (0.21.2) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + simplecov-html (0.12.3) + simplecov_json_formatter (0.1.3) + sprockets (4.0.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.4.0) + actionpack (>= 5.2) + activesupport (>= 5.2) + sprockets (>= 3.0.0) + stimulus-rails (0.7.2) + rails (>= 6.0.0) + thor (1.1.0) + turbo-rails (0.8.3) + rails (>= 6.0.0) + tzinfo (2.0.4) + concurrent-ruby (~> 1.0) + uk_postcode (2.1.6) + unicode-display_width (2.1.0) + view_component (2.39.0) + activesupport (>= 5.0.0, < 8.0) + method_source (~> 1.0) + warden (1.2.9) + rack (>= 2.0.9) + web-console (4.2.0) + actionview (>= 6.0.0) + activemodel (>= 6.0.0) + bindex (>= 0.4.0) + railties (>= 6.0.0) + webpacker (5.4.3) + activesupport (>= 5.2) + rack-proxy (>= 0.6.1) + railties (>= 5.2) + semantic_range (>= 2.3.0) + websocket-driver (0.7.5) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + xpath (3.2.0) + nokogiri (~> 1.8) + zeitwerk (2.5.1) + +PLATFORMS + x86_64-darwin-20 + +DEPENDENCIES + activeadmin + bootsnap (>= 1.4.4) + byebug + capybara + chartkick + database_cleaner-active_record + devise + discard + dotenv-rails + factory_bot_rails + govuk-components + govuk_design_system_formbuilder + hotwire-rails + jbuilder (~> 2.7) + json-schema + listen (~> 3.3) + overcommit (>= 0.37.0) + pg (~> 1.1) + pry-byebug + puma (~> 5.0) + rack-mini-profiler (~> 2.0) + rails (~> 6.1.4) + roo + rspec-core! + rspec-expectations! + rspec-mocks! + rspec-rails! + rspec-support! + rubocop-govuk + rubocop-performance + rubocop-rails + scss_lint-govuk + selenium-webdriver + simplecov + turbo-rails (~> 0.8) + tzinfo-data + uk_postcode + web-console (>= 4.1.0) + webpacker (~> 5.0) + +RUBY VERSION + ruby 3.0.2p107 + +BUNDLED WITH + 2.2.22 diff --git a/app/views/form/print.html.erb b/app/views/form/print.html.erb new file mode 100644 index 000000000..7d83b0cd0 --- /dev/null +++ b/app/views/form/print.html.erb @@ -0,0 +1,15 @@ +

Print the form

+ +<%= form_with do |f| %> + <% @form.all_subsections.each do |subsection_name, subsection_content| %> + + <% large_answers = @form.questions_for_subsection(subsection_name).any? {|key, info| info["type"]== 'checkbox' || info["type"]== 'radio' && info["answer_options"].keys.length > 4} ? "two-grid" : "three-grid" %> +
+ <% @form.questions_for_subsection(subsection_name).each_with_index do |question, index| %> +
+ <%= render partial: "form/print/#{question[1]["print_type"] || question[1]["type"]}_question", locals: { question_key: question[0].to_sym, question: question[1], index: index, f: f } %> +
+ <% end %> +
+ <% end %> +<% end %>