From cf86cefd9d8da5ee20bd926124d8bec773c2a871 Mon Sep 17 00:00:00 2001 From: Ryan Wold Date: Tue, 18 Apr 2023 14:18:14 -0700 Subject: [PATCH] registry updates * update step indicators --- Gemfile.lock | 16 ++-- .../admin/digital_products_controller.rb | 6 +- .../digital_service_accounts_controller.rb | 7 +- ...omb_cx_reporting_collections_controller.rb | 4 +- app/models/omb_cx_reporting_collection.rb | 2 +- app/views/admin/collections/_form.html.erb | 2 +- .../_omb_a11_cx_quarterly_reporting.html.erb | 2 +- .../digital_product_versions/_form.html.erb | 4 +- .../admin/digital_products/_form.html.erb | 4 +- .../digital_products/_step_indicator.html.erb | 91 +++++++++++++++---- .../admin/digital_products/show.html.erb | 17 ++-- .../digital_service_accounts/_form.html.erb | 2 +- .../_step_indicator.html.erb | 72 +++++++++++++++ .../digital_service_accounts/show.html.erb | 61 +++++++------ app/views/admin/forms/_pra.html.erb | 2 +- .../_form.html.erb | 8 +- app/views/admin/performance/_form.html.erb | 8 +- app/views/admin/performance/index.html.erb | 2 +- app/views/admin/services/_form.html.erb | 2 +- app/views/admin/websites/_costs_form.html.erb | 4 +- app/views/admin/websites/_form.html.erb | 8 +- .../components/_whitelist_options.html.erb | 4 +- spec/features/admin/forms_spec.rb | 4 +- 23 files changed, 230 insertions(+), 102 deletions(-) create mode 100644 app/views/admin/digital_service_accounts/_step_indicator.html.erb diff --git a/Gemfile.lock b/Gemfile.lock index 1cc542269..f476b685e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -91,12 +91,12 @@ GEM acts-as-list (0.1.2) acts-as-taggable-on (9.0.1) activerecord (>= 6.0, < 7.1) - addressable (2.8.3) + addressable (2.8.4) public_suffix (>= 2.0.2, < 6.0) aes_key_wrap (1.1.0) ast (2.4.2) aws-eventstream (1.2.0) - aws-partitions (1.742.0) + aws-partitions (1.749.0) aws-record (2.10.1) aws-sdk-dynamodb (~> 1.18) aws-sdk-core (3.171.0) @@ -293,12 +293,12 @@ GEM timeout net-smtp (0.3.3) net-protocol - newrelic_rpm (9.1.0) + newrelic_rpm (9.2.0) nio4r (2.5.9) - nokogiri (1.14.2) + nokogiri (1.14.3) mini_portile2 (~> 2.8.0) racc (~> 1.4) - nokogiri (1.14.2-x86_64-darwin) + nokogiri (1.14.3-x86_64-darwin) racc (~> 1.4) oauth2 (2.0.9) faraday (>= 0.17.3, < 3.0) @@ -321,7 +321,7 @@ GEM paper_trail (12.3.0) activerecord (>= 5.2) request_store (~> 1.1) - parallel (1.22.1) + parallel (1.23.0) parser (3.2.2.0) ast (~> 2.4.1) pg (1.4.6) @@ -382,7 +382,7 @@ GEM redis (4.8.0) redis-namespace (1.10.0) redis (>= 4) - regexp_parser (2.7.0) + regexp_parser (2.8.0) request_store (1.5.1) rack (>= 1.4) responders (3.1.0) @@ -409,7 +409,7 @@ GEM rspec-support (3.12.0) rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (1.49.0) + rubocop (1.50.2) json (~> 2.3) parallel (~> 1.10) parser (>= 3.2.0.0) diff --git a/app/controllers/admin/digital_products_controller.rb b/app/controllers/admin/digital_products_controller.rb index 248b1c4b0..1fee91d97 100644 --- a/app/controllers/admin/digital_products_controller.rb +++ b/app/controllers/admin/digital_products_controller.rb @@ -45,7 +45,11 @@ def review .page(params[:page]) end - def show; end + def show + @events = Event.where(object_type: "Digital Product", object_id: @digital_product.id.to_s) + .includes(:user) + .order("created_at DESC") + end def new @digital_product = DigitalProduct.new diff --git a/app/controllers/admin/digital_service_accounts_controller.rb b/app/controllers/admin/digital_service_accounts_controller.rb index dd8ee17b3..6cd049f32 100644 --- a/app/controllers/admin/digital_service_accounts_controller.rb +++ b/app/controllers/admin/digital_service_accounts_controller.rb @@ -52,7 +52,12 @@ def review .page(params[:page]) end - def show; end + def show + @events = Event + .where(object_type: "Digital Service Account", object_id: @digital_service_account.id.to_s) + .includes(:user) + .order("created_at DESC") + end def new @digital_service_account = DigitalServiceAccount.new diff --git a/app/controllers/admin/omb_cx_reporting_collections_controller.rb b/app/controllers/admin/omb_cx_reporting_collections_controller.rb index 6f61f85db..86f547bda 100644 --- a/app/controllers/admin/omb_cx_reporting_collections_controller.rb +++ b/app/controllers/admin/omb_cx_reporting_collections_controller.rb @@ -51,9 +51,9 @@ def set_omb_cx_reporting_collection def set_collections if performance_manager_permissions? - @collections = Collection.all + @collections = Collection.all.order('organizations.name').includes(:organization) else - @collections = current_user.collections + @collections = current_user.collections.order('organizations.name').includes(:organization) end end diff --git a/app/models/omb_cx_reporting_collection.rb b/app/models/omb_cx_reporting_collection.rb index 7ffc77272..159de9ad3 100644 --- a/app/models/omb_cx_reporting_collection.rb +++ b/app/models/omb_cx_reporting_collection.rb @@ -29,7 +29,7 @@ def omb_control_number end def federal_register_url - super || 'Federal Register URL' + super || 'https:///www.reginfo.gov/...' end def q1_point_scale diff --git a/app/views/admin/collections/_form.html.erb b/app/views/admin/collections/_form.html.erb index 9efa2e778..69e211114 100644 --- a/app/views/admin/collections/_form.html.erb +++ b/app/views/admin/collections/_form.html.erb @@ -31,7 +31,7 @@
<%= f.label :service_provider_id, "HISP Service Provider", class: "usa-label" %> - <%= f.select :service_provider_id, ServiceProvider.all.map { |h| ["#{h.organization.name} - #{h.name}", h.id] }, { include_blank: true }, class: "usa-select" %> + <%= f.select :service_provider_id, ServiceProvider.all.map { |h| ["#{h.organization.abbreviation} - #{h.organization.name} - #{h.name}", h.id] }, { include_blank: true }, class: "usa-select" %>
diff --git a/app/views/admin/collections/_omb_a11_cx_quarterly_reporting.html.erb b/app/views/admin/collections/_omb_a11_cx_quarterly_reporting.html.erb index e7dda19b0..bcfa297ed 100644 --- a/app/views/admin/collections/_omb_a11_cx_quarterly_reporting.html.erb +++ b/app/views/admin/collections/_omb_a11_cx_quarterly_reporting.html.erb @@ -44,7 +44,7 @@
<%= form.label :federal_register_url, class: "usa-label" %> - <%= form.text_field :federal_register_url, class: "usa-input", placeholder: "https://federalregister.gov/..." %> + <%= form.url_field :federal_register_url, class: "usa-input", placeholder: "https://federalregister.gov/..." %>
diff --git a/app/views/admin/digital_product_versions/_form.html.erb b/app/views/admin/digital_product_versions/_form.html.erb index b32993abb..2f8f016d1 100644 --- a/app/views/admin/digital_product_versions/_form.html.erb +++ b/app/views/admin/digital_product_versions/_form.html.erb @@ -25,7 +25,7 @@
<%= form.label :store_url, "Store URL", class: "usa-label" %> - <%= form.text_field :store_url, class: "usa-input" %> + <%= form.url_field :store_url, class: "usa-input" %>
@@ -57,7 +57,7 @@
<%= form.label :screenshot_url, class: "usa-label" %> - <%= form.text_field :screenshot_url, class: "usa-input" %> + <%= form.url_field :screenshot_url, class: "usa-input" %>
diff --git a/app/views/admin/digital_products/_step_indicator.html.erb b/app/views/admin/digital_products/_step_indicator.html.erb index 80b20207c..2ebc6e4e5 100644 --- a/app/views/admin/digital_products/_step_indicator.html.erb +++ b/app/views/admin/digital_products/_step_indicator.html.erb @@ -1,21 +1,72 @@ -
-
    -
  1. ""> - - Drafted - <% if collection.draft? %> - completed - <% end %> - -
  2. -
  3. <%= "usa-step-indicator__segment--current" if collection.submitted? %>"> - - Submitted - completed - -
  4. -
  5. <%= "usa-step-indicator__segment--current" if collection.published? %>" aria-current="true"> - Published -
  6. -
