From 10333ccd985301313cc033e3044526a47badf058 Mon Sep 17 00:00:00 2001 From: Johnathan Martin Date: Wed, 29 Nov 2023 23:15:04 -0800 Subject: [PATCH] make auth-restriction div / media-component-body div space sharing more consistent * start with the auth-restriction div hidden when the DOM is initially rendered * un-hide it in the methods that do other DOM manipulation to display auth restriction messages conditionally based on authResponse * hide it if the auth-restriction message is dismissed * simplify the CSS selector for media-component-body sizing, since now it only has to care about whether auth-restriction div is hidden or not * rename a method for accuracy, take advantage of a possible simplification (stimulus auth_restriction_controller.dismissStanfordRestriction becomes .hideLoginPrompt) otherwise, i found that the old CSS was sometimes subtracting from max-height for media-component-body when it should've been left full height, presumably some things in the more complex selector weren't hidden as expected. --- app/assets/stylesheets/media.scss | 3 +-- .../media_with_companion_windows_component.html.erb | 4 ++-- .../controllers/auth_restriction_controller.js | 10 +++++++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/assets/stylesheets/media.scss b/app/assets/stylesheets/media.scss index 8ce96d52f..3071bb084 100644 --- a/app/assets/stylesheets/media.scss +++ b/app/assets/stylesheets/media.scss @@ -275,8 +275,7 @@ flex-shrink: 0; } - // First selector is for embargo. Last selector is other auth restrictions - .authLinkWrapper + .media-component-body, [data-controller="auth-restriction"]:has(.authLinkWrapper:not([hidden])) + .media-component-body { + [data-controller="auth-restriction"]:not([hidden]) + .media-component-body { max-height: calc(100vh - 100px); // Scroll height for metadata when the auth wrapper is displaying } 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 cde4438b4..349ba3145 100644 --- a/app/components/embed/media_with_companion_windows_component.html.erb +++ b/app/components/embed/media_with_companion_windows_component.html.erb @@ -14,7 +14,7 @@ -
+