Skip to content

Commit

Permalink
Add beginning harmful content feedback bar
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
maxkadel committed Jan 5, 2023
1 parent 18866f1 commit bb596cd
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
16 changes: 16 additions & 0 deletions app/assets/stylesheets/components/nav--harmful-content.scss
Original file line number Diff line number Diff line change
@@ -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;
}
}
5 changes: 5 additions & 0 deletions app/views/catalog/_show_harmful_content_feedback.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<nav class="navbar navbar-expand-lg harmful-content-feedback">
<a class="navbar-brand" href="#">Ask A Question</a>
<a class="navbar-brand" href="#">Suggest A Correction</a>
<a class="navbar-brand" href="#">Report Harmful Language</a>
</nav>
3 changes: 3 additions & 0 deletions app/views/catalog/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
</dd>
</dl>
<% end %>
<% if Flipflop.harmful_content_feedback? %>
<%= render partial: 'show_harmful_content_feedback' %>
<% end %>
</div>
<div id="aside" class="<%= render_document_class %>">
<h2 class="sr-only">Supplementary Information</h2>
Expand Down
4 changes: 4 additions & 0 deletions config/features.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
11 changes: 11 additions & 0 deletions spec/system/catalog_show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit bb596cd

Please sign in to comment.