+
+ +
+ Publication status: + <%= product.aasm_state %> + +
+
+
+
+ +
+

+ Each digital product is a digital asset and has a publishing flow. + The "aasm_state" states a digital product may have are below. +

+
+
    + <% { "created" => "Created", "updated" => "Updated", "submitted" => "Submitted", "published" => "Published", "archived" => "Archived" }.each_pair do |key, value| %> +
  • + "><%= value %> +
  • + <% end %> +
+
+
+ +
+
+ +
+
    +
  1. + <%= "usa-step-indicator__segment--current" if product.created? %>" + aria-current="true"> + Created +
  2. +
  3. + <%= "usa-step-indicator__segment--current" if product.submitted? %>" aria-current="true"> + Submitted +
  4. +
  5. + <%= "usa-step-indicator__segment--current" if product.published? %>" aria-current="true"> + Published +
  6. +
  7. + <%= "usa-step-indicator__segment--current" if product.archived? %>" aria-current="true"> + Archived +
  8. +
+
diff --git a/app/views/admin/digital_products/show.html.erb b/app/views/admin/digital_products/show.html.erb index 361cb5b36..2e9f2a503 100644 --- a/app/views/admin/digital_products/show.html.erb +++ b/app/views/admin/digital_products/show.html.erb @@ -1,7 +1,7 @@
<% content_for :navigation_title do %> - Viewing Mobile App: <%= @digital_product.name %> + Mobile App: <%= @digital_product.name %> <% if digital_product_permissions?(digital_product: @digital_product, user: current_user) %> <%= link_to edit_admin_digital_product_path(@digital_product), class: "usa-button usa-button-inverted float-right" do %> @@ -29,7 +29,11 @@
<% end %>
+
+ +<%= render 'admin/digital_products/step_indicator', product: @digital_product %> +

