Optimalization: simplified tabs structure
This commit is contained in:
parent
e4b4c5d273
commit
5e58488f3e
10 changed files with 140 additions and 126 deletions
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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';
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,23 +4,21 @@ $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): ?>
|
<li class="selected <?php echo $tab ?>">
|
||||||
<li class="selected <?php echo $tab ?>">
|
<?php else: ?>
|
||||||
<?php else: ?>
|
<li class="<?php echo $tab ?>">
|
||||||
<li class="<?php echo $tab ?>">
|
<?php endif ?>
|
||||||
<?php endif ?>
|
<a href="<?php echo \Chibi\UrlHelper::route('index', 'help', $tab == $firstTab ? [] : ['tab' => $tab]) ?>">
|
||||||
<a href="<?php echo \Chibi\UrlHelper::route('index', 'help', $tab == $firstTab ? [] : ['tab' => $tab]) ?>">
|
<?php echo $text ?>
|
||||||
<?php echo $text ?>
|
</a>
|
||||||
</a>
|
</li>
|
||||||
</li>
|
<?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)) ?>
|
||||||
|
|
|
@ -11,23 +11,21 @@ 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 ?>
|
<?php if ($i == $activeTab): ?>
|
||||||
<?php if ($i == $activeTab): ?>
|
<li class="selected <?php echo TextHelper::humanCaseToKebabCase($name) ?>">
|
||||||
<li class="selected <?php echo TextHelper::humanCaseToKebabCase($name) ?>">
|
<?php else: ?>
|
||||||
<?php else: ?>
|
<li class="<?php echo TextHelper::humanCaseToKebabCase($name) ?>">
|
||||||
<li class="<?php echo TextHelper::humanCaseToKebabCase($name) ?>">
|
<?php endif ?>
|
||||||
<?php endif ?>
|
<a href="<?php echo $url ?>">
|
||||||
<a href="<?php echo $url ?>">
|
<?php echo $name ?>
|
||||||
<?php echo $name ?>
|
</a>
|
||||||
</a>
|
</li>
|
||||||
</li>
|
<?php endforeach ?>
|
||||||
<?php endforeach ?>
|
</ul>
|
||||||
</ul>
|
</nav>
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php $this->renderFile('post-list') ?>
|
<?php $this->renderFile('post-list') ?>
|
||||||
|
|
|
@ -10,23 +10,21 @@
|
||||||
|
|
||||||
<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="#">
|
Upload from file
|
||||||
Upload from file
|
</a>
|
||||||
</a>
|
</li>
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="url">
|
<li class="url">
|
||||||
<a href="#">
|
<a href="#">
|
||||||
Upload from URL
|
Upload from URL
|
||||||
</a>
|
</a>
|
||||||
</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"/>
|
||||||
|
|
|
@ -5,23 +5,21 @@
|
||||||
<?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): ?>
|
<li class="selected <?php echo $tab ?>">
|
||||||
<li class="selected <?php echo $tab ?>">
|
<?php else: ?>
|
||||||
<?php else: ?>
|
<li class="<?php echo $tab ?>">
|
||||||
<li class="<?php echo $tab ?>">
|
<?php endif ?>
|
||||||
<?php endif ?>
|
<a href="<?php echo \Chibi\UrlHelper::route('tag', $tab) ?>">
|
||||||
<a href="<?php echo \Chibi\UrlHelper::route('tag', $tab) ?>">
|
<?php echo $name ?>
|
||||||
<?php echo $name ?>
|
</a>
|
||||||
</a>
|
</li>
|
||||||
</li>
|
<?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'): ?>
|
||||||
|
|
|
@ -112,67 +112,65 @@
|
||||||
</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">
|
<?php else: ?>
|
||||||
|
<li class="favs">
|
||||||
|
<?php endif ?>
|
||||||
|
<a href="<?php echo \Chibi\UrlHelper::route('user', 'view', ['name' => $this->context->transport->user->name, 'tab' => 'favs', 'page' => 1]) ?>">
|
||||||
|
Favs
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<?php if ($this->context->transport->tab == 'uploads'): ?>
|
||||||
|
<li class="selected uploads">
|
||||||
|
<?php else: ?>
|
||||||
|
<li class="uploads">
|
||||||
|
<?php endif ?>
|
||||||
|
<a href="<?php echo \Chibi\UrlHelper::route('user', 'view', ['name' => $this->context->transport->user->name, 'tab' => 'uploads', 'page' => 1]) ?>">
|
||||||
|
Uploads
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<?php if (PrivilegesHelper::confirm(Privilege::ChangeUserSettings, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
|
||||||
|
<?php if ($this->context->transport->tab == 'settings'): ?>
|
||||||
|
<li class="selected settings">
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<li class="favs">
|
<li class="settings">
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<a href="<?php echo \Chibi\UrlHelper::route('user', 'view', ['name' => $this->context->transport->user->name, 'tab' => 'favs', 'page' => 1]) ?>">
|
<a href="<?php echo \Chibi\UrlHelper::route('user', 'settings', ['name' => $this->context->transport->user->name]) ?>">
|
||||||
Favs
|
Browsing settings
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if ($this->context->transport->tab == 'uploads'): ?>
|
<?php if ($canModifyAnything): ?>
|
||||||
<li class="selected uploads">
|
<?php if ($this->context->transport->tab == 'edit'): ?>
|
||||||
|
<li class="selected edit">
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<li class="uploads">
|
<li class="edit">
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<a href="<?php echo \Chibi\UrlHelper::route('user', 'view', ['name' => $this->context->transport->user->name, 'tab' => 'uploads', 'page' => 1]) ?>">
|
<a href="<?php echo \Chibi\UrlHelper::route('user', 'edit', ['name' => $this->context->transport->user->name]) ?>">
|
||||||
Uploads
|
Account settings
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if (PrivilegesHelper::confirm(Privilege::ChangeUserSettings, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
|
<?php if (PrivilegesHelper::confirm(Privilege::DeleteUser, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
|
||||||
<?php if ($this->context->transport->tab == 'settings'): ?>
|
<?php if ($this->context->transport->tab == 'delete'): ?>
|
||||||
<li class="selected settings">
|
<li class="selected delete">
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<li class="settings">
|
<li class="delete">
|
||||||
<?php endif ?>
|
|
||||||
<a href="<?php echo \Chibi\UrlHelper::route('user', 'settings', ['name' => $this->context->transport->user->name]) ?>">
|
|
||||||
Browsing settings
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
<a href="<?php echo \Chibi\UrlHelper::route('user', 'delete', ['name' => $this->context->transport->user->name]) ?>">
|
||||||
<?php if ($canModifyAnything): ?>
|
Delete account
|
||||||
<?php if ($this->context->transport->tab == 'edit'): ?>
|
</a>
|
||||||
<li class="selected edit">
|
</li>
|
||||||
<?php else: ?>
|
<?php endif ?>
|
||||||
<li class="edit">
|
</ul>
|
||||||
<?php endif ?>
|
</nav>
|
||||||
<a href="<?php echo \Chibi\UrlHelper::route('user', 'edit', ['name' => $this->context->transport->user->name]) ?>">
|
|
||||||
Account settings
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<?php endif ?>
|
|
||||||
|
|
||||||
<?php if (PrivilegesHelper::confirm(Privilege::DeleteUser, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
|
|
||||||
<?php if ($this->context->transport->tab == 'delete'): ?>
|
|
||||||
<li class="selected delete">
|
|
||||||
<?php else: ?>
|
|
||||||
<li class="delete">
|
|
||||||
<?php endif ?>
|
|
||||||
<a href="<?php echo \Chibi\UrlHelper::route('user', 'delete', ['name' => $this->context->transport->user->name]) ?>">
|
|
||||||
Delete account
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<?php endif ?>
|
|
||||||
</ul>
|
|
||||||
</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') ?>
|
||||||
|
|
Loading…
Reference in a new issue