Skip to content

Commit

Permalink
add button for dismissing post-login stanford restriction message
Browse files Browse the repository at this point in the history
  • Loading branch information
jmartin-sul committed Nov 30, 2023
1 parent 28fff33 commit 3226ba7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
8 changes: 8 additions & 0 deletions app/assets/stylesheets/media.scss
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,14 @@
padding: 0.2rem 0.4rem;
text-transform: uppercase;
}

button.dismissButton {
padding: 0rem;

svg {
font-size: 0.85rem;
}
}
}

.collapse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
</svg>
<p class="loginMessage" data-auth-restriction-target="stanfordRestrictionMessage">Stanford users: log in to access all available features.</p>
<button data-auth-restriction-target="stanfordLoginButton" data-action="media-tag#logIn">Log in</button>
<button class="dismissButton" hidden="true" data-auth-restriction-target="stanfordRestrictionDismissButton" data-action="auth-restriction#dismissStanfordRestriction">
<svg class="MuiSvgIcon-root" focusable="false" aria-hidden="true" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path></svg>
</button>
</div>
</div>
<div data-auth-restriction-target="embargoRestriction" hidden="true">
Expand Down
10 changes: 8 additions & 2 deletions app/javascript/controllers/auth_restriction_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { Controller } from "@hotwired/stimulus"

export default class extends Controller {
static targets = ["stanfordRestriction", "stanfordRestrictionMessage", "stanfordRestrictionNotLoggedInIcon",
"stanfordRestrictionLoggedInIcon", "locationRestriction", "embargoRestriction", "embargoAndStanfordRestriction",
"stanfordLoginButton", "embargoLoginButton"]
"stanfordRestrictionLoggedInIcon", "stanfordRestrictionDismissButton", "stanfordLoginButton",
"locationRestriction", "embargoRestriction", "embargoAndStanfordRestriction",
"embargoLoginButton"]


displayMessage(event) {
Expand All @@ -27,6 +28,11 @@ export default class extends Controller {
this.stanfordRestrictionNotLoggedInIconTarget.style.visibility = "hidden";
this.stanfordRestrictionLoggedInIconTarget.style.visibility = "visible";
this.embargoAndStanfordRestrictionTarget.hidden = true
this.stanfordRestrictionDismissButtonTarget.hidden = false
}

dismissStanfordRestriction() {
this.stanfordRestrictionTarget.hidden = true
}

displayStanfordRestriction(loginService) {
Expand Down

0 comments on commit 3226ba7

Please sign in to comment.