<%= label_tag "Name", nil, class: "usa-label" %> @@ -37,14 +41,6 @@ <%= @digital_product.name %>

-

- <%= label_tag "Status", nil, class: "usa-label" %> -
- - <%= @digital_product.aasm_state %> - -

-

<%= label_tag "Short description", nil, class: "usa-label" %>
@@ -238,8 +234,7 @@

<% if digital_product_permissions?(digital_product: @digital_product, user: current_user) %> - <%= render 'components/event_log', events: Event.where(object_type: "Digital Product", object_id: @digital_product.id.to_s ).order("created_at DESC") %> + <%= render 'components/event_log', events: @events %> <% end %> -
diff --git a/app/views/admin/digital_service_accounts/_form.html.erb b/app/views/admin/digital_service_accounts/_form.html.erb index e2d0d1e94..59a34bdf1 100644 --- a/app/views/admin/digital_service_accounts/_form.html.erb +++ b/app/views/admin/digital_service_accounts/_form.html.erb @@ -23,7 +23,7 @@
<%= form.label :service_url, "Account URL", class: "usa-label" %> - <%= form.text_field :service_url, class: "usa-input", required: true %> + <%= form.url_field :service_url, class: "usa-input", required: true %>
diff --git a/app/views/admin/digital_service_accounts/_step_indicator.html.erb b/app/views/admin/digital_service_accounts/_step_indicator.html.erb new file mode 100644 index 000000000..0eca2a0aa --- /dev/null +++ b/app/views/admin/digital_service_accounts/_step_indicator.html.erb @@ -0,0 +1,72 @@ +
+ +
+ Publication status: + <%= account.aasm_state %> + +
+
+
+
+ +
+

+ Each digital service account is a digital asset and has a publishing flow. + The "aasm_state" states a digital service account may have are below. +

