mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2025-01-08 12:07:42 +08:00
user menu can be controlled by plugins
This commit is contained in:
parent
b8188c91be
commit
bebdea9c20
@ -29,13 +29,28 @@ class UserMenuComposer
|
||||
false
|
||||
);
|
||||
$avatarPNG = $this->filter->apply('user_avatar', $avatarPNG, [$user]);
|
||||
$cli = $this->request->is('admin', 'admin/*');
|
||||
|
||||
$menuItems = [
|
||||
['label' => trans('general.user-center'), 'link' => route('user.home')],
|
||||
['label' => trans('general.profile'), 'link' => route('user.profile.')],
|
||||
];
|
||||
if ($user->isAdmin()) {
|
||||
array_push(
|
||||
$menuItems,
|
||||
['label' => '', 'link' => '#divider'],
|
||||
['label' => trans('general.admin-panel'), 'link' => route('admin.')],
|
||||
['label' => trans('general.user-manage'), 'link' => route('admin.users.')],
|
||||
['label' => trans('general.report-manage'), 'link' => route('admin.reports.')],
|
||||
['label' => 'Web CLI', 'link' => '#launch-cli'],
|
||||
);
|
||||
}
|
||||
$menuItems = $this->filter->apply('user_menu', $menuItems, [$user]);
|
||||
|
||||
$view->with([
|
||||
'user' => $user,
|
||||
'avatar' => $avatar,
|
||||
'avatar_png' => $avatarPNG,
|
||||
'cli' => $cli,
|
||||
'menu' => $menuItems,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import routes from './scripts/route'
|
||||
Object.assign(window, { React, ReactDOM, $ })
|
||||
|
||||
if (blessing.route.startsWith('admin')) {
|
||||
const entry = document.querySelector<HTMLAnchorElement>('#launch-cli')
|
||||
const entry = document.querySelector('[href="#launch-cli"]')
|
||||
entry?.addEventListener('click', async () => {
|
||||
const { launch } = await import('./scripts/cli')
|
||||
launch()
|
||||
|
@ -10,30 +10,14 @@
|
||||
</a>
|
||||
|
||||
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-right">
|
||||
<a class="dropdown-item" href="{{ url('user') }}">
|
||||
{{ trans('general.user-center') }}
|
||||
</a>
|
||||
<a class="dropdown-item" href="{{ url('user/profile') }}">
|
||||
{{ trans('general.profile') }}
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
{% if user.admin %}
|
||||
<a class="dropdown-item" href="{{ url('admin') }}">
|
||||
{{ trans('general.admin-panel') }}
|
||||
</a>
|
||||
<a class="dropdown-item" href="{{ url('admin/users') }}">
|
||||
{{ trans('general.user-manage') }}
|
||||
</a>
|
||||
<a class="dropdown-item" href="{{ url('admin/reports') }}">
|
||||
{{ trans('general.report-manage') }}
|
||||
</a>
|
||||
{% if cli %}
|
||||
<a class="dropdown-item" href="#" id="launch-cli">
|
||||
Web CLI
|
||||
</a>
|
||||
{% for item in menu %}
|
||||
{% if item.link == '#divider' %}
|
||||
<div class="dropdown-divider"></div>
|
||||
{% else %}
|
||||
<a class="dropdown-item" href="{{ item.link }}">{{ item.label }}</a>
|
||||
{% endif %}
|
||||
<div class="dropdown-divider"></div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#" id="logout-button">
|
||||
{{ trans('general.logout') }}
|
||||
</a>
|
||||
|
@ -160,7 +160,7 @@ Route::prefix('admin')
|
||||
Route::delete('{user}', 'ClosetManagementController@remove');
|
||||
});
|
||||
|
||||
Route::prefix('reports')->group(function () {
|
||||
Route::prefix('reports')->name('reports.')->group(function () {
|
||||
Route::view('', 'admin.reports');
|
||||
Route::put('{report}', 'ReportController@review');
|
||||
Route::get('list', 'ReportController@manage');
|
||||
|
Loading…
Reference in New Issue
Block a user