From 29b0a1f6842ab8d0140e50656b5d8e82f84e66a7 Mon Sep 17 00:00:00 2001 From: Dariusz Szut Date: Mon, 25 Sep 2023 12:12:56 +0200 Subject: [PATCH 1/2] IBX-5854: Unified cookies names --- src/bundle/Resources/public/js/scripts/sidebar/main.menu.js | 6 +++--- .../views/themes/admin/content/location_view.html.twig | 2 +- .../component/adaptive_filters/adaptive_filters.html.twig | 2 +- .../views/themes/admin/ui/menu/main_2nd_level.html.twig | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/bundle/Resources/public/js/scripts/sidebar/main.menu.js b/src/bundle/Resources/public/js/scripts/sidebar/main.menu.js index 9485b85c62..a1e0080fc4 100644 --- a/src/bundle/Resources/public/js/scripts/sidebar/main.menu.js +++ b/src/bundle/Resources/public/js/scripts/sidebar/main.menu.js @@ -57,7 +57,7 @@ } }; const setWidthOfSecondLevelMenu = () => { - const secondLevelMenuWidth = ibexa.helpers.cookies.getCookie('second_menu_width'); + const secondLevelMenuWidth = ibexa.helpers.cookies.getCookie('ibexa_menu-secondary-width'); const isSecondLevelMenuHidden = secondLevelMenuNode.classList.contains('ibexa-main-menu__navbar--hidden'); if (!secondLevelMenuWidth || isSecondLevelMenuHidden) { @@ -81,7 +81,7 @@ const isSecondLevelMenuCollapsed = secondLevelMenuNode.classList.contains('ibexa-main-menu__navbar--collapsed'); const newMenuWidth = isSecondLevelMenuCollapsed ? SECOND_LEVEL_EXPANDED_WIDTH : SECOND_LEVEL_COLLAPSED_WIDTH; - ibexa.helpers.cookies.setBackOfficeCookie('second_menu_width', newMenuWidth); + ibexa.helpers.cookies.setBackOfficeCookie('ibexa_menu-secondary-width', newMenuWidth); setWidthOfSecondLevelMenu(); }; const parsePopup = (button) => { @@ -131,7 +131,7 @@ const resizeValue = secondMenuLevelCurrentWidth + (clientX - resizeStartPositionX); const newMenuWidth = resizeValue > SECOND_LEVEL_MANUAL_RESIZE_MIN_WIDTH ? resizeValue : SECOND_LEVEL_COLLAPSED_WIDTH; - ibexa.helpers.cookies.setBackOfficeCookie('second_menu_width', newMenuWidth); + ibexa.helpers.cookies.setBackOfficeCookie('ibexa_menu-secondary-width', newMenuWidth); setWidthOfSecondLevelMenu(); }; diff --git a/src/bundle/Resources/views/themes/admin/content/location_view.html.twig b/src/bundle/Resources/views/themes/admin/content/location_view.html.twig index 4b94ace7d5..ce82ce10a2 100644 --- a/src/bundle/Resources/views/themes/admin/content/location_view.html.twig +++ b/src/bundle/Resources/views/themes/admin/content/location_view.html.twig @@ -16,7 +16,7 @@ {% block body_class %}ibexa-content-view{% endblock %} {% block content_tree %} - {% set container_width_cookie = 'ibexa-tb-ibexa-content-tree-%d-container-width'|format(ibexa_admin_ui_config.user.user.id) %} + {% set container_width_cookie = 'ibexa-tb_ibexa-content-tree_%d_container-width'|format(ibexa_admin_ui_config.user.user.id) %} {% set content_tree_width = app.request.cookies.get(container_width_cookie) %} {% set content_tree_width_style = 'width: %dpx;'|format(content_tree_width) %} diff --git a/src/bundle/Resources/views/themes/admin/ui/component/adaptive_filters/adaptive_filters.html.twig b/src/bundle/Resources/views/themes/admin/ui/component/adaptive_filters/adaptive_filters.html.twig index aab8dda3de..0754324193 100644 --- a/src/bundle/Resources/views/themes/admin/ui/component/adaptive_filters/adaptive_filters.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/component/adaptive_filters/adaptive_filters.html.twig @@ -3,7 +3,7 @@ {% trans_default_domain 'adaptive_filters' %} {% if filters_id is defined %} - {% set expanded_info_cookie_name = 'ibexa_adaptive_filters-is_expanded-' ~ filters_id %} + {% set expanded_info_cookie_name = 'ibexa-af_is-expanded_' ~ filters_id|replace({'_': '-'}) %} {% endif %} {% set is_expanded_cookie = expanded_info_cookie_name is defined and app.request.cookies.get(expanded_info_cookie_name) == 'true' %} diff --git a/src/bundle/Resources/views/themes/admin/ui/menu/main_2nd_level.html.twig b/src/bundle/Resources/views/themes/admin/ui/menu/main_2nd_level.html.twig index 549ad8a540..e681ef5d0f 100644 --- a/src/bundle/Resources/views/themes/admin/ui/menu/main_2nd_level.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/menu/main_2nd_level.html.twig @@ -3,7 +3,7 @@ {% block root %} {% set resizer_width = 10 %} {% set second_level_manual_resize_min_width = 80 %} - {% set second_level_menu_width = app.request.cookies.get('second_menu_width') %} + {% set second_level_menu_width = app.request.cookies.get('ibexa_menu-secondary-width') %} {% set second_menu_width_style = '' %} {% set second_menu_list_width_style = '' %} {% set extra_class = 'ibexa-main-menu__navbar--hidden' %} From a3c78b60890027e82978d7f6abd05ad0a499f473 Mon Sep 17 00:00:00 2001 From: Dariusz Szut Date: Thu, 28 Sep 2023 13:26:02 +0200 Subject: [PATCH 2/2] fix QA --- src/bundle/Resources/public/js/scripts/sidebar/main.menu.js | 6 +++--- .../views/themes/admin/ui/menu/main_2nd_level.html.twig | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bundle/Resources/public/js/scripts/sidebar/main.menu.js b/src/bundle/Resources/public/js/scripts/sidebar/main.menu.js index a1e0080fc4..08e226a5aa 100644 --- a/src/bundle/Resources/public/js/scripts/sidebar/main.menu.js +++ b/src/bundle/Resources/public/js/scripts/sidebar/main.menu.js @@ -57,7 +57,7 @@ } }; const setWidthOfSecondLevelMenu = () => { - const secondLevelMenuWidth = ibexa.helpers.cookies.getCookie('ibexa_menu-secondary-width'); + const secondLevelMenuWidth = ibexa.helpers.cookies.getCookie('ibexa-aui_menu-secondary-width'); const isSecondLevelMenuHidden = secondLevelMenuNode.classList.contains('ibexa-main-menu__navbar--hidden'); if (!secondLevelMenuWidth || isSecondLevelMenuHidden) { @@ -81,7 +81,7 @@ const isSecondLevelMenuCollapsed = secondLevelMenuNode.classList.contains('ibexa-main-menu__navbar--collapsed'); const newMenuWidth = isSecondLevelMenuCollapsed ? SECOND_LEVEL_EXPANDED_WIDTH : SECOND_LEVEL_COLLAPSED_WIDTH; - ibexa.helpers.cookies.setBackOfficeCookie('ibexa_menu-secondary-width', newMenuWidth); + ibexa.helpers.cookies.setBackOfficeCookie('ibexa-aui_menu-secondary-width', newMenuWidth); setWidthOfSecondLevelMenu(); }; const parsePopup = (button) => { @@ -131,7 +131,7 @@ const resizeValue = secondMenuLevelCurrentWidth + (clientX - resizeStartPositionX); const newMenuWidth = resizeValue > SECOND_LEVEL_MANUAL_RESIZE_MIN_WIDTH ? resizeValue : SECOND_LEVEL_COLLAPSED_WIDTH; - ibexa.helpers.cookies.setBackOfficeCookie('ibexa_menu-secondary-width', newMenuWidth); + ibexa.helpers.cookies.setBackOfficeCookie('ibexa-aui_menu-secondary-width', newMenuWidth); setWidthOfSecondLevelMenu(); }; diff --git a/src/bundle/Resources/views/themes/admin/ui/menu/main_2nd_level.html.twig b/src/bundle/Resources/views/themes/admin/ui/menu/main_2nd_level.html.twig index e681ef5d0f..2f5571ae02 100644 --- a/src/bundle/Resources/views/themes/admin/ui/menu/main_2nd_level.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/menu/main_2nd_level.html.twig @@ -3,7 +3,7 @@ {% block root %} {% set resizer_width = 10 %} {% set second_level_manual_resize_min_width = 80 %} - {% set second_level_menu_width = app.request.cookies.get('ibexa_menu-secondary-width') %} + {% set second_level_menu_width = app.request.cookies.get('ibexa-aui_menu-secondary-width') %} {% set second_menu_width_style = '' %} {% set second_menu_list_width_style = '' %} {% set extra_class = 'ibexa-main-menu__navbar--hidden' %}