integrate QC plugin (ajax branch)
This refactors the page-attribute area a bit and intergrates the new ajax branch of the QC plugin. I'm not really happy about the included file - it should probably be moved to our Template class instead.
This commit is contained in:
parent
994d0e8dee
commit
fbf9e9d682
10 changed files with 200 additions and 244 deletions
|
@ -67,145 +67,6 @@
|
|||
padding: .1em .1em 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* + + + + + icon list + + + + + */
|
||||
.page-attributes {
|
||||
list-style: none;
|
||||
float: right;
|
||||
display: inline-block;
|
||||
max-width: 30%;
|
||||
margin: -.45em 0 0;
|
||||
padding: 0;
|
||||
@media @screen_max-xs{
|
||||
max-width: 90%;
|
||||
}
|
||||
|
||||
> li {
|
||||
.btn-usertools-wrapper(); // uniform li
|
||||
.btn-usertools-num();
|
||||
|
||||
float: left;
|
||||
|
||||
> strong,
|
||||
> a {
|
||||
display: block;
|
||||
width: auto;
|
||||
min-height: 2em;
|
||||
border: 1px solid @color-border;
|
||||
border-radius: @border-radius;
|
||||
color: @color-nav;
|
||||
text-align: center;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.prefix {
|
||||
.btn-prefix ();
|
||||
.icon-clipboard();
|
||||
}
|
||||
|
||||
/* check !!! */
|
||||
&.do_none {
|
||||
position: relative;
|
||||
|
||||
strong {
|
||||
background-color: @color-site-bg;
|
||||
}
|
||||
|
||||
.num {
|
||||
background-color: @color-border;
|
||||
color: @color-nav;
|
||||
}
|
||||
}
|
||||
/* end check !!! */
|
||||
|
||||
&.plugin__qc {
|
||||
display: inline-block;
|
||||
overflow: visible;
|
||||
position: static;
|
||||
}
|
||||
} // li
|
||||
|
||||
a {
|
||||
transition: @transition color, @transition background-color, @transition border-color;
|
||||
|
||||
&[aria-expanded="false"] + #plugin__qc__wrapper {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&:hover,
|
||||
&:active,
|
||||
&:focus {
|
||||
background-color: @button_color;
|
||||
border-color: @button_background;
|
||||
color: @button_background;
|
||||
|
||||
.prefix {
|
||||
color: @button_background;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#plugin__qc__wrapper {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
width: auto;
|
||||
border: 0 none;
|
||||
background: @background_page-header;
|
||||
background: -webkit-linear-gradient(top, @background_page-header, @color-content-bg);
|
||||
background: linear-gradient(top, @background_page-header, @color-content-bg);
|
||||
box-shadow: @box-shadow-bottom;
|
||||
z-index: 2000;
|
||||
|
||||
#plugin__qc__out{
|
||||
h1 {
|
||||
font-size: @font-size-head3;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin-top: 1.6em;
|
||||
font-size: @font-size-head5;
|
||||
}
|
||||
> h1,
|
||||
> h2,
|
||||
> p,
|
||||
> dl,
|
||||
> div {
|
||||
padding-left: 1rem;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
> div p {
|
||||
padding-left: 0;
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&[aria-hidden="false"] {
|
||||
margin-top: .5rem;
|
||||
}
|
||||
}
|
||||
|
||||
#plugin__qc__icon {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#plugin__qc__link {
|
||||
position: relative;
|
||||
|
||||
.prefix {
|
||||
.icon-emo-happy();
|
||||
|
||||
width: 100%;
|
||||
font-size: @font-size-default;
|
||||
|
||||
&::before {
|
||||
width: 100%;
|
||||
margin: .1em 0 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
30
css/area_nav-page-attributes.less
Normal file
30
css/area_nav-page-attributes.less
Normal file
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
* Page Attribute Icons in the breadcrumb bar
|
||||
*/
|
||||
.page-attributes {
|
||||
list-style: none;
|
||||
float: right;
|
||||
display: inline-block;
|
||||
max-width: 30%;
|
||||
margin: -.45em 0 0;
|
||||
padding: 0;
|
||||
@media @screen_max-xs {
|
||||
max-width: 90%;
|
||||
}
|
||||
|
||||
> li {
|
||||
.btn-usertools-wrapper(); // uniform li
|
||||
.btn-usertools-num();
|
||||
|
||||
position: relative;
|
||||
float: left;
|
||||
display: block;
|
||||
width: auto;
|
||||
min-height: 2em;
|
||||
border: 1px solid @color-border;
|
||||
border-radius: @border-radius;
|
||||
color: @color-nav;
|
||||
text-align: center;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,26 @@
|
|||
#plugin__qc__wrapper{
|
||||
font-size: @font-size-default;
|
||||
p{
|
||||
font-size: @font-size-default;
|
||||
/**
|
||||
* Styles for the QC plugin
|
||||
*/
|
||||
|
||||
// icon in page attributes
|
||||
.page-attributes .plugin_qc {
|
||||
.qc_icon {
|
||||
margin: 0;
|
||||
width: 2em;
|
||||
height: 2em;
|
||||
|
||||
svg {
|
||||
margin-top: 0.1em;
|
||||
margin-left: 0.1em;
|
||||
width: 1.6em;
|
||||
height: 1.6em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// output
|
||||
.qc-output {
|
||||
font-size: 90%;
|
||||
border-bottom: 1px solid @ini_border;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,47 +1,49 @@
|
|||
( function( $, spc ) {
|
||||
|
||||
var togglePageAnalysis = function(){
|
||||
var $this = $('.page-attributes').find('.plugin__qc');
|
||||
try{
|
||||
var $link = $this.find('#plugin__qc__link'),
|
||||
$container = $this.find('#plugin__qc__wrapper');
|
||||
|
||||
if($container.length < 1){
|
||||
$this.remove();
|
||||
}else{
|
||||
$container.attr('aria-hidden','true');
|
||||
var $icon = $container.find('#plugin__qc__icon');
|
||||
$container.find('#plugin__qc__out').removeAttr('style');
|
||||
$link.on( 'click', function(e){
|
||||
e.preventDefault();
|
||||
$icon.trigger('click');
|
||||
var oldState = ($link.attr('aria-expanded')=== "true" );
|
||||
$container.attr('aria-hidden',oldState);
|
||||
$(this).attr('aria-expanded',!oldState);
|
||||
|
||||
});
|
||||
|
||||
if($container.length > 0){
|
||||
var num = $container.attr('data-errors');
|
||||
if(num){
|
||||
$link.find('.num').empty().append(num);
|
||||
$link.closest('li').removeClass('do_none');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}catch(err){
|
||||
$this.remove();
|
||||
}
|
||||
};
|
||||
|
||||
$(function(){
|
||||
togglePageAnalysis();
|
||||
});
|
||||
|
||||
} )( jQuery, spc );
|
||||
|
||||
|
||||
|
||||
// FIXME figure out what this did and why
|
||||
|
||||
// ( function( $, spc ) {
|
||||
//
|
||||
// var togglePageAnalysis = function(){
|
||||
// var $this = $('.page-attributes').find('.plugin__qc');
|
||||
// try{
|
||||
// var $link = $this.find('#plugin__qc__link'),
|
||||
// $container = $this.find('#plugin__qc__wrapper');
|
||||
//
|
||||
// if($container.length < 1){
|
||||
// $this.remove();
|
||||
// }else{
|
||||
// $container.attr('aria-hidden','true');
|
||||
// var $icon = $container.find('#plugin__qc__icon');
|
||||
// $container.find('#plugin__qc__out').removeAttr('style');
|
||||
// $link.on( 'click', function(e){
|
||||
// e.preventDefault();
|
||||
// $icon.trigger('click');
|
||||
// var oldState = ($link.attr('aria-expanded')=== "true" );
|
||||
// $container.attr('aria-hidden',oldState);
|
||||
// $(this).attr('aria-expanded',!oldState);
|
||||
//
|
||||
// });
|
||||
//
|
||||
// if($container.length > 0){
|
||||
// var num = $container.attr('data-errors');
|
||||
// if(num){
|
||||
// $link.find('.num').empty().append(num);
|
||||
// $link.closest('li').removeClass('do_none');
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }catch(err){
|
||||
// $this.remove();
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// $(function(){
|
||||
// togglePageAnalysis();
|
||||
// });
|
||||
//
|
||||
// } )( jQuery, spc );
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
|
|
37
js/plugins/qc.js
Normal file
37
js/plugins/qc.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* Add custom QC functionality instead of using the plugin's mechanism
|
||||
*/
|
||||
jQuery(function () {
|
||||
var $panel = jQuery('div.qc-output').hide();
|
||||
|
||||
// load summary
|
||||
jQuery('.page-attributes .plugin_qc a').load(
|
||||
DOKU_BASE + '/lib/exe/ajax.php',
|
||||
{
|
||||
call: 'plugin_qc_short',
|
||||
id: JSINFO['id']
|
||||
},
|
||||
function () {
|
||||
jQuery(this).find('span span').addClass('num');
|
||||
}
|
||||
).click(function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
if ($panel.html() == '') {
|
||||
// load output
|
||||
$panel.load(
|
||||
DOKU_BASE + '/lib/exe/ajax.php',
|
||||
{
|
||||
call: 'plugin_qc_long',
|
||||
id: JSINFO['id']
|
||||
},
|
||||
function () {
|
||||
$panel.dw_show();
|
||||
}
|
||||
);
|
||||
} else {
|
||||
$panel.dw_toggle();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
3
main.php
3
main.php
|
@ -230,7 +230,7 @@ $classWideContent = ($ACT === "show") ? "": "wide-content ";
|
|||
/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
|
||||
/* page quality / page tasks */
|
||||
/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
|
||||
include('tpl/nav-page-quality-tasks.php');
|
||||
include('tpl/nav-page-attributes.php');
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
@ -266,6 +266,7 @@ $classWideContent = ($ACT === "show") ? "": "wide-content ";
|
|||
include('tpl/nav-meta-box.php'); ?>
|
||||
</div>
|
||||
|
||||
<div class="qc-output"></div>
|
||||
|
||||
<div class="msg-area"><?php html_msgarea();/*msg('Information.', 0);msg('Success', 1);msg('Notification', 2);msg('Fehler', -1);*/ ?></div>
|
||||
<?php
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
/* DOKUWIKI:include js/base/spc.js */
|
||||
|
||||
/* DOKUWIKI:include js/plugins/do_tasks.js */
|
||||
/* DOKUWIKI:include js/plugins/qc.js */
|
||||
|
||||
/* DOKUWIKI:include js/meta-box.js */
|
||||
/* DOKUWIKI:include js/sidebar.js */
|
||||
|
|
|
@ -67,6 +67,7 @@ css/area_footer.less = all
|
|||
css/area_msg.less = all
|
||||
css/area_nav-direct.less = all
|
||||
css/area_nav-breadcrumb.less = all
|
||||
css/area_nav-page-attributes.less = all
|
||||
css/area_nav-usertools.less = all
|
||||
css/area_sidebar-search.less = all
|
||||
css/area_nav-pagetools.less = all
|
||||
|
|
57
tpl/nav-page-attributes.php
Executable file
57
tpl/nav-page-attributes.php
Executable file
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
if(!defined('DOKU_INC')) die();
|
||||
|
||||
/** @var \helper_plugin_do $doPlugin */
|
||||
$doPlugin = plugin_load('helper', 'do');
|
||||
/** @var \helper_plugin_qc $qcPlugin */
|
||||
$qcPlugin = plugin_load('helper', 'qc');
|
||||
|
||||
|
||||
if($doPlugin !== null || $qcPlugin !== null) {
|
||||
echo '<ul class="page-attributes">';
|
||||
}
|
||||
|
||||
|
||||
if($qcPlugin && $qcPlugin->shouldShow()) {
|
||||
echo '<li class="plugin_qc"><a href="#">…</a></li>'; // filled by javascript
|
||||
}
|
||||
|
||||
|
||||
if($doPlugin !== null) {
|
||||
$count = $doPlugin->getPageTaskCount();
|
||||
$num = $count['count'];
|
||||
$title = "";
|
||||
|
||||
if($num == 0) { // no tasks - does not exist do in plug-in
|
||||
$class = "do_none";
|
||||
$title = tpl_getLang('tasks_page_none');
|
||||
} elseif($count['undone'] == 0) { // all tasks done
|
||||
$class = 'do_done';
|
||||
$title = $this->getLang('title_alldone');
|
||||
} elseif($count['late'] == 0) { // open tasks but none late
|
||||
$class = 'do_undone';
|
||||
$title = sprintf($this->getLang('title_intime'), $count['undone']);
|
||||
} else { // late tasks
|
||||
$class = 'do_late';
|
||||
$title = sprintf($this->getLang('title_late'), $count['undone'], $count['late']);
|
||||
}
|
||||
$markup = "<li class=\"plugin__do_pagetasks " . $class . "\" title=\"'.$title.'\"><strong><span class=\"prefix\">" . tpl_getLang('prefix_tasks_page') . " </span><span class=\"num\">" . $num . "</span></strong></li>";
|
||||
|
||||
echo $markup;
|
||||
}
|
||||
|
||||
if($doPlugin !== null || $qcPlugin !== null) {
|
||||
echo "</ul>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
|
||||
$out = '<div class="plugin__do_pagetasks" title="' . $title . '"><span class="' . $class . '">';
|
||||
$out .= $count['undone'];
|
||||
$out .= '</span></div>';
|
||||
|
||||
if($return) return $out;
|
||||
echo $out;*/
|
|
@ -1,54 +0,0 @@
|
|||
<?php
|
||||
if (!defined('DOKU_INC')) die();
|
||||
?>
|
||||
|
||||
<?php
|
||||
/** @var \helper_plugin_do $doPlugin */
|
||||
$doPlugin = plugin_load('helper','do');
|
||||
|
||||
/** @var \helper_plugin_qc $qc */
|
||||
$qc = plugin_load('helper','qc');
|
||||
if ($doPlugin !== null ||$qc ) {
|
||||
echo "<ul class=\"page-attributes\">";
|
||||
}
|
||||
if ($qc) {
|
||||
echo "<li class=\"plugin__qc do_none\"><a id=\"plugin__qc__link\" aria-expanded=\"false\" href=\"#plugin__qc__wrapper\"><span class=\"prefix\">".tpl_getLang('quality_trigger')."</span><span class=\"num\">0</span></strong></a>";
|
||||
$qc->tplErrorCount();
|
||||
echo "</li>";
|
||||
}
|
||||
if ($doPlugin !== null ) {
|
||||
$count = $doPlugin->getPageTaskCount();
|
||||
$num = $count['count'];
|
||||
$title = "";
|
||||
|
||||
if($num == 0){ // no tasks - does not exist do in plug-in
|
||||
$class = "do_none";
|
||||
$title = tpl_getLang('tasks_page_none');
|
||||
} elseif($count['undone'] == 0){ // all tasks done
|
||||
$class = 'do_done';
|
||||
$title = $this->getLang('title_alldone');
|
||||
}elseif($count['late'] == 0) { // open tasks but none late
|
||||
$class = 'do_undone';
|
||||
$title = sprintf($this->getLang('title_intime'), $count['undone']);
|
||||
} else { // late tasks
|
||||
$class = 'do_late';
|
||||
$title = sprintf($this->getLang('title_late'), $count['undone'], $count['late']);
|
||||
}
|
||||
$markup = "<li class=\"plugin__do_pagetasks ".$class."\" title=\"'.$title.'\"><strong><span class=\"prefix\">".tpl_getLang('prefix_tasks_page')." </span><span class=\"num\">".$num."</span></strong></li>";
|
||||
|
||||
echo $markup;
|
||||
}
|
||||
|
||||
if ($doPlugin !== null ||$qc ) {
|
||||
echo "</ul>";
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
|
||||
$out = '<div class="plugin__do_pagetasks" title="' . $title . '"><span class="' . $class . '">';
|
||||
$out .= $count['undone'];
|
||||
$out .= '</span></div>';
|
||||
|
||||
if($return) return $out;
|
||||
echo $out;*/
|
Loading…
Add table
Add a link
Reference in a new issue