Extend integration of approve plugin

This commit is contained in:
Anna Dabrowska 2026-02-13 17:42:31 +01:00
parent 40641dd6f0
commit 434e76cf75
6 changed files with 82 additions and 13 deletions

View file

@ -1,7 +1,36 @@
/** /**
* This file provides styles for approve plugin * This file provides styles for approve plugin
*/ */
#plugin__approve {
position: static; .page-attributes > li #plugin__approve {
display: inline; 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;
}
}
} }

View file

@ -557,3 +557,13 @@ form {
border: 1pt solid @border-dark-print; 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;
}

21
js/plugins/approve.js Normal file
View file

@ -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();
});
});

View file

@ -15,6 +15,9 @@ if (!defined('DOKU_INC')) die(); /* must be run from with
header('X-UA-Compatible: IE=edge,chrome=1'); header('X-UA-Compatible: IE=edge,chrome=1');
global $JSINFO; global $JSINFO;
global $conf;
global $lang;
if (empty($JSINFO['template'])) { if (empty($JSINFO['template'])) {
$JSINFO['template'] = array(); $JSINFO['template'] = array();
} }

View file

@ -1,3 +1,4 @@
/* DOKUWIKI:include js/plugins/approve.js */
/* DOKUWIKI:include js/plugins/do_tasks.js */ /* DOKUWIKI:include js/plugins/do_tasks.js */
/* DOKUWIKI:include js/plugins/qc.js */ /* DOKUWIKI:include js/plugins/qc.js */
/* DOKUWIKI:include js/plugins/bookcreator.js */ /* DOKUWIKI:include js/plugins/bookcreator.js */

View file

@ -12,18 +12,18 @@ $quickSubPlugin = plugin_load('helper', 'quicksubscribe');
/** @var \helper_plugin_approve_tpl $approvePlugin */ /** @var \helper_plugin_approve_tpl $approvePlugin */
$approvePlugin = plugin_load('helper', 'approve_tpl'); $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 '<ul class="page-attributes">'; echo '<ul class="page-attributes">';
} }
if($qcPlugin && $qcPlugin->shouldShow()) { if ($qcPlugin && $qcPlugin->shouldShow()) {
$qcPrefix = tpl_getLang('quality_trigger'); $qcPrefix = tpl_getLang('quality_trigger');
echo '<li class="plugin_qc"><strong class="sr-out">'.$qcPrefix.':</strong><a href="#"></a></li>'; // filled by javascript echo '<li class="plugin_qc"><strong class="sr-out">'.$qcPrefix.':</strong><a href="#"></a></li>'; // filled by javascript
} }
if($doPlugin !== null) { if ($doPlugin !== null) {
$count = $doPlugin->getPageTaskCount(); $count = $doPlugin->getPageTaskCount();
$num = $count['count']; $num = $count['count'];
$title = ""; $title = "";
@ -50,23 +50,28 @@ if($doPlugin !== null) {
echo '</li>'; echo '</li>';
} }
if($starredPlugin !== null) { if ($starredPlugin !== null) {
echo '<li class="plugin_starred">'; echo '<li class="plugin_starred">';
$starredPlugin->tpl_starred(); $starredPlugin->tpl_starred();
echo '</li>'; echo '</li>';
} }
if($quickSubPlugin !== null) { if ($quickSubPlugin !== null) {
echo '<li class="plugin_quicksubscribe">'; echo '<li class="plugin_quicksubscribe">';
echo $quickSubPlugin->tpl_subscribe(); echo $quickSubPlugin->tpl_subscribe();
echo '</li>'; echo '</li>';
} }
if($doPlugin !== null || $qcPlugin !== null || $starredPlugin !== null) { if ($approvePlugin !== null && $approvePlugin->shouldDisplay()) {
echo "</ul>"; echo '<li class="plugin_approve">';
} echo '<span class="plugin_approve-icon">' . inlineSVG(DOKU_PLUGIN . 'approve/admin.svg') . '</span>';
echo '<div class="plugin_approve-banner-content">';
if($approvePlugin !== null) {
global $ACT; global $ACT;
echo $approvePlugin->banner($ACT); echo $approvePlugin->banner($ACT);
echo '</div>';
echo '</li>';
}
if ($doPlugin !== null || $qcPlugin !== null || $starredPlugin !== null || $quickSubPlugin !== null || $approvePlugin !== null) {
echo "</ul>";
} }