Skip to content

Commit

Permalink
Added option to disable Page Tools animation (pageToolsAnimation: on)…
Browse files Browse the repository at this point in the history
… and added Edit button on navbar (showEditBtn: never).

Thanks to @Juergen-aus-Koeln on #150 and @NoriSilverrage on #63.
  • Loading branch information
giterlizzi committed Oct 11, 2016
1 parent b19c0a4 commit 11c85a5
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 16 deletions.
2 changes: 2 additions & 0 deletions conf/default.php
Expand Up @@ -17,6 +17,7 @@
$conf['cookieLawPolicyPage'] = 'cookie:policy';
$conf['customTheme'] = '';
$conf['discussionPage'] = 'discussion:@ID@';
$conf['showEditBtn'] = 'never';
$conf['fixedTopNavbar'] = 0;
$conf['fluidContainer'] = 0;
$conf['fluidContainerBtn'] = 0;
Expand All @@ -37,6 +38,7 @@
$conf['pageInfo'] = 'filename,extension,date,editor,locked';
$conf['pageInfoDateFormat'] = 'dformat';
$conf['pageOnPanel'] = 1;
$conf['pageToolsAnimation'] = 1;
$conf['rightSidebar'] = 'rightsidebar';
$conf['rightSidebarGrid'] = 'col-sm-3 col-md-2';
$conf['schemaOrgType'] = 'Article';
Expand Down
2 changes: 2 additions & 0 deletions conf/metadata.php
Expand Up @@ -31,6 +31,7 @@
$meta['showHomePageLink'] = array('onoff');
$meta['showUserHomeLink'] = array('onoff');
$meta['hideLoginLink'] = array('onoff');
$meta['showEditBtn'] = array('multichoice', '_choices' => array('never', 'logged', 'always'));
$meta['individualTools'] = array('onoff');
$meta['showIndividualTool'] = array('multicheckbox', '_choices' => array('user', 'site', 'page'));
$meta['showSearchForm'] = array('multichoice', '_choices' => array('never', 'logged', 'always'));
Expand All @@ -53,6 +54,7 @@
$meta['showLandingPage'] = array('onoff');
$meta['landingPages'] = array('regex');
$meta['showPageTools'] = array('multichoice', '_choices' => array('never', 'logged', 'always'));
$meta['pageToolsAnimation'] = array('onoff');
$meta['showPageId'] = array('onoff');
$meta['showBadges'] = array('onoff');
$meta['showLoginOnFooter'] = array('onoff');
Expand Down
28 changes: 13 additions & 15 deletions js/template.js
Expand Up @@ -614,26 +614,24 @@ jQuery(document).on('bootstrap3:mode-index', function() {
});


// Page Tools
// Page Tools (animaton)
jQuery(document).on('bootstrap3:page-tools', function() {

setTimeout(function() {

var $page_tools_items = jQuery('#dw__pagetools ul li a');
var $page_tools = jQuery('#dw__pagetools'),
$page_tools_items = $page_tools.find('ul li a'),
$animation = $page_tools.find('.tools-animation');

if (! $page_tools_items.length) return false;

$page_tools_items.on('mouseenter', function () {
var $icon = jQuery(this);
$icon.find('i').addClass('fa-2x', 250);
});
if (! ($page_tools_items.length && $animation.length)) return false;

$page_tools_items.on('mouseleave', function () {
var $icon = jQuery(this);
$icon.find('i').removeClass('fa-2x', 250);
});
$page_tools_items.on('mouseenter', function () {
var $icon = jQuery(this);
$icon.find('i').addClass('fa-2x', 250);
});

}, 0);
$page_tools_items.on('mouseleave', function () {
var $icon = jQuery(this);
$icon.find('i').removeClass('fa-2x', 250);
});

});

