Change the style

The main navigation menu is split into left (general) and right (user) parts
This commit is contained in:
Visman 2020-08-13 22:55:53 +07:00
parent 0b6c9e6f7b
commit 6f3deb4044
7 changed files with 129 additions and 41 deletions

View file

@ -46,28 +46,35 @@ abstract class Page extends Model
*/
public function prepare(): void
{
$this->fNavigation = $this->fNavigation();
$this->maintenance();
$this->boardNavigation();
$this->iswevMessages();
}
/**
* Возвращает массив ссылок с описанием для построения навигации
*
* @return array
* Задает массивы главной навигации форума
*/
protected function fNavigation(): array
protected function boardNavigation(): void
{
$r = $this->c->Router;
$nav = [
'index' => [$r->link('Index'), 'Index']
$navUser = [];
$navGen = [
'index' => [
$r->link('Index'),
'Index',
'Index',
],
];
if (
'1' == $this->user->g_read_board
&& $this->user->viewUsers
) {
$nav['userlist'] = [$r->link('Userlist'), 'User list'];
$navGen['userlist'] = [
$r->link('Userlist'),
'User list',
'User list',
];
}
if (
@ -78,7 +85,11 @@ abstract class Page extends Model
|| '1' == $this->c->config->o_regs_allow
)
) {
$nav['rules'] = [$r->link('Rules'), 'Rules'];
$navGen['rules'] = [
$r->link('Rules'),
'Rules',
'Rules',
];
}
if (
@ -119,14 +130,32 @@ abstract class Page extends Model
'Find unanswered topics',
];
$nav['search'] = [$r->link('Search'), 'Search', null, $sub];
$navGen['search'] = [
$r->link('Search'),
'Search',
'Search',
$sub
];
}
if ($this->user->isGuest) {
$nav['register'] = [$r->link('Register'), 'Register'];
$nav['login'] = [$r->link('Login'), 'Login'];
$navUser['register'] = [
$r->link('Register'),
'Register',
'Register',
];
$navUser['login'] = [
$r->link('Login'),
'Login',
'Login',
];
} else {
$nav['profile'] = [$this->user->link, 'Profile'];
$navUser['profile'] = [
$this->user->link,
__('User %s', $this->user->username),
'Profile',
];
// New PMS
if (
'1' == $this->c->config->o_pms_enabled
@ -135,15 +164,23 @@ abstract class Page extends Model
|| $this->user->messages_new > 0
)
) { //????
$nav['pmsnew'] = ['pmsnew.php', 'PM']; //'<li id="nav"'.((PUN_ACTIVE_PAGE == 'pms_new' || $user['messages_new'] > 0) ? ' class="isactive"' : '').'><a href="pmsnew.php">'.__('PM').(($user['messages_new'] > 0) ? ' (<span'.((empty($this->c->config->o_pms_flasher) || PUN_ACTIVE_PAGE == 'pms_new') ? '' : ' class="remflasher"' ).'>'.$user['messages_new'].'</span>)' : '').'</a></li>';
$navUser['pmsnew'] = [
'pmsnew.php',
'PM',
'PM',
]; //'<li id="nav"'.((PUN_ACTIVE_PAGE == 'pms_new' || $user['messages_new'] > 0) ? ' class="isactive"' : '').'><a href="pmsnew.php">'.__('PM').(($user['messages_new'] > 0) ? ' (<span'.((empty($this->c->config->o_pms_flasher) || PUN_ACTIVE_PAGE == 'pms_new') ? '' : ' class="remflasher"' ).'>'.$user['messages_new'].'</span>)' : '').'</a></li>';
}
// New PMS
if ($this->user->isAdmMod) {
$nav['admin'] = [$r->link('Admin'), 'Admin'];
$navUser['admin'] = [
$r->link('Admin'),
'Admin',
'Admin',
];
}
$nav['logout'] = [
$navUser['logout'] = [
$r->link(
'Logout',
[
@ -151,6 +188,7 @@ abstract class Page extends Model
]
),
'Logout',
'Logout',
];
}
@ -165,26 +203,27 @@ abstract class Page extends Model
if (empty($matches[4][$i])) {
$matches[4][$i] = 'extra' . $i;
}
if (isset($nav[$matches[4][$i]])) {
$nav[$matches[4][$i]] = [$matches[3][$i], $matches[2][$i]];
if (isset($navGen[$matches[4][$i]])) {
$navGen[$matches[4][$i]] = [$matches[3][$i], $matches[2][$i]];
} else {
$nav = \array_merge(
\array_slice($nav, 0, $matches[1][$i]),
$navGen = \array_merge(
\array_slice($navGen, 0, $matches[1][$i]),
[$matches[4][$i] => [$matches[3][$i], $matches[2][$i]]],
\array_slice($nav, $matches[1][$i])
\array_slice($navGen, $matches[1][$i])
);
}
}
}
}
return $nav;
$this->fNavigation = $navGen;
$this->fNavigationUser = $navUser;
}
/**
* Вывод информации о режиме обслуживания для админа
* Задает вывод различных сообщений по условиям
*/
protected function maintenance(): void
protected function iswevMessages(): void
{
if (
'1' == $this->c->config->o_maintenance

View file

@ -501,3 +501,6 @@ msgstr "Invalid passphrase"
msgid "Stick topic"
msgstr "Stick topic"
msgid "User %s"
msgstr "%s"

View file

@ -399,9 +399,6 @@ msgstr "Contact details"
msgid "Personal information"
msgstr "Personal information"
msgid "User %s"
msgstr "%s"
msgid "Email settings label"
msgstr "Email settings"

View file

@ -503,3 +503,6 @@ msgstr "Неверная кодовая фраза"
msgid "Stick topic"
msgstr "Выделить тему"
msgid "User %s"
msgstr "%s"

View file

@ -399,9 +399,6 @@ msgstr "Контактная информация"
msgid "Personal information"
msgstr "Персональные данные"
msgid "User %s"
msgstr "%s"
msgid "Email settings label"
msgstr "Настройки email"

View file

@ -28,13 +28,13 @@
<ul class="f-menu-items">
@foreach ($p->fNavigation as $key => $val)
<li id="id-nav-{!! $key !!}" class="f-menu-item"><!-- inline -->
<a class="f-menu-a @if ($key == $p->fIndex) active @endif" href="{!! __($val[0]) !!}">{!! __($val[1]) !!}</a>
<a class="f-menu-a @if ($key == $p->fIndex) active @endif" href="{!! __($val[0]) !!}" @if ($val[2]) title="{!! __($val[2]) !!}" @endif><span>{!! __($val[1]) !!}</span></a>
@if ($val[3])
<ul class="f-submenu-items">
@foreach ($val[3] as $key => $val)
<li id="id-nav-{!! $key !!}" class="f-menu-item">
@if ($val[0])
<a class="f-menu-a @if ($key == $p->fSubIndex) active @endif" href="{!! __($val[0]) !!}" title="{!! __($val[2]) !!}">{!! __($val[1]) !!}</a>
<a class="f-menu-a @if ($key == $p->fSubIndex) active @endif" href="{!! __($val[0]) !!}" @if ($val[2]) title="{!! __($val[2]) !!}" @endif><span>{!! __($val[1]) !!}</span></a>
@else
<span class="f-menu-span">{!! __($val[1]) !!}</span>
@endif
@ -45,6 +45,28 @@
</li><!-- endinline -->
@endforeach
</ul>
@if ($p->fNavigationUser)
<ul class="f-menu-user-items">
@foreach ($p->fNavigationUser as $key => $val)
<li id="id-nav-{!! $key !!}" class="f-menu-item"><!-- inline -->
<a class="f-menu-a @if ($key == $p->fIndex) active @endif" href="{!! __($val[0]) !!}" @if ($val[2]) title="{!! __($val[2]) !!}" @endif><span>{!! __($val[1]) !!}</span></a>
@if ($val[3])
<ul class="f-submenu-items">
@foreach ($val[3] as $key => $val)
<li id="id-nav-{!! $key !!}" class="f-menu-item">
@if ($val[0])
<a class="f-menu-a @if ($key == $p->fSubIndex) active @endif" href="{!! __($val[0]) !!}" @if ($val[2]) title="{!! __($val[2]) !!}" @endif><span>{!! __($val[1]) !!}</span></a>
@else
<span class="f-menu-span">{!! __($val[1]) !!}</span>
@endif
</li>
@endforeach
</ul>
@endif
</li><!-- endinline -->
@endforeach
</ul>
@endif
</nav>
@endif
</header>

View file

@ -340,6 +340,8 @@ body,
#fork-header #fork-nav {
width: 100%;
background-color: #F8F4E3;
display: flex;
flex-direction: column;
}
#fork-nav #id-mn-checkbox {
@ -356,8 +358,19 @@ body,
}
#fork-nav .f-menu-items {
width: 100%;
background-color: #F8F4E3;
border-bottom: 0.0625rem solid #AA7939;
}
#fork-nav .f-menu-user-items {
background-color: #F8F4E3;
display: flex;
justify-content: flex-end;
flex-wrap: wrap;
}
#fork-nav .f-menu-user-items .f-menu-item {
min-width: 4rem;
}
#fork-nav .f-menu-a {
@ -366,6 +379,10 @@ body,
text-align: center;
}
#fork-nav .f-menu-user-items .f-menu-a {
text-transform: none;
}
#fork-nav .f-submenu-items {
background-color: #FFEBCD; /* #D3B58D; */
}
@ -386,6 +403,10 @@ body,
color: #F8F4E3;
}
#fork-nav #id-nav-profile span {
font-weight: bold;
}
@media screen and (min-width: 50rem) {
#fork-header #id-fhth1 {
overflow: auto;
@ -397,11 +418,17 @@ body,
display: none;
}
#fork-header #fork-nav {
flex-direction: row;
}
#fork-nav .f-menu-items {
display: flex;
flex-wrap: wrap;
/*max-height: 100rem;*/
flex-direction: row;
margin-right: auto;
border-bottom: 0;
}
#fork-nav .f-menu-item {
@ -888,7 +915,7 @@ body,
#fork #id-an-label {
position: absolute;
top: -3.125rem;
top: -2.875rem;
right: 0.625rem;
}
@ -1617,12 +1644,12 @@ body,
padding-left: 1.5rem;
}
#fork .f-post-main p,
#fork .f-post-main blockquote,
#fork .f-post-main br,
#fork .f-post-main pre,
#fork .f-post-main ol,
#fork .f-post-main ul {
#fork .f-post-body p,
#fork .f-post-body blockquote,
#fork .f-post-body br,
#fork .f-post-body pre,
#fork .f-post-body ol,
#fork .f-post-body ul {
margin-bottom: 0.625rem;
/* word-wrap: break-word; */
}