This commit adds functionality for creating widget of whatever type. Controller calls widget admin handler, which renders and handles input form.
83 lines
3.7 KiB
PHP
83 lines
3.7 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Enumerations\WidgetTypes;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AdminMenusProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Bootstrap the application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot()
|
|
{
|
|
// create instance of main menu
|
|
\Menu::create('mainMenu', function ($menu) {
|
|
/**
|
|
* @var $menu \Pingpong\Menus\MenuBuilder
|
|
*/
|
|
|
|
// create menu entries
|
|
|
|
/*
|
|
* WARNING: MenuBuilder::route() does not seem to work,
|
|
* nor route() helper function. We need to use action() helper instaed.
|
|
*/
|
|
$menu->route('admin.dashboard', trans('admin/mainMenu.dashboard'), [], 10, ['icon' => 'fa fa-dashboard']);
|
|
$menu->dropdown(trans('admin/mainMenu.userManagement'), function($sub) {
|
|
$sub->route('users.new', trans('admin/mainMenu.newUser'), [], 10, ['icon' => 'fa fa-user-plus']);
|
|
$sub->route('users.detail', trans('admin/mainMenu.userDetail'), [], 20, ['icon' => 'fa fa-user']);
|
|
$sub->route('users.overview', trans('admin/mainMenu.usersOverview'), [], 30, ['icon' => 'fa fa-users']);
|
|
|
|
}, 20, ['icon' => 'fa fa-users']);
|
|
$menu->dropdown(trans('admin/mainMenu.fileManager'), function ($sub) {
|
|
$sub->route('upload.file', trans('admin/mainMenu.uploadFile'), [], 10, ['icon' => 'fa fa-file']);
|
|
$sub->route('upload.image', trans('admin/mainMenu.uploadImage'), [], 50, ['icon' => 'fa fa-image']);
|
|
$sub->route('upload.overview', trans('admin/mainMenu.uploadedFiles'), [], 150, ['icon' => 'fa fa-files-o']);
|
|
}, 25, ['icon' => 'fa fa-film']);
|
|
$menu->dropdown(trans('admin/mainMenu.widgets'), function ($sub) {
|
|
// create list of all widget types
|
|
$sub->dropdown(trans('admin/mainMenu.newWidget'), function ($sub) {
|
|
$i = 1;
|
|
foreach (WidgetTypes::getWithTranslations() as $type => $name) {
|
|
$sub->route('widgets.new', $name, ['type' => $type], $i++);
|
|
}
|
|
}, 10, ['icon' => 'fa fa-plus']);
|
|
|
|
// menu for widget areas
|
|
$sub->dropdown(trans('admin/mainMenu.widgetAreas'), function ($sub) {
|
|
$sub->route('widgetareas.new', trans('admin/mainMenu.newWidgetArea'), [], 1, ['icon' => 'fa fa-plus']);
|
|
$sub->route('widgetareas.overview', trans('admin/mainMenu.widgetAreaOverview'), [], 2, ['icon' => 'fa fa-list']);
|
|
}, 50, ['icon' => 'fa fa-object-group']);
|
|
}, 28, ['icon' => 'fa fa-gears']);
|
|
$menu->dropdown(trans('admin/mainMenu.customFields'), function ($sub) {
|
|
$sub->route('customfields.new', trans('admin/mainMenu.customFieldsNew'), [], 10, ['icon' => 'fa fa-code']);
|
|
$sub->route('customfields.overview', trans('admin/mainMenu.customFieldsOverview'), [], 50, ['icon' => 'fa fa-code-fork']);
|
|
}, 30, ['icon' => 'fa fa-code']);
|
|
$menu->route('log.overview', trans('admin/mainMenu.actionLog'), [], 40, ['icon' => 'fa fa-history']);
|
|
$menu->url('#', trans('admin/mainMenu.settings'), 50, ['icon' => 'fa fa-gear']);
|
|
|
|
});
|
|
|
|
// order
|
|
|
|
// create menu with user profile
|
|
\Menu::create('profileMenu', function ($menu) {
|
|
$menu->route('users.detail', trans('admin/userManagement.profile'));
|
|
$menu->route('logout', trans('admin/common.logout'));
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Register the application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register()
|
|
{
|
|
}
|
|
}
|