From 7f93bbbf17cfdcd960ee8c3365682ffaaa965d2d Mon Sep 17 00:00:00 2001 From: Ryan Wold Date: Thu, 9 Nov 2023 16:40:15 -0800 Subject: [PATCH 01/14] remove top-margin from .well --- app/assets/stylesheets/site.scss | 2 +- .../admin/service_providers/index.html.erb | 2 +- .../admin/service_providers/show.html.erb | 23 ++++++++++--------- spec/features/admin/service_providers_spec.rb | 2 +- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/app/assets/stylesheets/site.scss b/app/assets/stylesheets/site.scss index 6323afc6e..361d59a9e 100644 --- a/app/assets/stylesheets/site.scss +++ b/app/assets/stylesheets/site.scss @@ -147,7 +147,7 @@ footer { .well { border: 1px solid #d6d7d9; padding: 20px; - margin: 10px 0; + margin-bottom: 10px; overflow-wrap: break-word; } diff --git a/app/views/admin/service_providers/index.html.erb b/app/views/admin/service_providers/index.html.erb index 3f70367d0..247550e77 100644 --- a/app/views/admin/service_providers/index.html.erb +++ b/app/views/admin/service_providers/index.html.erb @@ -69,7 +69,7 @@

<%= link_to admin_hisps_path(format: :csv), class: "usa-button usa-button--outline" do %> - Download as hisps.csv + Download hisps.csv <% end %> - used on performance.gov/cx

diff --git a/app/views/admin/service_providers/show.html.erb b/app/views/admin/service_providers/show.html.erb index 9f6628f44..1b3fe7f11 100644 --- a/app/views/admin/service_providers/show.html.erb +++ b/app/views/admin/service_providers/show.html.erb @@ -15,19 +15,20 @@ <% end %>

-<% if @service_provider.inactive? %> -
-
-

Inactive

-

- This Service Provider is no longer active. -

-
-
-<% end %> -
+ + <% if @service_provider.inactive? %> +
+
+

Inactive

+

+ This Service Provider is no longer active. +

+
+
+ <% end %> + <% if @service_provider.new? %>

diff --git a/spec/features/admin/service_providers_spec.rb b/spec/features/admin/service_providers_spec.rb index 356f3482a..0c99b16d9 100644 --- a/spec/features/admin/service_providers_spec.rb +++ b/spec/features/admin/service_providers_spec.rb @@ -25,7 +25,7 @@ expect(page).to have_content('Service Providers') expect(page.current_path).to eq(admin_service_providers_path) expect(page).to have_content(service_provider.name) - expect(page).to have_content('Download as hisps.csv') + expect(page).to have_content('Download hisps.csv') end end From a7c5d3e0b6eeaceb3b2731987ce1ee6931124990 Mon Sep 17 00:00:00 2001 From: Ryan Wold Date: Thu, 16 Nov 2023 18:13:38 -0800 Subject: [PATCH 02/14] add cx_collection_detail_upload * update gems * allow .org domain websites --- Gemfile | 1 + Gemfile.lock | 129 ++++++++++-------- app/models/website.rb | 2 +- .../cx_collection_details/upload.html.erb | 42 +++++- app/views/admin/cx_collections/_form.html.erb | 21 ++- app/views/admin/cx_collections/show.html.erb | 26 ++-- app/views/admin/forms/delivery.html.erb | 2 +- app/views/admin/forms/index.html.erb | 2 +- .../question_types/_icon_checkboxes.html.erb | 12 +- app/views/components/widget/_widget.css.erb | 4 + config/initializers/touchpoints.rb | 3 +- config/routes.rb | 1 + ...538_create_cx_collection_detail_uploads.rb | 12 ++ db/schema.rb | 11 +- .../cx_collection_detail_upload_spec.rb | 5 + 15 files changed, 188 insertions(+), 85 deletions(-) create mode 100644 db/migrate/20231114205538_create_cx_collection_detail_uploads.rb create mode 100644 spec/models/cx_collection_detail_upload_spec.rb diff --git a/Gemfile b/Gemfile index 9293ef0c2..1d23cfed2 100644 --- a/Gemfile +++ b/Gemfile @@ -49,6 +49,7 @@ gem "rubocop-rspec" gem 'active_model_serializers', '>= 0.10.13' gem 'acts-as-list' gem 'aws-sdk-rails', '>= 3.8.0' +gem 'aws-sdk-s3' gem 'caracal', '>= 1.4.1' gem 'carrierwave', '>= 2.2.1' gem 'devise', '>= 4.8.1' diff --git a/Gemfile.lock b/Gemfile.lock index 8fbe99005..a0f39eaad 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -18,50 +18,51 @@ GEM aasm-diagram (0.1.3) aasm (~> 5.0, >= 4.12) ruby-graphviz (~> 1.2) - actioncable (7.1.1) - actionpack (= 7.1.1) - activesupport (= 7.1.1) + actioncable (7.1.2) + actionpack (= 7.1.2) + activesupport (= 7.1.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.1) - actionpack (= 7.1.1) - activejob (= 7.1.1) - activerecord (= 7.1.1) - activestorage (= 7.1.1) - activesupport (= 7.1.1) + actionmailbox (7.1.2) + actionpack (= 7.1.2) + activejob (= 7.1.2) + activerecord (= 7.1.2) + activestorage (= 7.1.2) + activesupport (= 7.1.2) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.1.1) - actionpack (= 7.1.1) - actionview (= 7.1.1) - activejob (= 7.1.1) - activesupport (= 7.1.1) + actionmailer (7.1.2) + actionpack (= 7.1.2) + actionview (= 7.1.2) + activejob (= 7.1.2) + activesupport (= 7.1.2) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.2) - actionpack (7.1.1) - actionview (= 7.1.1) - activesupport (= 7.1.1) + actionpack (7.1.2) + actionview (= 7.1.2) + activesupport (= 7.1.2) nokogiri (>= 1.8.5) + racc rack (>= 2.2.4) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.1) - actionpack (= 7.1.1) - activerecord (= 7.1.1) - activestorage (= 7.1.1) - activesupport (= 7.1.1) + actiontext (7.1.2) + actionpack (= 7.1.2) + activerecord (= 7.1.2) + activestorage (= 7.1.2) + activesupport (= 7.1.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.1) - activesupport (= 7.1.1) + actionview (7.1.2) + activesupport (= 7.1.2) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) @@ -71,22 +72,22 @@ GEM activemodel (>= 4.1) case_transform (>= 0.2) jsonapi-renderer (>= 0.1.1.beta1, < 0.3) - activejob (7.1.1) - activesupport (= 7.1.1) + activejob (7.1.2) + activesupport (= 7.1.2) globalid (>= 0.3.6) - activemodel (7.1.1) - activesupport (= 7.1.1) - activerecord (7.1.1) - activemodel (= 7.1.1) - activesupport (= 7.1.1) + activemodel (7.1.2) + activesupport (= 7.1.2) + activerecord (7.1.2) + activemodel (= 7.1.2) + activesupport (= 7.1.2) timeout (>= 0.4.0) - activestorage (7.1.1) - actionpack (= 7.1.1) - activejob (= 7.1.1) - activerecord (= 7.1.1) - activesupport (= 7.1.1) + activestorage (7.1.2) + actionpack (= 7.1.2) + activejob (= 7.1.2) + activerecord (= 7.1.2) + activesupport (= 7.1.2) marcel (~> 1.0) - activesupport (7.1.1) + activesupport (7.1.2) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) @@ -104,7 +105,7 @@ GEM aes_key_wrap (1.1.0) ast (2.4.2) aws-eventstream (1.2.0) - aws-partitions (1.848.0) + aws-partitions (1.849.0) aws-record (2.13.0) aws-sdk-dynamodb (~> 1, >= 1.85.0) aws-sdk-core (3.186.0) @@ -115,6 +116,9 @@ GEM aws-sdk-dynamodb (1.96.0) aws-sdk-core (~> 3, >= 3.184.0) aws-sigv4 (~> 1.1) + aws-sdk-kms (1.72.0) + aws-sdk-core (~> 3, >= 3.184.0) + aws-sigv4 (~> 1.1) aws-sdk-rails (3.9.0) aws-record (~> 2) aws-sdk-ses (~> 1, >= 1.50.0) @@ -123,13 +127,17 @@ GEM aws-sessionstore-dynamodb (~> 2) concurrent-ruby (~> 1) railties (>= 5.2.0) + aws-sdk-s3 (1.136.0) + aws-sdk-core (~> 3, >= 3.181.0) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.6) aws-sdk-ses (1.56.0) aws-sdk-core (~> 3, >= 3.184.0) aws-sigv4 (~> 1.1) aws-sdk-sesv2 (1.41.0) aws-sdk-core (~> 3, >= 3.184.0) aws-sigv4 (~> 1.1) - aws-sdk-sqs (1.65.0) + aws-sdk-sqs (1.67.0) aws-sdk-core (~> 3, >= 3.184.0) aws-sigv4 (~> 1.1) aws-sessionstore-dynamodb (2.1.0) @@ -241,7 +249,7 @@ GEM activesupport (>= 6.0.0) railties (>= 6.0.0) io-console (0.6.0) - irb (1.8.3) + irb (1.9.0) rdoc reline (>= 0.3.8) jbuilder (2.11.5) @@ -279,7 +287,7 @@ GEM rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) logstop (0.3.1) - loofah (2.21.4) + loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -302,7 +310,7 @@ GEM multi_xml (0.6.0) multipart-post (2.3.0) mutex_m (0.2.0) - net-imap (0.4.4) + net-imap (0.4.5) date net-protocol net-pop (0.1.2) @@ -356,7 +364,7 @@ GEM public_suffix (5.0.3) puma (6.4.0) nio4r (~> 2.0) - racc (1.7.2) + racc (1.7.3) rack (2.2.8) rack-cors (2.0.1) rack (>= 2.0.0) @@ -369,20 +377,20 @@ GEM rackup (1.0.0) rack (< 3) webrick - rails (7.1.1) - actioncable (= 7.1.1) - actionmailbox (= 7.1.1) - actionmailer (= 7.1.1) - actionpack (= 7.1.1) - actiontext (= 7.1.1) - actionview (= 7.1.1) - activejob (= 7.1.1) - activemodel (= 7.1.1) - activerecord (= 7.1.1) - activestorage (= 7.1.1) - activesupport (= 7.1.1) + rails (7.1.2) + actioncable (= 7.1.2) + actionmailbox (= 7.1.2) + actionmailer (= 7.1.2) + actionpack (= 7.1.2) + actiontext (= 7.1.2) + actionview (= 7.1.2) + activejob (= 7.1.2) + activemodel (= 7.1.2) + activerecord (= 7.1.2) + activestorage (= 7.1.2) + activesupport (= 7.1.2) bundler (>= 1.15.0) - railties (= 7.1.1) + railties (= 7.1.2) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -399,9 +407,9 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.1.1) - actionpack (= 7.1.1) - activesupport (= 7.1.1) + railties (7.1.2) + actionpack (= 7.1.2) + activesupport (= 7.1.2) irb rackup (>= 1.0.0) rake (>= 12.2) @@ -421,7 +429,7 @@ GEM redis-namespace (1.11.0) redis (>= 4) regexp_parser (2.8.2) - reline (0.3.9) + reline (0.4.0) io-console (~> 0.5) request_store (1.5.1) rack (>= 1.4) @@ -566,6 +574,7 @@ DEPENDENCIES acts-as-list acts-as-taggable-on aws-sdk-rails (>= 3.8.0) + aws-sdk-s3 bootsnap brakeman bullet diff --git a/app/models/website.rb b/app/models/website.rb index 4e7c75db7..c2ba61b60 100644 --- a/app/models/website.rb +++ b/app/models/website.rb @@ -191,7 +191,7 @@ def validate_domain_format end def validate_domain_suffix - errors.add(:domain, 'domain must have a valid suffix, like .gov or .mil') unless domain.present? && APPROVED_DOMAINS.any? { |word| domain.end_with?(word) } + errors.add(:domain, 'domain must have a valid suffix, like .gov or .mil') unless domain.present? && APPROVED_WEBSITE_DOMAINS.any? { |word| domain.end_with?(word) } end def site_scanner_json_request diff --git a/app/views/admin/cx_collection_details/upload.html.erb b/app/views/admin/cx_collection_details/upload.html.erb index 5001ef776..d9666b30c 100644 --- a/app/views/admin/cx_collection_details/upload.html.erb +++ b/app/views/admin/cx_collection_details/upload.html.erb @@ -18,7 +18,7 @@ <% end %>

