From da90913149e08c0f5a2627ebe9224e5e54bdc8ef Mon Sep 17 00:00:00 2001 From: Justin Coyne Date: Mon, 6 Nov 2023 12:59:04 -0600 Subject: [PATCH 1/2] Display the embargo_date in the message to the user Ref #1615 --- app/javascript/src/controllers/media_tag_controller.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/javascript/src/controllers/media_tag_controller.js b/app/javascript/src/controllers/media_tag_controller.js index f96611f88..92f8ab38c 100644 --- a/app/javascript/src/controllers/media_tag_controller.js +++ b/app/javascript/src/controllers/media_tag_controller.js @@ -36,7 +36,7 @@ export default class extends Controller { } else if (status.includes('location_restricted')) { this.displayLocationRestriction(result.authResponse.service) } else if (status.includes('embargoed')) { - this.displayEmbargoRestriction(result.authResponse.service) + this.displayEmbargoRestriction(result.authResponse.embargo) } else if (status === 'success') { // If the item is restricted and the user has access, then remove the login banner. if (result.mediaContext.isRestricted) @@ -72,7 +72,10 @@ export default class extends Controller { this.locationRestrictionTarget.hidden = false } - displayEmbargoRestriction(_loginService) { + displayEmbargoRestriction(embargo) { + const releaseDate = new Date(embargo.release_date) + const date = new Intl.DateTimeFormat().format(date) + this.embargoRestrictionTarget.querySelector('.loginMessage').innerText = `Access is restricted until ${date}` this.embargoRestrictionTarget.hidden = false } From 94748daf5e747fdcb7608249656c5adb9fc41127 Mon Sep 17 00:00:00 2001 From: Justin Coyne Date: Mon, 6 Nov 2023 13:13:32 -0600 Subject: [PATCH 2/2] Add support for stanford-only + embargo --- ..._with_companion_windows_component.html.erb | 19 ++++++---- .../src/controllers/media_tag_controller.js | 35 +++++++++++++------ 2 files changed, 38 insertions(+), 16 deletions(-) diff --git a/app/components/embed/media_with_companion_windows_component.html.erb b/app/components/embed/media_with_companion_windows_component.html.erb index cf00fcbf2..3fed4fa46 100644 --- a/app/components/embed/media_with_companion_windows_component.html.erb +++ b/app/components/embed/media_with_companion_windows_component.html.erb @@ -16,23 +16,30 @@ +