From bb596cdeab4032076209b680adc0211bae054976 Mon Sep 17 00:00:00 2001 From: Max Kadel Date: Thu, 5 Jan 2023 12:19:56 -0500 Subject: [PATCH] Add beginning harmful content feedback bar - Put behind feature flipper so we can have control of rollout and incrementally introduce feature - go to /features to turn on and test - Right now links just go to top and are placeholders for future tickets --- app/assets/stylesheets/application.scss | 1 + .../components/nav--harmful-content.scss | 16 ++++++++++++++++ .../_show_harmful_content_feedback.html.erb | 5 +++++ app/views/catalog/show.html.erb | 3 +++ config/features.rb | 4 ++++ docs/features.md | 6 ++++++ spec/system/catalog_show_spec.rb | 11 +++++++++++ 7 files changed, 46 insertions(+) create mode 100644 app/assets/stylesheets/components/nav--harmful-content.scss create mode 100644 app/views/catalog/_show_harmful_content_feedback.html.erb diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index d8167d8db..5cf42621c 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -49,6 +49,7 @@ @import 'components/header--secondary'; @import 'components/lists'; @import 'components/nav--accounts'; +@import 'components/nav--harmful-content'; @import 'components/overrides'; @import 'components/pagination'; @import 'components/record'; diff --git a/app/assets/stylesheets/components/nav--harmful-content.scss b/app/assets/stylesheets/components/nav--harmful-content.scss new file mode 100644 index 000000000..3bfe44b79 --- /dev/null +++ b/app/assets/stylesheets/components/nav--harmful-content.scss @@ -0,0 +1,16 @@ + +.harmful-content-feedback { + background-color: #e4e4e4; + color: #23578B; + justify-content: space-around; + position: sticky; + bottom: 0; + @media (max-width: $bp-small) { + align-items: flex-start; + flex-direction: column; + flex-wrap: nowrap; + } + .navbar-brand { + font-size: 1rem; + } +} diff --git a/app/views/catalog/_show_harmful_content_feedback.html.erb b/app/views/catalog/_show_harmful_content_feedback.html.erb new file mode 100644 index 000000000..14b0247c1 --- /dev/null +++ b/app/views/catalog/_show_harmful_content_feedback.html.erb @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/app/views/catalog/show.html.erb b/app/views/catalog/show.html.erb index d7d0acd6d..88c5bf148 100644 --- a/app/views/catalog/show.html.erb +++ b/app/views/catalog/show.html.erb @@ -21,6 +21,9 @@ <% end %> + <% if Flipflop.harmful_content_feedback? %> + <%= render partial: 'show_harmful_content_feedback' %> + <% end %>

Supplementary Information

diff --git a/config/features.rb b/config/features.rb index 0525be353..a692e8e00 100644 --- a/config/features.rb +++ b/config/features.rb @@ -30,4 +30,8 @@ feature :firestone_locator, default: true, description: "When on / true, uses the old locator service for Firestone. When off / false uses the new Stackmap service for Firestone." + + feature :harmful_content_feedback, + default: false, + description: "When on / true, displays the Harmful Content Feedback bar." end diff --git a/docs/features.md b/docs/features.md index 0105355f2..a040e33e8 100644 --- a/docs/features.md +++ b/docs/features.md @@ -7,5 +7,11 @@ Unless the feature impacts a controller or initializer (probably better not to u In order to update the application administrators, update the `ORANGELIGHT_ADMIN_NETIDS` value in princeton_ansible, run the Orangelight playbook and restart the application server. +#### In development +In order to use the dashboard in development, run the rails server with the `ORANGELIGHT_ADMIN_NETIDS` environment variable set, e.g. +```zsh +ORANGELIGHT_ADMIN_NETIDS="mk8066" bundle exec rails s +``` + ### Ansible-managed Currently, `read_only_mode` is managed via Ansible. In order to set this value, change the value of `OL_READ_ONLY_MODE` in princeton_ansible and run the Orangelight playbook on the relevant environment. Because this value is set in an initializer, the application server must be restarted before this will take effect (deploying the application will do this as well). \ No newline at end of file diff --git a/spec/system/catalog_show_spec.rb b/spec/system/catalog_show_spec.rb index 10498082b..cbcd4f71e 100644 --- a/spec/system/catalog_show_spec.rb +++ b/spec/system/catalog_show_spec.rb @@ -84,4 +84,15 @@ expect(page).to have_selector('dd.blacklight-isbn_display ul li', count: 4) end end + + describe 'giving feedback' do + let(:document_id) { '9946093213506421' } + before { allow(Flipflop).to receive(:harmful_content_feedback?).and_return(true) } + + it 'shows a feedback bar' do + visit "catalog/#{document_id}" + expect(page).to have_selector('.harmful-content-feedback') + expect(page).to have_content('Report Harmful Language') + end + end end