-<%= form_with(model: @cx_collection_detail, url: (@cx_collection_detail.persisted? ? admin_cx_collection_detail_path(@cx_collection_detail) : admin_cx_collection_details_path) ) do |form| %> +<%= form_with url: post_csv_admin_cx_collection_detail_path, method: :post, local: true, multipart: true do |form| %> <% if @cx_collection_detail.errors.any? %>

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

@@ -34,10 +34,48 @@
<%= form.label :logo_display, "Upload CX Data Collection", class: "usa-label text-uppercase font-body-3xs", for: "file-input-single" %> - <%= form.file_field :logo, class: "usa-file-input display-logo", data_url: "" %> + <%= form.file_field :file, class: "usa-file-input display-logo", data_url: "" %>

<%= form.submit class: "usa-button" %>

<% end %> + +<% uploads = CxCollectionDetailUpload.where(cx_collection_detail_id: @cx_collection_detail.id) %> + + + + + + + + + + + + + <% uploads.each do |upload| %> + + + + + + + + <% end %> + +
UserFile pathSizeTimestamp
+ <%= upload.user.email %> + + <%= link_to(upload.key, upload.key) %> + + <%= upload.size %> + + <%= upload.created_at %> + + <%= link_to "Process responses file", admin_cx_collection_detail_path(@cx_collection_detail), method: :post %> +
+ + +
diff --git a/app/views/admin/cx_collections/_form.html.erb b/app/views/admin/cx_collections/_form.html.erb index dc70b1c9c..d59d581d6 100644 --- a/app/views/admin/cx_collections/_form.html.erb +++ b/app/views/admin/cx_collections/_form.html.erb @@ -1,4 +1,4 @@ -<%= form_with(model: cx_collection, url: (cx_collection.persisted? ? admin_cx_collection_path(cx_collection) : admin_cx_collections_path), local: true, data: { turbo: false }) do |form| %> +<%= form_with(model: cx_collection, url: (cx_collection.persisted? ? admin_cx_collection_path(cx_collection) : admin_cx_collections_path), class: "usa-form", local: true, data: { turbo: false }) do |form| %> <% if cx_collection.errors.any? %>

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