+
+
    + <% { "created" => "Created", "updated" => "Updated", "submitted" => "Submitted", "published" => "Published", "archived" => "Archived" }.each_pair do |key, value| %> +
  • + "><%= value %> +
  • + <% end %> +
+
+
+ +
+
+ +
+
    +
  1. + <%= "usa-step-indicator__segment--current" if account.created? %>" + aria-current="true"> + Created +
  2. +
  3. + <%= "usa-step-indicator__segment--current" if account.submitted? %>" aria-current="true"> + Submitted +
  4. +
  5. + <%= "usa-step-indicator__segment--current" if account.published? %>" aria-current="true"> + Published +
  6. +
  7. + <%= "usa-step-indicator__segment--current" if account.archived? %>" aria-current="true"> + Archived +
  8. +
+
+
diff --git a/app/views/admin/digital_service_accounts/show.html.erb b/app/views/admin/digital_service_accounts/show.html.erb index 6ee3a7423..b1135f3f1 100644 --- a/app/views/admin/digital_service_accounts/show.html.erb +++ b/app/views/admin/digital_service_accounts/show.html.erb @@ -1,29 +1,36 @@ -<% content_for :navigation_title do %> - Social Media Account: <%= @digital_service_account.service %> +
+
+ <% content_for :navigation_title do %> + Social Media Account: <%= @digital_service_account.service %> + + <% if digital_service_account_permissions?(digital_service_account: @digital_service_account, user: current_user) %> + <%= link_to edit_admin_digital_service_account_path(@digital_service_account), class: "usa-button usa-button-inverted float-right" do %> + + Edit + <% end %> + <% end %> + <% end %> - <% if digital_service_account_permissions?(digital_service_account: @digital_service_account, user: current_user) %> - <%= link_to edit_admin_digital_service_account_path(@digital_service_account), class: "usa-button usa-button-inverted float-right" do %> - - Edit +

+ <%= link_to admin_digital_service_accounts_path do %> + + Back to Social Media Accounts + <% end %> +

+ + <% if @digital_service_account.archived? %> +
+
+

+ This social media account has been archived. +

+
+
<% end %> - <% end %> -<% end %> -

- <%= link_to admin_digital_service_accounts_path do %> - - Back to Social Media Accounts - <% end %> -

- -<% if @digital_service_account.archived? %> -
-
-

- This social media account has been archived. -

-
-<% end %> +
+ +<%= render 'admin/digital_service_accounts/step_indicator', account: @digital_service_account %>
@@ -44,12 +51,6 @@ <%= @digital_service_account.service_url? ? link_to(@digital_service_account.service_url, @digital_service_account.service_url, target: "_blank", rel: "noopener") : '' %>

-

- <%= label_tag "Status", nil, class: "usa-label" %> -
- <%= @digital_service_account.aasm_state %> -

-

<%= label_tag "Short description", nil, class: "usa-label" %>
@@ -172,7 +173,7 @@ <% end %> <% if digital_service_account_permissions?(digital_service_account: @digital_service_account, user: current_user) %> - <%= render 'components/event_log', events: Event.where(object_type: "Digital Service Account", object_id: @digital_service_account.id.to_s ).order("created_at DESC") %> + <%= render 'components/event_log', events: @events %> <% end %>

diff --git a/app/views/admin/forms/_pra.html.erb b/app/views/admin/forms/_pra.html.erb index 275d876a1..41830bb32 100644 --- a/app/views/admin/forms/_pra.html.erb +++ b/app/views/admin/forms/_pra.html.erb @@ -52,7 +52,7 @@
<%= f.label :federal_register_url, class: "usa-label" %> - <%= f.text_field :federal_register_url, class: "usa-input", placeholder: "https://www.federalregister.gov/..." %> + <%= f.url_field :federal_register_url, class: "usa-input", placeholder: "https://www.federalregister.gov/..." %>
diff --git a/app/views/admin/omb_cx_reporting_collections/_form.html.erb b/app/views/admin/omb_cx_reporting_collections/_form.html.erb index 3e12b712e..e9927b771 100644 --- a/app/views/admin/omb_cx_reporting_collections/_form.html.erb +++ b/app/views/admin/omb_cx_reporting_collections/_form.html.erb @@ -14,7 +14,7 @@
<%= form.label :collection_id, class: "usa-label" %> - <%= form.select :collection_id, options_for_select(@collections.map { |c| ["#{c.organization.name} - FY#{c.year}-Q#{c.quarter} #{c.name}", c.id]}, omb_cx_reporting_collection.collection_id), { include_blank: true }, class: "usa-select" %> + <%= form.select :collection_id, options_for_select(@collections.map { |c| ["#{c.organization.abbreviation} - #{c.organization.name} - FY#{c.year}-Q#{c.quarter} #{c.name}", c.id]}, omb_cx_reporting_collection.collection_id), { include_blank: true }, class: "usa-select" %>
<%= form.label :service_id, class: "usa-label" %> @@ -23,9 +23,9 @@ <%= link_to "here", admin_services_path, target: "_blank", rel: "noopener" %>.

