UX: Меню участника
This commit is contained in:
parent
8d7b0a2e7f
commit
3e0fceff87
7 changed files with 44 additions and 14 deletions
|
@ -247,4 +247,9 @@ class UserData
|
|||
{
|
||||
return self::$myAccount['scroll'] ?? false;
|
||||
}
|
||||
|
||||
static public function getUserBlog()
|
||||
{
|
||||
return MiddlewareModel::getBlog(self::getUserId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,15 @@ class MiddlewareModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
lang,
|
||||
invitation_available,
|
||||
ban_list,
|
||||
is_deleted
|
||||
FROM users WHERE id = :id";
|
||||
is_deleted
|
||||
FROM users
|
||||
WHERE id = :id";
|
||||
|
||||
return DB::run($sql, ['id' => $id])->fetch();
|
||||
}
|
||||
|
||||
public static function getBlog($id)
|
||||
{
|
||||
return DB::run("SELECT facet_slug FROM facets WHERE facet_user_id = :id AND facet_type = 'blog'", ['id' => $id])->fetch();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ class MainConnector implements Connector
|
|||
"App\Middleware\After\*" => "app/Middleware/After/",
|
||||
"Modules\*" => "modules/",
|
||||
"App\Commands\*" => "app/Commands/",
|
||||
"App\Exception\*" => "app/Core/",
|
||||
"App\Exception\*" => "app/Exception/",
|
||||
|
||||
// ... or, if a specific class is added,
|
||||
// "Phphleb\Debugpan\DPanel" => "vendor/phphleb/debugpan/DPanel.php",
|
||||
|
|
|
@ -67,28 +67,34 @@ return [
|
|||
'user' => [
|
||||
[
|
||||
'url' => url('setting'),
|
||||
'icon' => 'settings',
|
||||
'title' => __('app.settings'),
|
||||
'id' => '',
|
||||
], [
|
||||
'tl' => config('trust-levels.tl_add_draft'),
|
||||
'icon' => 'post',
|
||||
'url' => url('drafts'),
|
||||
'title' => __('app.drafts'),
|
||||
'id' => '',
|
||||
], [
|
||||
'url' => url('notifications'),
|
||||
'icon' => 'bell',
|
||||
'title' => __('app.notifications'),
|
||||
'id' => '',
|
||||
], [
|
||||
'tl' => config('trust-levels.tl_add_pm'),
|
||||
'icon' => 'mail',
|
||||
'url' => url('messages'),
|
||||
'title' => __('app.messages'),
|
||||
'id' => '',
|
||||
], [
|
||||
'url' => url('favorites'),
|
||||
'icon' => 'bookmark',
|
||||
'title' => __('app.favorites'),
|
||||
'id' => '',
|
||||
], [
|
||||
'tl' => 2,
|
||||
'icon' => 'link',
|
||||
'url' => url('invitations'),
|
||||
'title' => __('app.invites'),
|
||||
'id' => '',
|
||||
|
@ -96,11 +102,13 @@ return [
|
|||
'hr' => 'hr',
|
||||
], [
|
||||
'tl' => UserData::REGISTERED_ADMIN,
|
||||
'icon' => 'users',
|
||||
'url' => url('admin'),
|
||||
'title' => __('app.admin'),
|
||||
'id' => '',
|
||||
], [
|
||||
'url' => url('logout'),
|
||||
'icon' => 'corner-down-right',
|
||||
'title' => __('app.sign_out'),
|
||||
'id' => '',
|
||||
],
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,6 @@
|
|||
<?php $user = UserData::get();
|
||||
<?php
|
||||
$user = UserData::get();
|
||||
$blog = UserData::getUserBlog();
|
||||
$login = $user['login'] ?? false;
|
||||
?>
|
||||
<span class="right-close pointer">x</span>
|
||||
|
@ -6,25 +8,34 @@ $login = $user['login'] ?? false;
|
|||
<?= Img::avatar(UserData::getUserAvatar(), UserData::getUserLogin(), 'img-base mt5 mr5', 'small'); ?>
|
||||
<?php if ($login) : ?>
|
||||
<div>
|
||||
<a class="gray" href="/@<?= $login; ?>"><?= $login; ?> </a>
|
||||
<div class="text-xs gray-600"><?= $user['email']; ?></div>
|
||||
<a class="gray" href="/@<?= $login; ?>"><?= $login; ?></a>
|
||||
|
||||
<?php if ($blog) : ?>
|
||||
<a class="text-xs gray-600 block" href="<?= url('blog', ['slug' => $blog['facet_slug']]);?>">
|
||||
<?= __('app.blog'); ?>: <?= $blog['facet_slug']; ?> >
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<div class="text-xs gray-600"><?= $user['email']; ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<ul class="list-none user-nav">
|
||||
<?php foreach ($list as $key => $item) :
|
||||
$tl = $item['tl'] ?? 0; ?>
|
||||
|
||||
<?php if (!empty($item['hr'])) : ?>
|
||||
<?php if (UserData::checkActiveUser()) : ?><li>
|
||||
<div class="m15"></div>
|
||||
</li><?php endif; ?>
|
||||
<li><div class="m15"></div></li>
|
||||
<?php else : ?>
|
||||
|
||||
<?php if (UserData::getRegType($tl)) : ?>
|
||||
<li><a href="<?= $item['url']; ?>"><?= $item['title']; ?></a></li>
|
||||
<li>
|
||||
<a href="<?= $item['url']; ?>">
|
||||
<?php if (!empty($item['icon'])) : ?><svg class="icons"><use xlink:href="/assets/svg/icons.svg#<?= $item['icon']; ?>"></use></svg><?php endif; ?>
|
||||
<?= $item['title']; ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
|
@ -56,7 +56,7 @@
|
|||
font-size: 0.975rem;
|
||||
}
|
||||
|
||||
.user-nav li a { margin-left: 56px; }
|
||||
.user-nav li a { margin-left: 10px; }
|
||||
.user-box-nav li:hover > a { color: #222; }
|
||||
/* end */
|
||||
|
||||
|
|
Loading…
Reference in a new issue