Dismiss button - always on + move to top of panel

- js: CollectNotices - do not remove dismiss-button
- css: dismiss button
This commit is contained in:
abuoyoyo 2022-05-31 01:40:40 +03:00
parent 709617d779
commit 85f56cec68
3 changed files with 7 additions and 7 deletions

View File

@ -16,6 +16,7 @@
#meta-link-notices-wrap > button.notice-dismiss {
position: relative;
display: flex;
width: 100%;
}
.notice_container{

View File

@ -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.

View File

@ -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 '<button type="button" class="notice-dismiss"><span class="screen-reader-text">' . __( 'Dismiss' ) . '</span><strong> Dismiss Notices</strong></button><div></div>' ;
// NOTE:
// button is a copy of is-dismissible button - for styling purposes only
// js functionality and listener - js/notice_manager_meta_panel.js
echo '<div class="notice_container empty"></div>';
// if auto_collect is ON - we don't need the button.
if ( empty( $this->options['auto_collect'] ) )
echo '<button type="button" class="notice-dismiss"><span class="screen-reader-text">' . __( 'Dismiss' ) . '</span><strong> Dismiss Notices</strong></button><div></div>' ;
}
}