<% if @collection %> - <%= form.select :service_id, @collection.organization.services.includes(:organization).order("organizations.name", :name).map { |h| ["#{h.organization.name} - #{h.name}", h.id] }, { prompt: "For which Service?" }, class: "usa-select" %> + <%= form.select :service_id, @collection.organization.services.includes(:organization).order("organizations.name", :name).map { |h| ["#{h.organization.abbreviation} - #{h.organization.name} - #{h.name}", h.id] }, { prompt: "For which Service?" }, class: "usa-select" %> <% else %> - <%= form.select :service_id, Service.all.includes(:organization).order("organizations.name", :name).map { |h| ["#{h.organization.name} - #{h.name}", h.id] }, { prompt: "For which Service?" }, class: "usa-select" %> + <%= form.select :service_id, Service.all.includes(:organization).order("organizations.name", :name).map { |h| ["#{h.organization.abbreviation} - #{h.organization.name} - #{h.name}", h.id] }, { prompt: "For which Service?" }, class: "usa-select" %> <% end %>
@@ -67,7 +67,7 @@

Enter the reginfo.gov URL for the survey form.

- <%= form.text_field :federal_register_url, class: "usa-input", placeholder: "https://www.reginfo.gov/...", required: true %> + <%= form.url_field :federal_register_url, class: "usa-input", placeholder: "https://www.reginfo.gov/...", required: true %>
<%= form.label :operational_metrics, class: "usa-label" %> diff --git a/app/views/admin/performance/_form.html.erb b/app/views/admin/performance/_form.html.erb index 8073474b4..db66d6001 100644 --- a/app/views/admin/performance/_form.html.erb +++ b/app/views/admin/performance/_form.html.erb @@ -18,22 +18,22 @@
<%= form.label :mission_statement_url, class: "usa-label" %> - <%= form.text_field :mission_statement_url, class: "usa-input", placeholder: "gsa.gov" %> + <%= form.url_field :mission_statement_url, class: "usa-input", placeholder: "gsa.gov" %>
<%= form.label :strategic_plan_url, class: "usa-label" %> - <%= form.text_field :strategic_plan_url, class: "usa-input" %> + <%= form.url_field :strategic_plan_url, class: "usa-input" %>
<%= form.label :performance_url, class: "usa-label" %> - <%= form.text_field :performance_url, class: "usa-input" %> + <%= form.url_field :performance_url, class: "usa-input" %>
<%= form.label :learning_agenda_url, class: "usa-label" %> - <%= form.text_field :learning_agenda_url, class: "usa-input" %> + <%= form.url_field :learning_agenda_url, class: "usa-input" %>

diff --git a/app/views/admin/performance/index.html.erb b/app/views/admin/performance/index.html.erb index 479d11660..9398d5fdf 100644 --- a/app/views/admin/performance/index.html.erb +++ b/app/views/admin/performance/index.html.erb @@ -70,7 +70,7 @@ for Admins

- <%= link_to "Send quarterly email to all Users for Draft Collections", admin_quarterly_performance_notification_path(year: 2023, quarter: 1), method: :post, class: + <%= link_to "Send quarterly email to all Users for Draft Collections", admin_quarterly_performance_notification_path(year: 2023, quarter: 2), method: :post, class: "usa-button usa-button--outline" %>

