From 2a2cac217f38383d4459d73e49e1bf69e9264a5c Mon Sep 17 00:00:00 2001 From: Timur Tripp Date: Wed, 26 Jun 2024 11:48:24 -0600 Subject: [PATCH 1/3] CuBoulder/express_admin#17 Fixes node edit sidebar in 10.3 --- css/layout/node-form.css | 8 ++---- express_admin.info.yml | 2 +- js/node-form.js | 13 +++++----- templates/node-edit-form.html.twig | 41 +++++++----------------------- 4 files changed, 18 insertions(+), 46 deletions(-) diff --git a/css/layout/node-form.css b/css/layout/node-form.css index 5aa9c47..f2d7b66 100644 --- a/css/layout/node-form.css +++ b/css/layout/node-form.css @@ -1,13 +1,9 @@ /* Enables hiding the node edit form sidebar. */ -#ucb-edit-container.sidebar-closed { +.ucb-sidebar-closed .layout-form { grid-template-columns: calc(100% - 2em) 2em; } -#ucb-edit-container.sidebar-closed>#ucb-edit-main { - width: auto; -} - -#ucb-edit-container.sidebar-closed>#ucb-edit-sidebar>#ucb-edit-sidebar-content { +.ucb-sidebar-closed #edit-advanced { display: none; } diff --git a/express_admin.info.yml b/express_admin.info.yml index d3ee6bd..ec55d00 100644 --- a/express_admin.info.yml +++ b/express_admin.info.yml @@ -8,5 +8,5 @@ libraries: - express_admin/global-styling libraries-extend: - claro/node-form: + node/form: - express_admin/node-form diff --git a/js/node-form.js b/js/node-form.js index eae4d62..65fb184 100644 --- a/js/node-form.js +++ b/js/node-form.js @@ -1,19 +1,18 @@ (function() { const button = document.querySelector('#ucb-sidebar-toggle-button'); - const mainDiv = document.querySelector('#ucb-edit-container'); + const main = document.querySelector('main'); + + button.addEventListener('click', event => { + event.preventDefault(); - button.addEventListener('click', () => { // check the toggle state of the button const status = button.dataset.status; // if the toggle status is 'open' if (status == 'open') { - mainDiv.classList.add("sidebar-closed"); - mainDiv.classList.remove("sidebar-open"); - + main.classList.add('ucb-sidebar-closed'); } else { - mainDiv.classList.add("sidebar-open"); - mainDiv.classList.remove("sidebar-closed"); + main.classList.remove('ucb-sidebar-closed'); } // and toggle the icon/data attribute diff --git a/templates/node-edit-form.html.twig b/templates/node-edit-form.html.twig index c1107d6..8c628ca 100644 --- a/templates/node-edit-form.html.twig +++ b/templates/node-edit-form.html.twig @@ -1,41 +1,18 @@ {# /** * @file - * Theme override for a node edit form. - * - * Two column template for the node add/edit form. - * - * This template will be used when a node edit form specifies 'node_edit_form' - * as its #theme callback. Otherwise, by default, node add/edit forms will be - * themed by form.html.twig. + * Contains the template for the node edit form. * * Available variables: * - form: The node add/edit form. - * - * @see claro_form_node_form_alter() */ #} -