Expand Down
2 changes: 2 additions & 0 deletions lang/en/settings.php
Expand Up @@ -43,6 +43,7 @@
$lang['pageInfoDateFormat_o_dformat'] = 'DokuWiki format';
$lang['pageInfoDateFormat_o_human'] = 'Human readable';
$lang['pageOnPanel'] = 'Enable the panel around the page';
$lang['pageToolsAnimation'] = 'Enable the Page Tools animation';
$lang['rightSidebar'] = 'The Right Sidebar page name, empty field disables the right sidebar.<br/>The Right Sidebar is displayed only when the default DokuWiki <a class="interwiki iw_doku" href="#config___sidebar">sidebar</a> is enabled and is on the <code>left</code> position (see the <a class="interwiki iw_doku" href="#config___tpl____bootstrap3____sidebarPosition">sidebarPosition</a> configuration). If do you want only the DokuWiki sidebar on right position, set the <a class="interwiki iw_doku" href="#config___tpl____bootstrap3____sidebarPosition">sidebarPosition</a> configuration with <code>right</code> value';
$lang['rightSidebarGrid'] = 'Right sidebar grid classes <code>col-{xs,sm,md,lg}-x</code> (see <a href="http://getbootstrap.com/css/#grid" target="_blank">Bootstrap Grids</a> documentation)';
$lang['schemaOrgType'] = 'Schema.org type (<code>Article</code>, <code>NewsArticle</code>, <code>TechArticle</code>, <code>BlogPosting</code>, <code>Recipe</code>)';
Expand Down Expand Up @@ -94,3 +95,4 @@
$lang['useGravatar'] = 'Load Gravatar image';
$lang['useLegacyNavbar'] = 'Use legacy and deprecated <code>navbar.html</code> hook (consider in the future to use the <code>:navbar</code> hook)';
$lang['useLocalBootswatch'] = 'Use the local Bootswatch directory. This option is useful in "intranet" DokuWiki installation';
$lang['showEditBtn'] = 'Display edit button in navbar';
1 change: 1 addition & 0 deletions tpl_functions.php
Expand Up @@ -909,6 +909,7 @@ function bootstrap3_conf($key, $default = false) {
case 'showTools':
case 'showSearchForm':
case 'showPageTools':
case 'showEditBtn':
return $value !== 'never' && ( $value == 'always' || ! empty($_SERVER['REMOTE_USER']) );

case 'showAdminMenu':
Expand Down
6 changes: 6 additions & 0 deletions tpl_navbar.php
Expand Up @@ -93,6 +93,12 @@

<ul class="nav navbar-nav">

<?php if (bootstrap3_conf('editBtn')): ?>
<li class="dw-action-icon hidden-xs">
<?php tpl_actionlink('edit', '<span class="sr-only">', '</span>'); ?>
</li>
<?php endif; ?>

<?php if (bootstrap3_conf('fluidContainerBtn')): ?>
<li class="hidden-xs<?php echo (bootstrap3_fluid_container_button() ? ' active' : '')?>">
<a href="#" class="fluid-container" title="<?php echo tpl_getLang('expand_container') ?>"><i class="fa fa-fw fa-arrows-alt"></i><span class="<?php echo (in_array('expand', bootstrap3_conf('navbarLabels')) ? '' : 'hidden-lg hidden-md hidden-sm') ?>"> <?php echo tpl_getLang('expand_container') ?></span></a>
Expand Down
2 changes: 1 addition & 1 deletion tpl_page_tools.php
Expand Up @@ -13,7 +13,7 @@
?>
<?php if (bootstrap3_conf('showPageTools')): ?>
<div id="dw__pagetools" class="hidden-print panel panel-default">
<div class="tools">
<div class="tools <?php echo ((bootstrap3_conf('pageToolsAnimation')) ? 'tools-animation' : '') ?>">
<ul class="nav nav-stacked nav-pills">
<?php
$tools = bootstrap3_tools();
Expand Down

0 comments on commit 11c85a5

Please sign in to comment.