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;
}
.tab {
.tab-content {
margin-bottom: 1em;
}
.tab.url {
.tab-content.url {
display: none;
}

View file

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

View file

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

View file

@ -34,7 +34,7 @@ LayoutHelper::addScript('../lib/tagit/jquery.tagit.js');
</ul>
</nav>
<div class="tab file">
<div class="tab-content file">
<input type=file multiple style="display: none"/>
<div id="file-handler-wrapper">
<div id="file-handler">
@ -44,7 +44,7 @@ LayoutHelper::addScript('../lib/tagit/jquery.tagit.js');
</div>
</div>
<div class="tab url">
<div class="tab-content url">
<div id="url-handler-wrapper">
<div id="url-handler">
<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::MergeTags)) $tabs['merge'] = 'Merge';
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">
<ul>
<?php foreach ($tabs as $tab => $name): ?>
@ -25,6 +26,8 @@ if (PrivilegesHelper::confirm(Privilege::MassTag)) $tabs['mass-tag-redirect'] =
<?php endforeach ?>
</ul>
</nav>
<div class="tab-content">
<?php endif ?>
<?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 $this->renderFile('tag-mass-tag') ?>
<?php endif ?>
<?php if ($showTabs): ?>
</div>
<?php endif ?>

View file

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