From 72e9a0ca7e5ca847926525d24a51a6bc90a6b5cf Mon Sep 17 00:00:00 2001 From: Ted Date: Thu, 5 May 2022 11:23:53 +0100 Subject: [PATCH] radio button --- Gemfile.lock | 46 ++++++++++++------------- app/controllers/case_logs_controller.rb | 4 ++- app/views/case_logs/_log_filters.erb | 4 +-- 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9c376691e..4324334b6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -105,7 +105,7 @@ GEM ruby2_keywords (>= 0.0.2, < 1.0) ast (2.4.2) aws-eventstream (1.2.0) - aws-partitions (1.580.0) + aws-partitions (1.583.0) aws-sdk-core (3.130.2) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.525.0) @@ -114,7 +114,7 @@ GEM aws-sdk-kms (1.56.0) aws-sdk-core (~> 3, >= 3.127.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.113.2) + aws-sdk-s3 (1.114.0) aws-sdk-core (~> 3, >= 3.127.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.4) @@ -176,7 +176,7 @@ GEM rubocop smart_properties erubi (1.10.0) - excon (0.92.2) + excon (0.92.3) factory_bot (6.2.1) activesupport (>= 5.0.0) factory_bot_rails (6.2.0) @@ -220,8 +220,8 @@ GEM thor (>= 0.14, < 2.0) jsbundling-rails (1.0.2) railties (>= 6.0.0) - json-schema (2.8.1) - addressable (>= 2.4) + json-schema (3.0.0) + addressable (>= 2.8) jwt (2.3.0) kaminari (1.2.2) activesupport (>= 4.1.0) @@ -238,7 +238,7 @@ GEM listen (3.7.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.16.0) + loofah (2.17.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -273,7 +273,7 @@ GEM notifications-ruby-client (5.3.0) jwt (>= 1.5, < 3) orm_adapter (0.5.0) - overcommit (0.58.0) + overcommit (0.59.1) childprocess (>= 0.6.3, < 5) iniparse (~> 1.4) rexml (~> 3.2) @@ -379,33 +379,33 @@ GEM rspec-mocks (~> 3.10) rspec-support (~> 3.10) rspec-support (3.11.0) - rubocop (1.25.0) + rubocop (1.27.0) parallel (~> 1.10) parser (>= 3.1.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml - rubocop-ast (>= 1.15.1, < 2.0) + rubocop-ast (>= 1.16.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.15.1) - parser (>= 3.0.1.1) - rubocop-govuk (4.3.0) - rubocop (= 1.25.0) - rubocop-ast (= 1.15.1) - rubocop-rails (= 2.13.2) + rubocop-ast (1.17.0) + parser (>= 3.1.1.0) + rubocop-govuk (4.4.0) + rubocop (= 1.27.0) + rubocop-ast (= 1.17.0) + rubocop-rails (= 2.14.2) rubocop-rake (= 0.6.0) - rubocop-rspec (= 2.7.0) + rubocop-rspec (= 2.10.0) rubocop-performance (1.13.3) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.13.2) + rubocop-rails (2.14.2) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.7.0, < 2.0) rubocop-rake (0.6.0) rubocop (~> 1.0) - rubocop-rspec (2.7.0) + rubocop-rspec (2.10.0) rubocop (~> 1.19) ruby-progressbar (1.11.0) ruby2_keywords (0.0.5) @@ -414,13 +414,13 @@ GEM childprocess (>= 0.5, < 5.0) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2) - sentry-rails (5.2.1) + sentry-rails (5.3.0) railties (>= 5.0) - sentry-ruby-core (~> 5.2.1) - sentry-ruby (5.2.1) + sentry-ruby-core (~> 5.3.0) + sentry-ruby (5.3.0) concurrent-ruby (~> 1.0, >= 1.0.2) - sentry-ruby-core (= 5.2.1) - sentry-ruby-core (5.2.1) + sentry-ruby-core (= 5.3.0) + sentry-ruby-core (5.3.0) concurrent-ruby simplecov (0.21.2) docile (~> 1.1) diff --git a/app/controllers/case_logs_controller.rb b/app/controllers/case_logs_controller.rb index 657e38503..9498f2e0b 100644 --- a/app/controllers/case_logs_controller.rb +++ b/app/controllers/case_logs_controller.rb @@ -136,7 +136,9 @@ private def set_session_filters new_filters = session[:case_logs_filters].present? ? JSON.parse(session[:case_logs_filters]) : {} - %i[status years user].each { |filter| new_filters[filter] = params[filter] if params[filter].present? } + %i[status years].each { |filter| new_filters[filter] = params[filter] if params[filter].present? } + new_filters[:user] = [params[:user]] if params[:user].present? + session[:case_logs_filters] = new_filters.to_json end end diff --git a/app/views/case_logs/_log_filters.erb b/app/views/case_logs/_log_filters.erb index f76e8b876..893a8607d 100644 --- a/app/views/case_logs/_log_filters.erb +++ b/app/views/case_logs/_log_filters.erb @@ -8,9 +8,9 @@ <% years = {"2021": "2021/22", "2022": "2022/23"} %> <%= render partial: "filters/checkbox_filter", locals: { f: f, options: years, label: "Collection year", category: "years" } %> <%= render partial: "filters/checkbox_filter", locals: { f: f, options: status_filters, label: "Status", category: "status" } %> - <%= render partial: "filters/checkbox_filter", locals: { f: f, options: {"all": "All", "yours": "Yours"}, label: "Logs", category: "user" } %> + <%= render partial: "filters/radio_filter", locals: { f: f, options: {"all": "All", "yours": "Yours"}, label: "Logs", category: "user" } %> <%= f.govuk_submit "Apply filters", class: "govuk-!-margin-bottom-0" %> <% end %> - + \ No newline at end of file