add configurable "Explore" menu
This commit is contained in:
parent
7cb3e246a8
commit
cd84f1f8a6
20
app/Events/ConfigureExploreMenu.php
Normal file
20
app/Events/ConfigureExploreMenu.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
class ConfigureExploreMenu extends Event
|
||||
{
|
||||
public $menu;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param array $menu
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array &$menu)
|
||||
{
|
||||
// Pass array by reference
|
||||
$this->menu = &$menu;
|
||||
}
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ namespace App\Services;
|
|||
use Event;
|
||||
use Closure;
|
||||
use App\Events;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class Hook
|
||||
{
|
||||
|
|
@ -23,7 +24,7 @@ class Hook
|
|||
*/
|
||||
public static function addMenuItem($category, $position, array $menu)
|
||||
{
|
||||
$class = $category == 'user' ? Events\ConfigureUserMenu::class : Events\ConfigureAdminMenu::class;
|
||||
$class = 'App\Events\Configure'.Str::title($category).'Menu';
|
||||
|
||||
Event::listen($class, function ($event) use ($menu, $position, $category) {
|
||||
$new = [];
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
use Carbon\Carbon;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
if (! function_exists('webpack_assets')) {
|
||||
function webpack_assets($relativeUri)
|
||||
|
|
@ -95,6 +96,9 @@ if (! function_exists('bs_menu')) {
|
|||
case 'user':
|
||||
event(new App\Events\ConfigureUserMenu($menu));
|
||||
break;
|
||||
case 'explore':
|
||||
event(new App\Events\ConfigureExploreMenu($menu));
|
||||
break;
|
||||
case 'admin':
|
||||
event(new App\Events\ConfigureAdminMenu($menu));
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -38,4 +38,8 @@ $menu['admin'] = [
|
|||
['title' => 'general.check-update', 'link' => 'admin/update', 'icon' => 'fa-arrow-up'],
|
||||
];
|
||||
|
||||
$menu['explore'] = [
|
||||
['title' => 'general.skinlib', 'link' => 'skinlib', 'icon' => 'fa-archive'],
|
||||
];
|
||||
|
||||
return $menu;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
- Supported Chrome's `theme-color`.
|
||||
- Allowed to customize HTTP status code for rejecting accessing private texture.
|
||||
- Added configurable "Explore" menu.
|
||||
|
||||
## Tweaked
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
- 支持 Chrome 的 `theme-color` 属性
|
||||
- 允许自定义拒绝访问私有材质时返回的 HTTP 状态码
|
||||
- 添加可自定义的「浏览」菜单
|
||||
|
||||
## 调整
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@
|
|||
{!! bs_menu('user') !!}
|
||||
|
||||
<li class="header">@lang('general.explore')</li>
|
||||
<li><a href="{{ url('skinlib') }}"><i class="fas fa-archive"></i> <span>@lang('general.skinlib')</span></a></li>
|
||||
{!! bs_menu('explore') !!}
|
||||
|
||||
@admin($user)
|
||||
<li class="header">@lang('general.manage')</li>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user