add support for multilevel menus
This commit is contained in:
parent
637189ddf6
commit
6ff4ad0c33
|
|
@ -98,7 +98,8 @@ Route::group(['middleware' => 'admin', 'prefix' => 'admin'], function ()
|
||||||
{
|
{
|
||||||
Route::get('/', 'AdminController@index');
|
Route::get('/', 'AdminController@index');
|
||||||
|
|
||||||
Route::any('/plugins', 'AdminController@plugins');
|
Route::any('/plugins/manage', 'AdminController@plugins');
|
||||||
|
|
||||||
Route::any('/customize', 'AdminController@customize');
|
Route::any('/customize', 'AdminController@customize');
|
||||||
Route::any('/score', 'AdminController@score');
|
Route::any('/score', 'AdminController@score');
|
||||||
Route::any('/options', 'AdminController@options');
|
Route::any('/options', 'AdminController@options');
|
||||||
|
|
|
||||||
|
|
@ -158,14 +158,28 @@ if (! function_exists('bs_menu')) {
|
||||||
throw new InvalidArgumentException;
|
throw new InvalidArgumentException;
|
||||||
}
|
}
|
||||||
|
|
||||||
$request = App::make('request');
|
echo bs_menu_render($menu[$type]);
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($menu[$type] as $key => $value) {
|
function bs_menu_render($data)
|
||||||
echo ($request->is($value['link'])) ? '<li class="active">' : '<li>';
|
{
|
||||||
|
$content = "";
|
||||||
|
|
||||||
echo '<a href="'.url($value['link']).'"><i class="fa '.$value['icon'].'"></i> <span>'.trans($value['title']).'</span></a></li>';
|
foreach ($data as $key => $value) {
|
||||||
|
$content .= (app('request')->is(@$value['link'])) ? '<li class="active">' : '<li>';
|
||||||
|
|
||||||
|
if (isset($value['children'])) {
|
||||||
|
$content .= '<a href="#"><i class="fa '.$value['icon'].'"></i> <span>'.trans($value['title']).'</span><span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span></a>';
|
||||||
|
// recurse
|
||||||
|
$content .= '<ul class="treeview-menu" style="display: none;">'.bs_menu_render($value['children']).'</ul>';
|
||||||
|
} else {
|
||||||
|
$content .= '<a href="'.url($value['link']).'"><i class="fa '.$value['icon'].'"></i> <span>'.trans($value['title']).'</span></a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$content .= '</li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,18 +12,21 @@ $menu['user'] = array(
|
||||||
['title' => 'general.dashboard', 'link' => 'user', 'icon' => 'fa-dashboard'],
|
['title' => 'general.dashboard', 'link' => 'user', 'icon' => 'fa-dashboard'],
|
||||||
['title' => 'general.my-closet', 'link' => 'user/closet', 'icon' => 'fa-star'],
|
['title' => 'general.my-closet', 'link' => 'user/closet', 'icon' => 'fa-star'],
|
||||||
['title' => 'general.player-manage', 'link' => 'user/player', 'icon' => 'fa-users'],
|
['title' => 'general.player-manage', 'link' => 'user/player', 'icon' => 'fa-users'],
|
||||||
['title' => 'general.profile', 'link' => 'user/profile', 'icon' => 'fa-user']
|
['title' => 'general.profile', 'link' => 'user/profile', 'icon' => 'fa-user'],
|
||||||
);
|
);
|
||||||
|
|
||||||
$menu['admin'] = array(
|
$menu['admin'] = array(
|
||||||
['title' => 'general.dashboard', 'link' => 'admin', 'icon' => 'fa-dashboard'],
|
['title' => 'general.dashboard', 'link' => 'admin', 'icon' => 'fa-dashboard'],
|
||||||
['title' => 'general.user-manage', 'link' => 'admin/users', 'icon' => 'fa-users'],
|
['title' => 'general.user-manage', 'link' => 'admin/users', 'icon' => 'fa-users'],
|
||||||
['title' => 'general.player-manage', 'link' => 'admin/players', 'icon' => 'fa-gamepad'],
|
['title' => 'general.player-manage', 'link' => 'admin/players', 'icon' => 'fa-gamepad'],
|
||||||
['title' => 'general.plugin-manage', 'link' => 'admin/plugins', 'icon' => 'fa-plug'],
|
['title' => 'general.plugin-manage', 'icon' => 'fa-plug', 'children' => [
|
||||||
|
['title' => 'general.plugin-market', 'link' => 'admin/plugins/market', 'icon' => 'fa-shopping-bag'],
|
||||||
|
['title' => 'general.plugin-installed', 'link' => 'admin/plugins/manage', 'icon' => 'fa-download'],
|
||||||
|
]],
|
||||||
['title' => 'general.customize', 'link' => 'admin/customize', 'icon' => 'fa-paint-brush'],
|
['title' => 'general.customize', 'link' => 'admin/customize', 'icon' => 'fa-paint-brush'],
|
||||||
['title' => 'general.score-options', 'link' => 'admin/score', 'icon' => 'fa-credit-card'],
|
['title' => 'general.score-options', 'link' => 'admin/score', 'icon' => 'fa-credit-card'],
|
||||||
['title' => 'general.options', 'link' => 'admin/options', 'icon' => 'fa-cog'],
|
['title' => 'general.options', 'link' => 'admin/options', 'icon' => 'fa-cog'],
|
||||||
['title' => 'general.check-update', 'link' => 'admin/update', 'icon' => 'fa-arrow-up']
|
['title' => 'general.check-update', 'link' => 'admin/update', 'icon' => 'fa-arrow-up'],
|
||||||
);
|
);
|
||||||
|
|
||||||
return $menu;
|
return $menu;
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ my-closet: Closet
|
||||||
player-manage: Player Manage
|
player-manage: Player Manage
|
||||||
user-manage: User Manage
|
user-manage: User Manage
|
||||||
plugin-manage: Plugin Manage
|
plugin-manage: Plugin Manage
|
||||||
|
plugin-market: Plugin Market
|
||||||
|
plugin-installed: Installed
|
||||||
customize: Customize
|
customize: Customize
|
||||||
options: Options
|
options: Options
|
||||||
import-v2: Import Data
|
import-v2: Import Data
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ my-closet: 我的衣柜
|
||||||
player-manage: 角色管理
|
player-manage: 角色管理
|
||||||
user-manage: 用户管理
|
user-manage: 用户管理
|
||||||
plugin-manage: 插件管理
|
plugin-manage: 插件管理
|
||||||
|
plugin-market: 插件市场
|
||||||
|
plugin-installed: 已安装
|
||||||
customize: 个性化
|
customize: 个性化
|
||||||
options: 站点配置
|
options: 站点配置
|
||||||
import-v2: 导入数据
|
import-v2: 导入数据
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user