From 85f56cec6811b781e1d7402c0c1d123d342dc2b8 Mon Sep 17 00:00:00 2001 From: abuoyoyo Date: Tue, 31 May 2022 01:40:40 +0300 Subject: [PATCH] Dismiss button - always on + move to top of panel - js: CollectNotices - do not remove dismiss-button - css: dismiss button --- css/admin_notices.css | 1 + js/notice_manager_panel.js | 4 +--- src/NoticeManager.php | 9 +++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/css/admin_notices.css b/css/admin_notices.css index 20d367b..9977137 100644 --- a/css/admin_notices.css +++ b/css/admin_notices.css @@ -16,6 +16,7 @@ #meta-link-notices-wrap > button.notice-dismiss { position: relative; display: flex; + width: 100%; } .notice_container{ diff --git a/js/notice_manager_panel.js b/js/notice_manager_panel.js index 166f6e9..0a6e498 100644 --- a/js/notice_manager_panel.js +++ b/js/notice_manager_panel.js @@ -131,9 +131,7 @@ var NoticeManager = (function ($, document) { */ collectNotices: () => { notices.appendTo(".notice_container").eq(0); - $(".notice_container").removeClass("empty"); - - if (dismissNoticesButton.length) dismissNoticesButton.detach(); + $(".notice_container").removeClass("empty"); // .empty removes padding /** * When dismissible notices are dismissed, check if any notices are left on page. diff --git a/src/NoticeManager.php b/src/NoticeManager.php index 2a604a5..7a03d0c 100644 --- a/src/NoticeManager.php +++ b/src/NoticeManager.php @@ -69,14 +69,15 @@ class NoticeManager{ /* not JSON-safe - unescaped quotes */ function print_notice_manager_panel(){ + // if auto_collect is ON - we don't need the button. + // if ( empty( $this->options['auto_collect'] ) ) + // We ALWAYS print the button! + echo '
' ; + // NOTE: // button is a copy of is-dismissible button - for styling purposes only // js functionality and listener - js/notice_manager_meta_panel.js echo '
'; - - // if auto_collect is ON - we don't need the button. - if ( empty( $this->options['auto_collect'] ) ) - echo '
' ; } } \ No newline at end of file