@@ -27,7 +27,7 @@
<%= form.label :service_provider_id, "HISP Service Provider", class: "usa-label" %> - <%= form.select :service_provider_id, ServiceProvider.all.includes(:organization).map { |h| ["#{h.organization.abbreviation} - #{h.organization.name} - #{h.name}", h.id] }, { include_blank: true }, { class: "usa-select", required: true } %> + <%= form.select :service_provider_id, ServiceProvider.all.includes(:organization).order("organizations.abbreviation", :name).map { |h| ["#{h.organization.abbreviation} - #{h.organization.name} - #{h.name}", h.id] }, { include_blank: true }, { class: "usa-select", required: true } %>
@@ -37,12 +37,12 @@
<%= form.label :fiscal_year, class: "usa-label" %> - <%= form.text_field :fiscal_year, class: "usa-input", required: true %> + <%= form.select :fiscal_year, options_for_select([2024, 2025], 2024), {}, class: "usa-select", required: true %>
<%= form.label :quarter, class: "usa-label" %> - <%= form.number_field :quarter, class: "usa-input", required: true, min: 1, max: 4 %> + <%= form.select :quarter, options_for_select([1, 2, 3, 4]), {}, class: "usa-select", required: true %>
@@ -62,7 +62,7 @@
<%= form.label :reflection, 'Reflection text', class: "usa-label" %>
- Please limit to 100 words. + Tell us what customer service improvements you were able to complete based on this quarter’s survey results. Please limit to 150 words.
<%= form.text_area :reflection, class: "usa-textarea" %>
@@ -79,6 +79,17 @@
<% end %> + <% if !cx_collection.persisted? %> +
+
+
+

