Added tab wrappers

This commit is contained in:
Marcin Kurczewski 2014-02-16 11:44:42 +01:00
parent 8161bc9c88
commit 83a966f1af
7 changed files with 37 additions and 19 deletions

View file

@ -8,10 +8,10 @@
float: left; float: left;
} }
.tab { .tab-content {
margin-bottom: 1em; margin-bottom: 1em;
} }
.tab.url { .tab-content.url {
display: none; display: none;
} }

View file

@ -6,8 +6,8 @@ $(function()
var className = $(this).parents('li').attr('class').replace('selected', '').replace(/^\s+|\s+$/, ''); var className = $(this).parents('li').attr('class').replace('selected', '').replace(/^\s+|\s+$/, '');
$('.tabs li').removeClass('selected'); $('.tabs li').removeClass('selected');
$(this).parents('li').addClass('selected'); $(this).parents('li').addClass('selected');
$('.tab').hide(); $('.tab-content').hide();
$('.tab.' + className).show(); $('.tab-content.' + className).show();
}); });
var tags = []; var tags = [];

View file

@ -4,9 +4,10 @@ LayoutHelper::addStylesheet('index-help.css');
$tabs = $this->config->help->subTitles; $tabs = $this->config->help->subTitles;
$firstTab = !empty($tabs) ? array_keys($tabs)[0] : null; $firstTab = !empty($tabs) ? array_keys($tabs)[0] : null;
$showTabs = count($tabs) > 1;
?> ?>
<?php if (count($tabs) > 1): ?> <?php if ($showTabs): ?>
<nav class="tabs"> <nav class="tabs">
<ul> <ul>
<?php foreach ($tabs as $tab => $text): ?> <?php foreach ($tabs as $tab => $text): ?>
@ -22,6 +23,12 @@ $firstTab = !empty($tabs) ? array_keys($tabs)[0] : null;
<?php endforeach ?> <?php endforeach ?>
</ul> </ul>
</nav> </nav>
<div class="tab-content">
<?php endif ?> <?php endif ?>
<?php echo TextHelper::parseMarkdown(file_get_contents($this->context->path)) ?> <?php echo TextHelper::parseMarkdown(file_get_contents($this->context->path)) ?>
<?php if ($showTabs): ?>
</div>
<?php endif ?>

View file

@ -30,4 +30,6 @@ if ($this->context->source == 'mass-tag') $activeTab = 3;
</ul> </ul>
</nav> </nav>
<div class="tab-content">
<?php $this->renderFile('post-list') ?> <?php $this->renderFile('post-list') ?>
</div>

View file

@ -34,7 +34,7 @@ LayoutHelper::addScript('../lib/tagit/jquery.tagit.js');
</ul> </ul>
</nav> </nav>
<div class="tab file"> <div class="tab-content file">
<input type=file multiple style="display: none"/> <input type=file multiple style="display: none"/>
<div id="file-handler-wrapper"> <div id="file-handler-wrapper">
<div id="file-handler"> <div id="file-handler">
@ -44,7 +44,7 @@ LayoutHelper::addScript('../lib/tagit/jquery.tagit.js');
</div> </div>
</div> </div>
<div class="tab url"> <div class="tab-content url">
<div id="url-handler-wrapper"> <div id="url-handler-wrapper">
<div id="url-handler"> <div id="url-handler">
<div class="input-wrapper"><textarea placeholder="Paste some URLs here, one per line." name="urls"></textarea></div> <div class="input-wrapper"><textarea placeholder="Paste some URLs here, one per line." name="urls"></textarea></div>

View file

@ -7,9 +7,10 @@ if (PrivilegesHelper::confirm(Privilege::ListTags)) $tabs['list'] = 'List';
if (PrivilegesHelper::confirm(Privilege::RenameTags)) $tabs['rename'] = 'Rename'; if (PrivilegesHelper::confirm(Privilege::RenameTags)) $tabs['rename'] = 'Rename';
if (PrivilegesHelper::confirm(Privilege::MergeTags)) $tabs['merge'] = 'Merge'; if (PrivilegesHelper::confirm(Privilege::MergeTags)) $tabs['merge'] = 'Merge';
if (PrivilegesHelper::confirm(Privilege::MassTag)) $tabs['mass-tag-redirect'] = 'Mass tag'; if (PrivilegesHelper::confirm(Privilege::MassTag)) $tabs['mass-tag-redirect'] = 'Mass tag';
$showTabs = count($tabs) > 1;
?> ?>
<?php if (count(array_diff($tabs, ['list'])) > 1): ?> <?php if ($showTabs): ?>
<nav class="tabs"> <nav class="tabs">
<ul> <ul>
<?php foreach ($tabs as $tab => $name): ?> <?php foreach ($tabs as $tab => $name): ?>
@ -25,6 +26,8 @@ if (PrivilegesHelper::confirm(Privilege::MassTag)) $tabs['mass-tag-redirect'] =
<?php endforeach ?> <?php endforeach ?>
</ul> </ul>
</nav> </nav>
<div class="tab-content">
<?php endif ?> <?php endif ?>
<?php if ($this->context->route->simpleActionName == 'merge'): ?> <?php if ($this->context->route->simpleActionName == 'merge'): ?>
@ -42,3 +45,7 @@ if (PrivilegesHelper::confirm(Privilege::MassTag)) $tabs['mass-tag-redirect'] =
<?php if ($this->context->route->simpleActionName == 'mass-tag-redirect'): ?> <?php if ($this->context->route->simpleActionName == 'mass-tag-redirect'): ?>
<?php $this->renderFile('tag-mass-tag') ?> <?php $this->renderFile('tag-mass-tag') ?>
<?php endif ?> <?php endif ?>
<?php if ($showTabs): ?>
</div>
<?php endif ?>

View file

@ -199,6 +199,7 @@ LayoutHelper::addStylesheet('user-view.css');
</ul> </ul>
</nav> </nav>
<div class="tab-content">
<?php if (isset($this->context->transport->posts)): ?> <?php if (isset($this->context->transport->posts)): ?>
<?php $this->renderFile('post-list') ?> <?php $this->renderFile('post-list') ?>
<?php endif ?> <?php endif ?>
@ -210,5 +211,6 @@ LayoutHelper::addStylesheet('user-view.css');
<?php elseif ($this->context->transport->tab == 'delete'): ?> <?php elseif ($this->context->transport->tab == 'delete'): ?>
<?php $this->renderFile('user-delete') ?> <?php $this->renderFile('user-delete') ?>
<?php endif ?> <?php endif ?>
</div>
</div> </div>