From 2e2c1745c3188c4735cdc73524cb8cd01048e13f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sat, 23 Sep 2023 17:41:17 +0200 Subject: [PATCH] misc: hide remove button when a block has a single line (#73137) --- wcs/qommon/static/css/dc2/admin.scss | 5 +++++ wcs/qommon/static/js/qommon.forms.js | 3 +++ 2 files changed, 8 insertions(+) diff --git a/wcs/qommon/static/css/dc2/admin.scss b/wcs/qommon/static/css/dc2/admin.scss index 045aa0af6..4166fc92c 100644 --- a/wcs/qommon/static/css/dc2/admin.scss +++ b/wcs/qommon/static/css/dc2/admin.scss @@ -2462,6 +2462,11 @@ div.timetable-widget { content: "\f1f8"; // trash } } + &-single { + .remove-button { + visibility: hidden; + } + } } .pk-blocks-zebra { diff --git a/wcs/qommon/static/js/qommon.forms.js b/wcs/qommon/static/js/qommon.forms.js index f1e97f13b..fe412c567 100644 --- a/wcs/qommon/static/js/qommon.forms.js +++ b/wcs/qommon/static/js/qommon.forms.js @@ -728,6 +728,9 @@ $(function() { $('.BlockSubWidget button.remove-button').each(function(i, elem) { if ($(this).parents('.BlockWidget').find('.BlockSubWidget').length == 1) { $(this).prop('disabled', true); + $(this).parents('.BlockWidget').addClass('wcs-block-with-remove-button-single'); + } else { + $(this).parents('.BlockWidget').removeClass('wcs-block-with-remove-button-single'); } }); } -- 2.39.2