From d1cbb9b2bb790a954a45190ab5fc5b0cd1f5e796 Mon Sep 17 00:00:00 2001 From: Ryan Wold Date: Mon, 12 Aug 2024 22:00:03 -0700 Subject: [PATCH 1/9] enable more cx_responses per api call --- app/controllers/api/v1/cx_responses_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/v1/cx_responses_controller.rb b/app/controllers/api/v1/cx_responses_controller.rb index c02318874..124ded2ff 100644 --- a/app/controllers/api/v1/cx_responses_controller.rb +++ b/app/controllers/api/v1/cx_responses_controller.rb @@ -6,7 +6,7 @@ class CxResponsesController < ::ApiController def index page_number = params.dig(:page, :number).to_i.nonzero? || 1 page_size = params.dig(:page, :size).to_i.nonzero? || 500 - page_size = 500 if page_size <= 0 || page_size > 500 + page_size = 500 if page_size <= 0 || page_size > 5000 begin start_date = params[:start_date] ? Date.parse(params[:start_date]).to_date : Date.parse("2023-10-01").to_date From 8d32f03767aa19c4aff42dc918e6a38bec67ba48 Mon Sep 17 00:00:00 2001 From: Ryan Wold Date: Mon, 12 Aug 2024 22:04:12 -0700 Subject: [PATCH 2/9] ensure abbreviation is only letters, no special chars * update error styling --- app/models/organization.rb | 7 +++++-- app/views/admin/organizations/_form.html.erb | 11 ++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/models/organization.rb b/app/models/organization.rb index 0a08b31e2..861586dec 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -21,8 +21,11 @@ class Organization < ApplicationRecord validates :name, presence: true validates :name, uniqueness: true validates :domain, presence: true - validates :abbreviation, presence: true - validates :abbreviation, uniqueness: true + validates :abbreviation, + presence: true, + uniqueness: true, + length: { maximum: 10 }, + format: { with: /\A[a-zA-Z0-9]*\z/, message: "only allows letters and numbers" } def parent parent_id ? Organization.find(parent_id) : nil diff --git a/app/views/admin/organizations/_form.html.erb b/app/views/admin/organizations/_form.html.erb index f020642e1..b315b3f06 100644 --- a/app/views/admin/organizations/_form.html.erb +++ b/app/views/admin/organizations/_form.html.erb @@ -4,11 +4,16 @@

<%= pluralize(organization.errors.count, "error") %> prohibited this organization from being saved:

- <% end %>
From 2f112b43e3b2e087214e72004bfbe5eefd78a882 Mon Sep 17 00:00:00 2001 From: Ryan Wold Date: Mon, 12 Aug 2024 22:04:52 -0700 Subject: [PATCH 3/9] center the forms actions button * by removing its right margin --- app/assets/stylesheets/site.scss | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/assets/stylesheets/site.scss b/app/assets/stylesheets/site.scss index be362e144..0d614e0ea 100644 --- a/app/assets/stylesheets/site.scss +++ b/app/assets/stylesheets/site.scss @@ -605,3 +605,10 @@ abbr[title=required] { padding-left: 1rem; padding-right: 0.5rem; } + +// Center the dropdown button in a table +@media (min-width: 64em) { + .usa-table .usa-nav__primary button[aria-expanded=false] span::after { + right: auto; + } +} \ No newline at end of file From 7dc979921f2d1d687d0507c2c9f9566230af82ea Mon Sep 17 00:00:00 2001 From: Ryan Wold Date: Mon, 12 Aug 2024 22:05:01 -0700 Subject: [PATCH 4/9] sort forms by status --- app/views/admin/forms/_list.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/forms/_list.html.erb b/app/views/admin/forms/_list.html.erb index b4bb29667..af17d9c5d 100644 --- a/app/views/admin/forms/_list.html.erb +++ b/app/views/admin/forms/_list.html.erb @@ -4,7 +4,7 @@ Name - + Status From fe15edcd45de3bee564316233f04886ec1ada837 Mon Sep 17 00:00:00 2001 From: Ryan Wold Date: Mon, 12 Aug 2024 22:07:15 -0700 Subject: [PATCH 5/9] support html in question help text --- app/views/components/_question_title.html.erb | 2 +- app/views/components/_question_title_label.html.erb | 2 +- app/views/components/_question_title_legend.html.erb | 2 +- .../forms/question_types/_custom_text_display.html.erb | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/components/_question_title.html.erb b/app/views/components/_question_title.html.erb index 6b2709a13..9a2aa2708 100644 --- a/app/views/components/_question_title.html.erb +++ b/app/views/components/_question_title.html.erb @@ -10,7 +10,7 @@ class="help-text margin-top-1" > - <%= question.help_text %> + <%= question.help_text.html_safe %>
<% end %> diff --git a/app/views/components/_question_title_label.html.erb b/app/views/components/_question_title_label.html.erb index 1d9bd67ee..23eea2b26 100644 --- a/app/views/components/_question_title_label.html.erb +++ b/app/views/components/_question_title_label.html.erb @@ -9,7 +9,7 @@ class="help-text margin-top-1" > - <%= question.help_text %> + <%= question.help_text.html_safe %> <% end -%> diff --git a/app/views/components/_question_title_legend.html.erb b/app/views/components/_question_title_legend.html.erb index 3317f1c37..f2ad41721 100644 --- a/app/views/components/_question_title_legend.html.erb +++ b/app/views/components/_question_title_legend.html.erb @@ -9,7 +9,7 @@ class="help-text margin-top-1" > - <%= question.help_text %> + <%= question.help_text.html_safe %> <% end %> diff --git a/app/views/components/forms/question_types/_custom_text_display.html.erb b/app/views/components/forms/question_types/_custom_text_display.html.erb index 25b6d3769..9850a0a2e 100644 --- a/app/views/components/forms/question_types/_custom_text_display.html.erb +++ b/app/views/components/forms/question_types/_custom_text_display.html.erb @@ -5,11 +5,11 @@

