From 434e76cf75bae61d76428f37e7b0c1baf5ac0ac9 Mon Sep 17 00:00:00 2001 From: Anna Dabrowska Date: Fri, 13 Feb 2026 17:42:31 +0100 Subject: [PATCH] Extend integration of approve plugin --- css/plugins/approve.less | 35 ++++++++++++++++++++++++++++++++--- css/print.less | 10 ++++++++++ js/plugins/approve.js | 21 +++++++++++++++++++++ main.php | 3 +++ script.js | 1 + tpl/nav-page-attributes.php | 25 +++++++++++++++---------- 6 files changed, 82 insertions(+), 13 deletions(-) create mode 100644 js/plugins/approve.js diff --git a/css/plugins/approve.less b/css/plugins/approve.less index 14c4c22..356c3cd 100644 --- a/css/plugins/approve.less +++ b/css/plugins/approve.less @@ -1,7 +1,36 @@ /** * This file provides styles for approve plugin */ -#plugin__approve { - position: static; - display: inline; + +.page-attributes > li #plugin__approve { + display: none; +} + +@media screen { + #plugin__approve { + display: none; // initial + padding: 2rem 1rem; + clear: both; + } + + span.plugin_approve-icon.plugin__approve_draft { + background-color: #fdb1b1; + &:hover { + background-color: unset; + } + } + + span.plugin_approve-icon.plugin__approve_ready { + background-color: #94bffb; + &:hover { + background-color: unset; + } + } + + span.plugin_approve-icon.plugin__approve_approved { + background-color: #94fb94; + &:hover { + background-color: unset; + } + } } diff --git a/css/print.less b/css/print.less index c5be8a4..7ae1010 100755 --- a/css/print.less +++ b/css/print.less @@ -557,3 +557,13 @@ form { border: 1pt solid @border-dark-print; } } + +/* + * Plugins + */ + +/* * * * approve * * * */ +#plugin__approve { + // we hide the banner with JS, make it visible again in print + display: block !important; +} diff --git a/js/plugins/approve.js b/js/plugins/approve.js new file mode 100644 index 0000000..1a5915f --- /dev/null +++ b/js/plugins/approve.js @@ -0,0 +1,21 @@ +/** + * Approve plugin banner + */ +jQuery(function () { + const $icon = jQuery('span.plugin_approve-icon'); + const $metaBox = jQuery('#spr__meta-box'); + const $banner = jQuery('#plugin__approve'); + const title = $banner.find('strong').text(); + + $icon.addClass($banner.attr('class')); + $icon.attr('title', title); + + // anchor to the sprintdoc meta box + $metaBox.after($banner); + + $icon.click(function (e) { + e.preventDefault(); + $banner.dw_toggle(); + }); + +}); diff --git a/main.php b/main.php index 30bd463..982b703 100755 --- a/main.php +++ b/main.php @@ -15,6 +15,9 @@ if (!defined('DOKU_INC')) die(); /* must be run from with header('X-UA-Compatible: IE=edge,chrome=1'); global $JSINFO; +global $conf; +global $lang; + if (empty($JSINFO['template'])) { $JSINFO['template'] = array(); } diff --git a/script.js b/script.js index a4c34e3..4d23564 100755 --- a/script.js +++ b/script.js @@ -1,3 +1,4 @@ +/* DOKUWIKI:include js/plugins/approve.js */ /* DOKUWIKI:include js/plugins/do_tasks.js */ /* DOKUWIKI:include js/plugins/qc.js */ /* DOKUWIKI:include js/plugins/bookcreator.js */ diff --git a/tpl/nav-page-attributes.php b/tpl/nav-page-attributes.php index 5db8766..b5c90bd 100755 --- a/tpl/nav-page-attributes.php +++ b/tpl/nav-page-attributes.php @@ -12,18 +12,18 @@ $quickSubPlugin = plugin_load('helper', 'quicksubscribe'); /** @var \helper_plugin_approve_tpl $approvePlugin */ $approvePlugin = plugin_load('helper', 'approve_tpl'); -if($doPlugin !== null || $qcPlugin !== null || $starredPlugin !== null) { +if ($doPlugin !== null || $qcPlugin !== null || $starredPlugin !== null || $quickSubPlugin !== null || $approvePlugin !== null) { echo '"; -} - -if($approvePlugin !== null) { +if ($approvePlugin !== null && $approvePlugin->shouldDisplay()) { + echo '
  • '; + echo '' . inlineSVG(DOKU_PLUGIN . 'approve/admin.svg') . ''; + echo '
    '; global $ACT; echo $approvePlugin->banner($ACT); + echo '
    '; + echo '
  • '; +} + +if ($doPlugin !== null || $qcPlugin !== null || $starredPlugin !== null || $quickSubPlugin !== null || $approvePlugin !== null) { + echo ""; }