Optimalization: simplified tabs structure

This commit is contained in:
Marcin Kurczewski 2013-11-30 00:03:59 +01:00
parent e4b4c5d273
commit 5e58488f3e
10 changed files with 140 additions and 126 deletions

View file

@ -322,6 +322,38 @@ button:hover {
.tabs ul {
list-style-type: none;
margin: -4px 0 1em 0;
padding: 0;
border-bottom: 1px solid #ccc;
}
.tabs li {
display: inline-block;
}
.tabs li a {
display: inline-block;
padding: 0.5em 1em;
margin: 5px 0 -1px 0;
vertical-align: middle;
border: 1px none;
border-bottom: 1px solid #ccc;
color: silver;
}
.tabs li.selected a {
border: 1px solid #ccc;
border-bottom: none;
color: inherit;
background: white;
}
.tabs li a:focus {
color: firebrick;
}
.alert { .alert {
text-align: center; text-align: center;
padding: 10px; padding: 10px;

View file

@ -34,7 +34,6 @@ class IndexController
throw new SimpleException('Invalid tab'); throw new SimpleException('Invalid tab');
$this->context->path = TextHelper::absolutePath($this->config->help->paths[$tab]); $this->context->path = TextHelper::absolutePath($this->config->help->paths[$tab]);
$this->context->stylesheets []= 'index-help.css'; $this->context->stylesheets []= 'index-help.css';
$this->context->stylesheets []= 'tabs.css';
$this->context->subTitle = 'help'; $this->context->subTitle = 'help';
$this->context->tab = $tab; $this->context->tab = $tab;
} }

View file

@ -69,7 +69,6 @@ class PostController
$this->context->viewName = 'post-list-wrapper'; $this->context->viewName = 'post-list-wrapper';
$this->context->stylesheets []= 'post-small.css'; $this->context->stylesheets []= 'post-small.css';
$this->context->stylesheets []= 'post-list.css'; $this->context->stylesheets []= 'post-list.css';
$this->context->stylesheets []= 'tabs.css';
$this->context->stylesheets []= 'paginator.css'; $this->context->stylesheets []= 'paginator.css';
$this->context->scripts []= 'post-list.js'; $this->context->scripts []= 'post-list.js';
if ($this->context->user->hasEnabledEndlessScrolling()) if ($this->context->user->hasEnabledEndlessScrolling())
@ -189,7 +188,6 @@ class PostController
public function uploadAction() public function uploadAction()
{ {
$this->context->stylesheets []= 'upload.css'; $this->context->stylesheets []= 'upload.css';
$this->context->stylesheets []= 'tabs.css';
$this->context->scripts []= 'upload.js'; $this->context->scripts []= 'upload.js';
$this->context->subTitle = 'upload'; $this->context->subTitle = 'upload';
PrivilegesHelper::confirmWithException(Privilege::UploadPost); PrivilegesHelper::confirmWithException(Privilege::UploadPost);

View file

@ -9,7 +9,6 @@ class TagController
public function listAction($filter = null) public function listAction($filter = null)
{ {
$this->context->stylesheets []= 'tag-list.css'; $this->context->stylesheets []= 'tag-list.css';
$this->context->stylesheets []= 'tabs.css';
$this->context->subTitle = 'tags'; $this->context->subTitle = 'tags';
$this->context->viewName = 'tag-list-wrapper'; $this->context->viewName = 'tag-list-wrapper';
@ -34,7 +33,6 @@ class TagController
public function mergeAction() public function mergeAction()
{ {
$this->context->stylesheets []= 'tag-list.css'; $this->context->stylesheets []= 'tag-list.css';
$this->context->stylesheets []= 'tabs.css';
$this->context->subTitle = 'tags'; $this->context->subTitle = 'tags';
$this->context->viewName = 'tag-list-wrapper'; $this->context->viewName = 'tag-list-wrapper';
@ -78,7 +76,6 @@ class TagController
public function renameAction() public function renameAction()
{ {
$this->context->stylesheets []= 'tag-list.css'; $this->context->stylesheets []= 'tag-list.css';
$this->context->stylesheets []= 'tabs.css';
$this->context->subTitle = 'tags'; $this->context->subTitle = 'tags';
$this->context->viewName = 'tag-list-wrapper'; $this->context->viewName = 'tag-list-wrapper';
@ -113,7 +110,6 @@ class TagController
public function massTagRedirectAction() public function massTagRedirectAction()
{ {
$this->context->stylesheets []= 'tag-list.css'; $this->context->stylesheets []= 'tag-list.css';
$this->context->stylesheets []= 'tabs.css';
$this->context->subTitle = 'tags'; $this->context->subTitle = 'tags';
$this->context->viewName = 'tag-list-wrapper'; $this->context->viewName = 'tag-list-wrapper';

View file

@ -8,7 +8,6 @@ class UserController
$this->context->transport->user = $user; $this->context->transport->user = $user;
$this->context->handleExceptions = true; $this->context->handleExceptions = true;
$this->context->viewName = 'user-view'; $this->context->viewName = 'user-view';
$this->context->stylesheets []= 'tabs.css';
$this->context->stylesheets []= 'user-view.css'; $this->context->stylesheets []= 'user-view.css';
$this->context->subTitle = $user->name; $this->context->subTitle = $user->name;
} }

View file

@ -4,8 +4,7 @@ $firstTab = !empty($tabs) ? array_keys($tabs)[0] : null;
?> ?>
<?php if (count($tabs) > 1): ?> <?php if (count($tabs) > 1): ?>
<div class="tabs"> <nav class="tabs">
<nav>
<ul> <ul>
<?php foreach ($tabs as $tab => $text): ?> <?php foreach ($tabs as $tab => $text): ?>
<?php if ($tab == $this->context->tab): ?> <?php if ($tab == $this->context->tab): ?>
@ -20,7 +19,6 @@ $firstTab = !empty($tabs) ? array_keys($tabs)[0] : null;
<?php endforeach ?> <?php endforeach ?>
</ul> </ul>
</nav> </nav>
</div>
<?php endif ?> <?php endif ?>
<?php echo TextHelper::parseMarkdown(file_get_contents($this->context->path)) ?> <?php echo TextHelper::parseMarkdown(file_get_contents($this->context->path)) ?>

View file

@ -11,8 +11,7 @@ if ($this->context->route->simpleActionName == 'favorites') $activeTab = 2;
if ($this->context->source == 'mass-tag') $activeTab = 3; if ($this->context->source == 'mass-tag') $activeTab = 3;
?> ?>
<div class="tabs"> <nav class="tabs">
<nav>
<ul> <ul>
<?php foreach ($tabs as $i => $tab): ?> <?php foreach ($tabs as $i => $tab): ?>
<?php list($name, $url) = $tab ?> <?php list($name, $url) = $tab ?>
@ -28,6 +27,5 @@ if ($this->context->source == 'mass-tag') $activeTab = 3;
<?php endforeach ?> <?php endforeach ?>
</ul> </ul>
</nav> </nav>
</div>
<?php $this->renderFile('post-list') ?> <?php $this->renderFile('post-list') ?>

View file

@ -10,8 +10,7 @@
<div id="inner-content"> <div id="inner-content">
<div id="upload-step1"> <div id="upload-step1">
<div class="tabs"> <nav class="tabs">
<nav>
<ul> <ul>
<li class="selected file"> <li class="selected file">
<a href="#"> <a href="#">
@ -26,7 +25,6 @@
</li> </li>
</ul> </ul>
</nav> </nav>
</div>
<div class="tab file"> <div class="tab file">
<input type=file multiple style="display: none"/> <input type=file multiple style="display: none"/>

View file

@ -5,8 +5,7 @@
<?php if (PrivilegesHelper::confirm(Privilege::MassTag)) $tabs['mass-tag-redirect'] = 'Mass tag'; ?> <?php if (PrivilegesHelper::confirm(Privilege::MassTag)) $tabs['mass-tag-redirect'] = 'Mass tag'; ?>
<?php if (count(array_diff($tabs, ['list'])) > 1): ?> <?php if (count(array_diff($tabs, ['list'])) > 1): ?>
<div class="tabs"> <nav class="tabs">
<nav>
<ul> <ul>
<?php foreach ($tabs as $tab => $name): ?> <?php foreach ($tabs as $tab => $name): ?>
<?php if ($this->context->route->simpleActionName == $tab): ?> <?php if ($this->context->route->simpleActionName == $tab): ?>
@ -21,7 +20,6 @@
<?php endforeach ?> <?php endforeach ?>
</ul> </ul>
</nav> </nav>
</div>
<?php endif ?> <?php endif ?>
<?php if ($this->context->route->simpleActionName == 'merge'): ?> <?php if ($this->context->route->simpleActionName == 'merge'): ?>

View file

@ -112,8 +112,7 @@
</div> </div>
<div id="inner-content"> <div id="inner-content">
<div class="tabs"> <nav class="tabs">
<nav>
<ul> <ul>
<?php if ($this->context->transport->tab == 'favs'): ?> <?php if ($this->context->transport->tab == 'favs'): ?>
<li class="selected favs"> <li class="selected favs">
@ -172,7 +171,6 @@
<?php endif ?> <?php endif ?>
</ul> </ul>
</nav> </nav>
</div>
<?php if (isset($this->context->transport->posts)): ?> <?php if (isset($this->context->transport->posts)): ?>
<?php $this->renderFile('post-list') ?> <?php $this->renderFile('post-list') ?>