+ After creating this collection, you can add survey results in the following screen. +

+
+
+ <% end %> +

<%= form.submit class: "usa-button" %>

diff --git a/app/views/admin/cx_collections/show.html.erb b/app/views/admin/cx_collections/show.html.erb index 966c9b74e..0f7b4a875 100644 --- a/app/views/admin/cx_collections/show.html.erb +++ b/app/views/admin/cx_collections/show.html.erb @@ -89,8 +89,8 @@
-

- Services +

+ Collection details (<%= @cx_collection.cx_collection_details.size %>) @@ -98,19 +98,21 @@

- Add a Service detail reporting page for each touchpoint available within a HISP service. + Add a reporting page for each touchpoint available within a HISP service.

-
    - <% @cx_collection.cx_collection_details.order(:channel).each do |cx_collection| %> -
  • - <%= link_to ("#{cx_collection.try(:service).try(:name)}"), admin_cx_collection_detail_path(cx_collection) %> · - <%= cx_collection.channel %> -
  • - <% end %> -
- <% if @cx_collection.draft? %> +
+
    + <% @cx_collection.cx_collection_details.order(:channel).each do |cx_collection| %> +
  • + <%= link_to ("#{cx_collection.try(:service).try(:name)}"), admin_cx_collection_detail_path(cx_collection) %> · + <%= cx_collection.channel %> +
  • + <% end %> +
+
+ <%- if @cx_collection.draft? %>

<%= link_to new_admin_cx_collection_detail_path(collection_id: @cx_collection.id), class: "usa-button usa-button--outline" do %> diff --git a/app/views/admin/forms/delivery.html.erb b/app/views/admin/forms/delivery.html.erb index 2a4e26cd4..b82eb41da 100644 --- a/app/views/admin/forms/delivery.html.erb +++ b/app/views/admin/forms/delivery.html.erb @@ -65,7 +65,7 @@


-
+
How will users access this survey?
Delivery methods diff --git a/app/views/admin/forms/index.html.erb b/app/views/admin/forms/index.html.erb index b62b6f343..c4db58003 100644 --- a/app/views/admin/forms/index.html.erb +++ b/app/views/admin/forms/index.html.erb @@ -90,7 +90,7 @@