Skip to content

Commit

Permalink
[WIP] 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 29, 2023
1 parent b6709d9 commit e70fbf6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
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 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="M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"></path></svg>
</button>
</div>
</div>
<div data-auth-restriction-target="embargoRestriction" hidden="true">
Expand Down
10 changes: 8 additions & 2 deletions app/javascript/src/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 e70fbf6

Please sign in to comment.