diff --git a/app/views/admin/services/_form.html.erb b/app/views/admin/services/_form.html.erb index 580b208c9..54170a126 100644 --- a/app/views/admin/services/_form.html.erb +++ b/app/views/admin/services/_form.html.erb @@ -304,7 +304,7 @@
<%= form.label :homepage_url, "URL where the public can learn about the service", class: "usa-label" %> - <%= form.text_field :homepage_url, class: "usa-input" %> + <%= form.url_field :homepage_url, class: "usa-input" %>
diff --git a/app/views/admin/websites/_costs_form.html.erb b/app/views/admin/websites/_costs_form.html.erb index 516b7d45b..5c2e1c245 100644 --- a/app/views/admin/websites/_costs_form.html.erb +++ b/app/views/admin/websites/_costs_form.html.erb @@ -20,11 +20,11 @@
<%= form.label :cost_estimator_url, class: "usa-label" %> - <%= form.text_field :cost_estimator_url, class: "usa-input" %> + <%= form.url_field :cost_estimator_url, class: "usa-input" %>
<%= form.label :modernization_plan_url, class: "usa-label" %> - <%= form.text_field :modernization_plan_url, class: "usa-input" %> + <%= form.url_field :modernization_plan_url, class: "usa-input" %>
<%= form.label :annual_baseline_cost, class: "usa-label" %> diff --git a/app/views/admin/websites/_form.html.erb b/app/views/admin/websites/_form.html.erb index c6edd8159..fef7788d1 100644 --- a/app/views/admin/websites/_form.html.erb +++ b/app/views/admin/websites/_form.html.erb @@ -120,7 +120,7 @@
<%= form.label :sitemap_url, class: "usa-label" %> - <%= form.text_field :sitemap_url, class: "usa-input" %> + <%= form.url_field :sitemap_url, class: "usa-input" %>

@@ -188,11 +188,11 @@
<%= form.label :backlog_url, class: "usa-label" %> - <%= form.text_field :backlog_url, class: "usa-input" %> + <%= form.url_field :backlog_url, class: "usa-input" %>
<%= form.label :repository_url, class: "usa-label" %> - <%= form.text_field :repository_url, class: "usa-input" %> + <%= form.url_field :repository_url, class: "usa-input" %>
<%= form.label :hosting_platform, class: "usa-label" %> @@ -218,7 +218,7 @@
<%= form.label :analytics_url, class: "usa-label" %> - <%= form.text_field :analytics_url, class: "usa-input" %> + <%= form.url_field :analytics_url, class: "usa-input" %>
<%= form.label :feedback_tool, class: "usa-label" %> diff --git a/app/views/components/_whitelist_options.html.erb b/app/views/components/_whitelist_options.html.erb index 002f27efc..c36a2fa19 100644 --- a/app/views/components/_whitelist_options.html.erb +++ b/app/views/components/_whitelist_options.html.erb @@ -15,13 +15,13 @@
<%= f.label :whitelist_url, "URL where survey will display on your website", class: "usa-label" %> - <%= f.text_field :whitelist_url, class: "usa-input", placeholder: "https://example.gov" %> + <%= f.url_field :whitelist_url, class: "usa-input", placeholder: "https://example.gov" %>
<%= f.label :whitelist_test_url, "URL for staging or testing site where survey will display", class: "usa-label" %> - <%= f.text_field :whitelist_test_url, class: "usa-input", placeholder: "https://staging.example.gov" %> + <%= f.url_field :whitelist_test_url, class: "usa-input", placeholder: "https://staging.example.gov" %>
diff --git a/spec/features/admin/forms_spec.rb b/spec/features/admin/forms_spec.rb index c14bcadac..125e7bc40 100644 --- a/spec/features/admin/forms_spec.rb +++ b/spec/features/admin/forms_spec.rb @@ -482,14 +482,14 @@ describe 'editing the whitelist url' do before do - fill_in 'form_whitelist_url', with: 'example.com' + fill_in 'form_whitelist_url', with: 'https://example.com' click_on 'Update Form' end it 'can edit existing Form' do expect(page).to have_content('Form was successfully updated.') expect(page.current_path).to eq(delivery_admin_form_path(form)) - expect(find('#form_whitelist_url').value).to eq('example.com') + expect(find('#form_whitelist_url').value).to eq('https://example.com') end end