Skip to content

Commit

Permalink
Merge pull request #1335 from MITLibraries/pw102-nps-banner
Browse files Browse the repository at this point in the history
Adds panel for NPS surveys
  • Loading branch information
JPrevost authored Sep 13, 2024
2 parents fcb079f + 42b63b1 commit 29fd71f
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ to construct thumbnail URLs.
- `TACOS_URL`: The GraphQL endpoint for the [TACOS](https://github.com/mitlibraries/tacos/) application.
- `TIMDEX_TIMEOUT`: value to override the 6 second default for TIMDEX timeout.

### NPS Survey Environment Variables (optional)

- `NPS_BLURB`: Text to display before the survey link. Survey link will still display if not provided.
- `NPS_LINK_TEXT`: Survey link text. If not present, survey does not display.
- `NPS_URL`: Survey link URL. If not present, survey does not display.

## Confirming functionality after updating dependencies

This application has good code coverage, so most issues are detected by just running tests normally:
Expand Down
23 changes: 23 additions & 0 deletions app/assets/stylesheets/_survey.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.nps-feedback {
margin-top: 1em;
padding: 20px 10px;
background-color: $gray-d1;
color: $white;
text-align: center;
font-size: $fs-large;
display: block;

a {
color: $blue-bright;
&:hover {
color: $green;
}
&:active {
color: $magenta;
}
}

@media (max-width: $bp-screen-md) {
font-size: $fs-base;
}
}
1 change: 1 addition & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
@import "_search";
@import "_results";
@import "_hint";
@import "_survey";
@import "_print";
7 changes: 7 additions & 0 deletions app/views/search/_nps_feedback.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<% return unless ENV.fetch('NPS_URL', false).present? %>
<% return unless ENV.fetch('NPS_LINK_TEXT', false).present? %>

<div class="nps-feedback">
<span class="nps-blurb"><%= ENV.fetch('NPS_BLURB', nil) %></span>
<a class="nps-link" href="<%= ENV.fetch('NPS_URL')%>"><%= ENV.fetch('NPS_LINK_TEXT') %></a>
</div>
2 changes: 2 additions & 0 deletions app/views/search/bento.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
<p>Not finding what you need? <%= link_to('Ask us', 'https://libraries.mit.edu/ask/') %></p>
</div>

<%= render partial: "nps_feedback" if ENV.fetch('NPS_URL', false).present? %>

<div id="hint"></div>

<div class="gridband layout-2c">
Expand Down

0 comments on commit 29fd71f

Please sign in to comment.