Skip to content

Commit

Permalink
Moved page-tools outside of the widget in order to base the border of…
Browse files Browse the repository at this point in the history
… the site tools based on if some are listed or not
  • Loading branch information
LouisOuellet committed Feb 27, 2024
1 parent b8e3366 commit 54eaf8e
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 52 deletions.
4 changes: 3 additions & 1 deletion css/components/sidebar/widgets.less
Expand Up @@ -6,9 +6,11 @@
/* Widgets */
.widget {
margin: 0 0 20px;
border-bottom: 3px solid @ini_theme_color_alt;
font-size: 14px;
}
.widget:has(*) {
border-bottom: 3px solid @ini_theme_color_alt;
}
.content-area .widget {
border-bottom-color: @ini_background_neu;
&:last-of-type {
Expand Down
21 changes: 21 additions & 0 deletions css/tools.less
Expand Up @@ -24,6 +24,27 @@
}

.page-tools {
ul {
list-style: none;
text-transform: uppercase;
}
li {
padding: 5px 0;
}
li:first-child {
padding-top: 0;
}
li:last-child {
padding-bottom: 0;
}
ul a {
color: @ini_background;
font-weight: bold;
text-decoration: none;
}
ul a:hover {
color: @ini_theme_color_alt;
}
a span.icon {
display: inline-block;
width: 20px;
Expand Down
102 changes: 51 additions & 51 deletions main.php
Expand Up @@ -81,6 +81,57 @@
</div>
<?php endif ?>

<!-- PAGE TOOLS -->
<div class="page-tools">
<h3 <?php if(!tpl_getConf('showPageToolsTitle')){ echo 'class="a11y"'; } ?>><?php echo $lang['page_tools'] ?></h3>
<ul>
<?php if (!$conf['useacl'] || ($conf['useacl'] && $INFO['perm'] >= 4)): ?>
<?php
$instructions = '{{NEWPAGE';
if(tpl_getConf('defaultAddNewPage') !== ''){
$instructions .= '>';
$instructions .= tpl_getConf('defaultAddNewPage');
}
$instructions .= '}}';
$instructions = p_get_instructions($instructions);
if(count($instructions) <= 3) {
$render = p_render('xhtml',$instructions,$info);
echo '<li>'
.'<a href="#" class="action AddNewPage" title="'.tpl_getLang('AddNewPage').'">'
.'<span class="icon"></span>'
.'<span class="a11y">'.tpl_getLang('AddNewPage').'</span>'
.'</a>'
.$render
.'</li>';
}
?>
<?php endif ?>
<?php $translation = plugin_load('helper','translation');
if ($translation){
$render = $translation->showTranslations(false);
echo '<li>'
.'<a href="#" class="action Translation" title="'.tpl_getLang('Language').'">'
.'<span class="icon"></span>'
.'<span class="a11y">'.tpl_getLang('Language').'</span>'
.'</a>'
.$render
.'</li>';
} ?>
<?php $items = (new \dokuwiki\Menu\PageMenu())->getItems();
foreach($items as $item) {
$attributes = $item->getLinkAttributes();
$html = '<li><a';
foreach($attributes as $key => $value) {
$html .= ' '.$key.'="'.$value.'"';
}
$html .= '><span class="icon"></span>'
.'<span class="a11y">'.$item->getLabel().'</span>'
.'</a></li>';
echo $html;
} ?>
</ul>
</div>

<div class="tools widget_links widget">
<?php if(!tpl_getConf('doSiteToolsRequireLogin') || !$conf['useacl'] || (tpl_getConf('doSiteToolsRequireLogin') && isset($INFO['userinfo']))){ ?>
<!-- SITE TOOLS -->
Expand All @@ -98,57 +149,6 @@
</ul>
</div>
<?php } ?>

<!-- PAGE TOOLS -->
<div class="page-tools">
<h3 <?php if(!tpl_getConf('showPageToolsTitle')){ echo 'class="a11y"'; } ?>><?php echo $lang['page_tools'] ?></h3>
<ul>
<?php if (!$conf['useacl'] || ($conf['useacl'] && $INFO['perm'] >= 4)): ?>
<?php
$instructions = '{{NEWPAGE';
if(tpl_getConf('defaultAddNewPage') !== ''){
$instructions .= '>';
$instructions .= tpl_getConf('defaultAddNewPage');
}
$instructions .= '}}';
$instructions = p_get_instructions($instructions);
if(count($instructions) <= 3) {
$render = p_render('xhtml',$instructions,$info);
echo '<li>'
.'<a href="#" class="action AddNewPage" title="'.tpl_getLang('AddNewPage').'">'
.'<span class="icon"></span>'
.'<span class="a11y">'.tpl_getLang('AddNewPage').'</span>'
.'</a>'
.$render
.'</li>';
}
?>
<?php endif ?>
<?php $translation = plugin_load('helper','translation');
if ($translation){
$render = $translation->showTranslations(false);
echo '<li>'
.'<a href="#" class="action Translation" title="'.tpl_getLang('Language').'">'
.'<span class="icon"></span>'
.'<span class="a11y">'.tpl_getLang('Language').'</span>'
.'</a>'
.$render
.'</li>';
} ?>
<?php $items = (new \dokuwiki\Menu\PageMenu())->getItems();
foreach($items as $item) {
$attributes = $item->getLinkAttributes();
$html = '<li><a';
foreach($attributes as $key => $value) {
$html .= ' '.$key.'="'.$value.'"';
}
$html .= '><span class="icon"></span>'
.'<span class="a11y">'.$item->getLabel().'</span>'
.'</a></li>';
echo $html;
} ?>
</ul>
</div>
</div>

<footer id="writr__colophon" class="site-footer" role="contentinfo">
Expand Down

0 comments on commit 54eaf8e

Please sign in to comment.