Browse Source

radio button

pull/548/head
Ted 3 years ago
parent
commit
72e9a0ca7e
  1. 46
      Gemfile.lock
  2. 4
      app/controllers/case_logs_controller.rb
  3. 2
      app/views/case_logs/_log_filters.erb

46
Gemfile.lock

@ -105,7 +105,7 @@ GEM
ruby2_keywords (>= 0.0.2, < 1.0) ruby2_keywords (>= 0.0.2, < 1.0)
ast (2.4.2) ast (2.4.2)
aws-eventstream (1.2.0) aws-eventstream (1.2.0)
aws-partitions (1.580.0) aws-partitions (1.583.0)
aws-sdk-core (3.130.2) aws-sdk-core (3.130.2)
aws-eventstream (~> 1, >= 1.0.2) aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.525.0) aws-partitions (~> 1, >= 1.525.0)
@ -114,7 +114,7 @@ GEM
aws-sdk-kms (1.56.0) aws-sdk-kms (1.56.0)
aws-sdk-core (~> 3, >= 3.127.0) aws-sdk-core (~> 3, >= 3.127.0)
aws-sigv4 (~> 1.1) 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-core (~> 3, >= 3.127.0)
aws-sdk-kms (~> 1) aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4) aws-sigv4 (~> 1.4)
@ -176,7 +176,7 @@ GEM
rubocop rubocop
smart_properties smart_properties
erubi (1.10.0) erubi (1.10.0)
excon (0.92.2) excon (0.92.3)
factory_bot (6.2.1) factory_bot (6.2.1)
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
factory_bot_rails (6.2.0) factory_bot_rails (6.2.0)
@ -220,8 +220,8 @@ GEM
thor (>= 0.14, < 2.0) thor (>= 0.14, < 2.0)
jsbundling-rails (1.0.2) jsbundling-rails (1.0.2)
railties (>= 6.0.0) railties (>= 6.0.0)
json-schema (2.8.1) json-schema (3.0.0)
addressable (>= 2.4) addressable (>= 2.8)
jwt (2.3.0) jwt (2.3.0)
kaminari (1.2.2) kaminari (1.2.2)
activesupport (>= 4.1.0) activesupport (>= 4.1.0)
@ -238,7 +238,7 @@ GEM
listen (3.7.1) listen (3.7.1)
rb-fsevent (~> 0.10, >= 0.10.3) rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10) rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.16.0) loofah (2.17.0)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.7.1) mail (2.7.1)
@ -273,7 +273,7 @@ GEM
notifications-ruby-client (5.3.0) notifications-ruby-client (5.3.0)
jwt (>= 1.5, < 3) jwt (>= 1.5, < 3)
orm_adapter (0.5.0) orm_adapter (0.5.0)
overcommit (0.58.0) overcommit (0.59.1)
childprocess (>= 0.6.3, < 5) childprocess (>= 0.6.3, < 5)
iniparse (~> 1.4) iniparse (~> 1.4)
rexml (~> 3.2) rexml (~> 3.2)
@ -379,33 +379,33 @@ GEM
rspec-mocks (~> 3.10) rspec-mocks (~> 3.10)
rspec-support (~> 3.10) rspec-support (~> 3.10)
rspec-support (3.11.0) rspec-support (3.11.0)
rubocop (1.25.0) rubocop (1.27.0)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 3.1.0.0) parser (>= 3.1.0.0)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0) regexp_parser (>= 1.8, < 3.0)
rexml rexml
rubocop-ast (>= 1.15.1, < 2.0) rubocop-ast (>= 1.16.0, < 2.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0) unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.15.1) rubocop-ast (1.17.0)
parser (>= 3.0.1.1) parser (>= 3.1.1.0)
rubocop-govuk (4.3.0) rubocop-govuk (4.4.0)
rubocop (= 1.25.0) rubocop (= 1.27.0)
rubocop-ast (= 1.15.1) rubocop-ast (= 1.17.0)
rubocop-rails (= 2.13.2) rubocop-rails (= 2.14.2)
rubocop-rake (= 0.6.0) rubocop-rake (= 0.6.0)
rubocop-rspec (= 2.7.0) rubocop-rspec (= 2.10.0)
rubocop-performance (1.13.3) rubocop-performance (1.13.3)
rubocop (>= 1.7.0, < 2.0) rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0) rubocop-ast (>= 0.4.0)
rubocop-rails (2.13.2) rubocop-rails (2.14.2)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
rack (>= 1.1) rack (>= 1.1)
rubocop (>= 1.7.0, < 2.0) rubocop (>= 1.7.0, < 2.0)
rubocop-rake (0.6.0) rubocop-rake (0.6.0)
rubocop (~> 1.0) rubocop (~> 1.0)
rubocop-rspec (2.7.0) rubocop-rspec (2.10.0)
rubocop (~> 1.19) rubocop (~> 1.19)
ruby-progressbar (1.11.0) ruby-progressbar (1.11.0)
ruby2_keywords (0.0.5) ruby2_keywords (0.0.5)
@ -414,13 +414,13 @@ GEM
childprocess (>= 0.5, < 5.0) childprocess (>= 0.5, < 5.0)
rexml (~> 3.2, >= 3.2.5) rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2) rubyzip (>= 1.2.2)
sentry-rails (5.2.1) sentry-rails (5.3.0)
railties (>= 5.0) railties (>= 5.0)
sentry-ruby-core (~> 5.2.1) sentry-ruby-core (~> 5.3.0)
sentry-ruby (5.2.1) sentry-ruby (5.3.0)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
sentry-ruby-core (= 5.2.1) sentry-ruby-core (= 5.3.0)
sentry-ruby-core (5.2.1) sentry-ruby-core (5.3.0)
concurrent-ruby concurrent-ruby
simplecov (0.21.2) simplecov (0.21.2)
docile (~> 1.1) docile (~> 1.1)

4
app/controllers/case_logs_controller.rb

@ -136,7 +136,9 @@ private
def set_session_filters def set_session_filters
new_filters = session[:case_logs_filters].present? ? JSON.parse(session[:case_logs_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 session[:case_logs_filters] = new_filters.to_json
end end
end end

2
app/views/case_logs/_log_filters.erb

@ -8,7 +8,7 @@
<% years = {"2021": "2021/22", "2022": "2022/23"} %> <% 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: 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: 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" %> <%= f.govuk_submit "Apply filters", class: "govuk-!-margin-bottom-0" %>
<% end %> <% end %>
</div> </div>

Loading…
Cancel
Save