- <%= sanitize(question.text) %> + <%= question.text.html_safe %>

- <%- if question.help_text %> + <%- if question.help_text.present? %>

- <%= sanitize(question.help_text) %> + <%= question.help_text.html_safe %>

<% end %>
From c239f70b97a7db8bc128c99547e20a76d369caac Mon Sep 17 00:00:00 2001 From: Ryan Wold Date: Tue, 13 Aug 2024 10:01:55 -0700 Subject: [PATCH 6/9] show formatted time --- app/views/admin/submissions/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/submissions/show.html.erb b/app/views/admin/submissions/show.html.erb index df9ab99e7..8907fccf9 100644 --- a/app/views/admin/submissions/show.html.erb +++ b/app/views/admin/submissions/show.html.erb @@ -119,7 +119,7 @@ Received at - <%= @submission.created_at %> - + <%= format_time(@submission.created_at, current_user.time_zone) %> - <%= time_ago_in_words(@submission.created_at) %> ago From 47413c82ba8aeef437012d206f7ce8933adb50bd Mon Sep 17 00:00:00 2001 From: Ryan Wold Date: Tue, 13 Aug 2024 10:35:18 -0700 Subject: [PATCH 7/9] show date with user's timezone --- app/helpers/application_helper.rb | 2 +- config/locales/en.yml | 1 + config/locales/es.yml | 1 + config/locales/zh-CN.yml | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 500a88526..428d95946 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -167,7 +167,7 @@ def submit_touchpoint_uuid_url(form) end def format_time(time, timezone) - I18n.l time.to_time.in_time_zone(timezone), format: :long + I18n.l time.to_time.in_time_zone(timezone), format: :with_timezone end def timezone_abbreviation(timezone) diff --git a/config/locales/en.yml b/config/locales/en.yml index 77bac1bea..9b7ab8b32 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -51,6 +51,7 @@ en-US: formats: default: "%a, %d %b %Y %I:%M:%S %p %Z" long: "%B %d, %Y %I:%M %p" + with_timezone: "%B %d, %Y %I:%M %p (%Z - UTC%:z)" short: "%d %b %I:%M %p" pm: pm date: diff --git a/config/locales/es.yml b/config/locales/es.yml index d05a4533d..5a4771267 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -91,6 +91,7 @@ es: formats: default: "%-d/%-m/%Y" long: "%-d de %B de %Y" + with_timezone: "%-d de %B de %Y (UTC%:z)" short: "%-d de %b" month_names: - diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index 6b7461951..0395aa46c 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -111,6 +111,7 @@ zh-CN: formats: default: "%Y-%m-%d" long: "%Y年%m月%d日" + with_timezone: "%Y年%m月%d日 (%:z)" short: "%m月%d日" month_names: - From 69e8e400b19d3aa1e4e5fc4f74aadf43124aa960 Mon Sep 17 00:00:00 2001 From: Ryan Wold Date: Tue, 13 Aug 2024 14:33:16 -0700 Subject: [PATCH 8/9] update gems --- Gemfile.lock | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a3b603324..d19fbdc7e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -105,10 +105,10 @@ GEM aes_key_wrap (1.1.0) ast (2.4.2) aws-eventstream (1.3.0) - aws-partitions (1.961.0) + aws-partitions (1.963.0) aws-record (2.13.1) aws-sdk-dynamodb (~> 1, >= 1.85.0) - aws-sdk-core (3.201.3) + aws-sdk-core (3.201.4) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.8) @@ -157,7 +157,7 @@ GEM bigdecimal (3.1.8) bindata (2.5.0) bindex (0.8.1) - bootsnap (1.18.3) + bootsnap (1.18.4) msgpack (~> 1.2) brakeman (6.1.2) racc @@ -188,7 +188,7 @@ GEM activesupport choice (0.2.0) coderay (1.1.3) - concurrent-ruby (1.3.3) + concurrent-ruby (1.3.4) connection_pool (2.4.1) crass (1.0.6) database_cleaner (2.0.2) @@ -229,7 +229,7 @@ GEM fog-core (~> 2.1) fog-json (~> 1.1) fog-xml (~> 0.1) - fog-core (2.4.0) + fog-core (2.5.0) builder excon (~> 0.71) formatador (>= 0.2, < 2.0) @@ -309,7 +309,7 @@ GEM method_source (1.1.0) mime-types (3.5.2) mime-types-data (~> 3.2015) - mime-types-data (3.2024.0702) + mime-types-data (3.2024.0806) mini_magick (4.13.2) mini_mime (1.1.5) mini_portile2 (2.8.7) @@ -363,8 +363,8 @@ GEM paper_trail (15.1.0) activerecord (>= 6.1) request_store (~> 1.4) - parallel (1.25.1) - parser (3.3.4.0) + parallel (1.26.2) + parser (3.3.4.2) ast (~> 2.4.1) racc pg (1.5.7) @@ -449,7 +449,7 @@ GEM responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) - rexml (3.3.4) + rexml (3.3.5) strscan rolify (6.0.1) rspec-core (3.13.0) @@ -482,14 +482,14 @@ GEM rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.31.3) + rubocop-ast (1.32.0) parser (>= 3.3.1.0) rubocop-rails (2.25.1) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rspec (3.0.3) + rubocop-rspec (3.0.4) rubocop (~> 1.61) ruby-graphviz (1.2.5) rexml From 624fe547fd37d25c55e3f3a438de8ec16ae8c628 Mon Sep 17 00:00:00 2001 From: Ryan Wold Date: Wed, 14 Aug 2024 14:40:08 -0700 Subject: [PATCH 9/9] sanitize strings --- app/views/components/_question_title.html.erb | 2 +- app/views/components/_question_title_label.html.erb | 2 +- app/views/components/_question_title_legend.html.erb | 2 +- app/views/components/forms/_footer.html.erb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/components/_question_title.html.erb b/app/views/components/_question_title.html.erb index 9a2aa2708..63633ef2e 100644 --- a/app/views/components/_question_title.html.erb +++ b/app/views/components/_question_title.html.erb @@ -10,7 +10,7 @@ class="help-text margin-top-1" > - <%= question.help_text.html_safe %> + <%= sanitize(question.help_text) %>
<% end %> diff --git a/app/views/components/_question_title_label.html.erb b/app/views/components/_question_title_label.html.erb index 23eea2b26..0d355b418 100644 --- a/app/views/components/_question_title_label.html.erb +++ b/app/views/components/_question_title_label.html.erb @@ -9,7 +9,7 @@ class="help-text margin-top-1" > - <%= question.help_text.html_safe %> + <%= sanitize(question.help_text) %> <% end -%> diff --git a/app/views/components/_question_title_legend.html.erb b/app/views/components/_question_title_legend.html.erb index f2ad41721..39e64caa1 100644 --- a/app/views/components/_question_title_legend.html.erb +++ b/app/views/components/_question_title_legend.html.erb @@ -9,7 +9,7 @@ class="help-text margin-top-1" > - <%= question.help_text.html_safe %> + <%= sanitize(question.help_text) %> <% end %> diff --git a/app/views/components/forms/_footer.html.erb b/app/views/components/forms/_footer.html.erb index 974914d1c..8e31e687f 100644 --- a/app/views/components/forms/_footer.html.erb +++ b/app/views/components/forms/_footer.html.erb @@ -6,7 +6,7 @@
<%- if form.disclaimer_text? %> - <%= form.disclaimer_text.html_safe %> + <%= sanitize(form.disclaimer_text) %> <% end -%>