From 6899dd4a400f13f8caa53f3acd5a4ee7401ce8c6 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 12 Dec 2023 19:00:45 +0100 Subject: [PATCH] wip #6570 @4 --- app/Console/Commands/ToolboxMenuGenerate.php | 85 ++++ composer.json | 2 +- composer.lock | 67 ++-- config/backpack/_base.php | 366 ------------------ config/backpack/menu.php | 59 +++ config/backpack/theme-tabler.php | 169 ++++++++ config/backpack/ui.php | 21 +- config/debugbar.php | 4 +- .../views/toolbox/inc/menu_items.blade.php | 112 ++++++ .../_horizontal/header_container.blade.php | 13 + resources/views/tools/sidebar.blade.php | 51 --- .../vendor/backpack/ui/inc/head.blade.php | 7 - .../backpack/ui/inc/menu_items.blade.php | 201 +--------- 13 files changed, 501 insertions(+), 656 deletions(-) create mode 100644 app/Console/Commands/ToolboxMenuGenerate.php delete mode 100644 config/backpack/_base.php create mode 100644 config/backpack/menu.php create mode 100644 config/backpack/theme-tabler.php create mode 100644 resources/views/toolbox/inc/menu_items.blade.php create mode 100644 resources/views/toolbox/layouts/_horizontal/header_container.blade.php delete mode 100644 resources/views/tools/sidebar.blade.php diff --git a/app/Console/Commands/ToolboxMenuGenerate.php b/app/Console/Commands/ToolboxMenuGenerate.php new file mode 100644 index 000000000..4d5c4c80c --- /dev/null +++ b/app/Console/Commands/ToolboxMenuGenerate.php @@ -0,0 +1,85 @@ +render($item); + } + file_put_contents(resource_path('views/toolbox/inc/menu_items.blade.php'), $res); + Artisan::call('view:cache'); + } + + protected function render($item, $level = 0, $type = "menu-item") + { + if ($item === '----') { + return; + return str_repeat("\t", $level) . '' . "\n"; + } + $res = ''; + $can = $this->getCan($item); + $litem = $level; + if ($can) { + $litem = $level + 1; + $res .= str_repeat("\t", $level) . $can . "\n"; + } + if (isset($item['items'])) { + $res .= str_repeat("\t", $litem) . '' . "\n"; + foreach ($item['items'] as $i) { + $res .= $this->render($i, $litem + 1, 'menu-dropdown-item'); + } + $res .= str_repeat("\t", $litem) . '' . "\n"; + } else { + $res .= str_repeat("\t", $litem) . '' . "\n"; + } + if ($can) { + $res .= str_repeat("\t", $level) . '@endcan' . "\n"; + } + + return $res; + } + + protected function getCan($item) + { + $can = []; + if (isset($item['can'])) { + if (is_string($item['can'])) { + $can = [$item['can']]; + } else { + $can = $item['can']; + } + } else if (isset($item['items'])) { + foreach ($item['items'] as $i) { + if (isset($i['can'])) { + if (is_string($i['can'])) { + $can[] = $i['can']; + } else { + $can = array_merge($can, $i['can']); + } + } + } + } + if (empty($can)) { + return false; + } else if (count($can) > 1) { + return "@canany('" . json_encode($can) . "')"; + } else { + return "@can('" . $can[0] . "')"; + } + } +} diff --git a/composer.json b/composer.json index f3445b337..a53994d12 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ "ext-tidy": "*", "ext-zip": "*", "ext-zlib": "*", - "backpack/theme-coreuiv2": "^1.2.2", + "backpack/theme-tabler": "^1.1.2", "cubedesigners/userdatabase": "dev-backpack6", "cubist/azuretts": "dev-master", "cubist/cms-back": "dev-backpack6", diff --git a/composer.lock b/composer.lock index 245160b69..55bdcef52 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "64181a0ad6d783b9c2d635650850c694", + "content-hash": "602600518e723efd92de27b1d355083b", "packages": [ { "name": "archtechx/enums", @@ -545,17 +545,17 @@ "time": "2023-07-01T06:33:51+00:00" }, { - "name": "backpack/theme-coreuiv2", - "version": "1.2.2", + "name": "backpack/theme-tabler", + "version": "1.1.2", "source": { "type": "git", - "url": "https://github.com/Laravel-Backpack/theme-coreuiv2.git", - "reference": "be5efa1d033a2a4bd7da1d66d143c3ea8989c903" + "url": "https://github.com/Laravel-Backpack/theme-tabler.git", + "reference": "840fa54b74cbeb8a5d737edcfc958656a523e61f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Laravel-Backpack/theme-coreuiv2/zipball/be5efa1d033a2a4bd7da1d66d143c3ea8989c903", - "reference": "be5efa1d033a2a4bd7da1d66d143c3ea8989c903", + "url": "https://api.github.com/repos/Laravel-Backpack/theme-tabler/zipball/840fa54b74cbeb8a5d737edcfc958656a523e61f", + "reference": "840fa54b74cbeb8a5d737edcfc958656a523e61f", "shasum": "" }, "require": { @@ -567,15 +567,18 @@ }, "type": "library", "extra": { + "branch-alias": { + "dev-main": "1.0.x-dev" + }, "laravel": { "providers": [ - "Backpack\\ThemeCoreuiv2\\AddonServiceProvider" + "Backpack\\ThemeTabler\\AddonServiceProvider" ] } }, "autoload": { "psr-4": { - "Backpack\\ThemeCoreuiv2\\": "src/" + "Backpack\\ThemeTabler\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -583,26 +586,36 @@ "MIT" ], "authors": [ + { + "name": "Mauro Martinez", + "email": "maurohmartinez@gmail.com", + "homepage": "https://backpackforlaravel.com" + }, { "name": "Cristian Tabacitu", "email": "hello@backpackforlaravel.com", "homepage": "https://backpackforlaravel.com" + }, + { + "name": "Antonio Almeida", + "email": "promatik@gmail.com", + "homepage": "https://backpackforlaravel.com" } ], - "description": "UI that uses CoreUI v2 and Bootstrap v4, provided as a legacy theme for Backpack v6.", - "homepage": "https://github.com/backpack/theme-coreuiv2", + "description": "UI for Backpack v6 that uses Tabler and Bootstrap v5.", + "homepage": "https://github.com/backpack/theme-tabler", "keywords": [ "Backpack Addon", "Backpack for Laravel", - "ThemeCoreuiv2", + "ThemeTabler", "backpack", "laravel" ], "support": { - "issues": "https://github.com/Laravel-Backpack/theme-coreuiv2/issues", - "source": "https://github.com/Laravel-Backpack/theme-coreuiv2/tree/1.2.2" + "issues": "https://github.com/Laravel-Backpack/theme-tabler/issues", + "source": "https://github.com/Laravel-Backpack/theme-tabler/tree/1.1.2" }, - "time": "2023-10-11T11:14:19+00:00" + "time": "2023-11-29T16:24:09+00:00" }, { "name": "bacon/bacon-qr-code", @@ -1122,16 +1135,16 @@ }, { "name": "carbonphp/carbon-doctrine-types", - "version": "2.0.0", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/CarbonPHP/carbon-doctrine-types.git", - "reference": "67a77972b9f398ae7068dabacc39c08aeee170d5" + "reference": "99f76ffa36cce3b70a4a6abce41dba15ca2e84cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/CarbonPHP/carbon-doctrine-types/zipball/67a77972b9f398ae7068dabacc39c08aeee170d5", - "reference": "67a77972b9f398ae7068dabacc39c08aeee170d5", + "url": "https://api.github.com/repos/CarbonPHP/carbon-doctrine-types/zipball/99f76ffa36cce3b70a4a6abce41dba15ca2e84cb", + "reference": "99f76ffa36cce3b70a4a6abce41dba15ca2e84cb", "shasum": "" }, "require": { @@ -1171,7 +1184,7 @@ ], "support": { "issues": "https://github.com/CarbonPHP/carbon-doctrine-types/issues", - "source": "https://github.com/CarbonPHP/carbon-doctrine-types/tree/2.0.0" + "source": "https://github.com/CarbonPHP/carbon-doctrine-types/tree/2.1.0" }, "funding": [ { @@ -1187,7 +1200,7 @@ "type": "tidelift" } ], - "time": "2023-10-01T14:29:01+00:00" + "time": "2023-12-11T17:09:12+00:00" }, { "name": "chillerlan/php-qrcode", @@ -1775,13 +1788,13 @@ "source": { "type": "git", "url": "git://git.cubedesigners.com/cubist_cms-back.git", - "reference": "be21c6e3e3391a77bba673d7990888be2d9b2830" + "reference": "7266c5e29b8f3b57281ad8ac7130d854fa2b6ade" }, "dist": { "type": "tar", - "url": "https://composer.cubedesigners.com/dist/cubist/cms-back/cubist-cms-back-dev-backpack6-2947b8.tar", - "reference": "be21c6e3e3391a77bba673d7990888be2d9b2830", - "shasum": "d3362611fdab156076a880f1288b748b80a01d23" + "url": "https://composer.cubedesigners.com/dist/cubist/cms-back/cubist-cms-back-dev-backpack6-92d3f4.tar", + "reference": "7266c5e29b8f3b57281ad8ac7130d854fa2b6ade", + "shasum": "c19880fe49129b2d781c41dc783cc3e0a0d7deb9" }, "require": { "backpack/backupmanager": "^v5.0.0", @@ -1858,7 +1871,7 @@ } ], "description": "Cubist Backpack extension", - "time": "2023-12-11T17:20:44+00:00" + "time": "2023-12-12T07:51:20+00:00" }, { "name": "cubist/cms-front", @@ -17114,5 +17127,5 @@ "ext-zlib": "*" }, "platform-dev": [], - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.1.0" } diff --git a/config/backpack/_base.php b/config/backpack/_base.php deleted file mode 100644 index 2a06c6ed6..000000000 --- a/config/backpack/_base.php +++ /dev/null @@ -1,366 +0,0 @@ - 'D MMM YYYY', - 'default_datetime_format' => 'D MMM YYYY, HH:mm', - - // Direction, according to language - // (left-to-right vs right-to-left) - 'html_direction' => 'ltr', - - // ---- - // HEAD - // ---- - - // Project name. Shown in the window title. - 'project_name' => env('APP_NAME'), - - // When clicking on the admin panel's top-left logo/name, - // where should the user be redirected? - // The string below will be passed through the url() helper. - // - default: '' (project root) - // - alternative: 'admin' (the admin's dashboard) - 'home_link' => '', - - // Content of the HTML meta robots tag to prevent indexing and link following - 'meta_robots_content' => 'noindex, nofollow', - - // --------- - // DASHBOARD - // --------- - - // Show "Getting Started with Backpack" info block? - 'show_getting_started' => env('APP_ENV') == 'local', - - // ------ - // STYLES - // ------ - - // CSS files that are loaded in all pages, using Laravel's asset() helper - 'styles' => [ - 'packages/backpack/base/css/bundle.css', - 'packages/featherlight/featherlight.min.css', - 'packages/featherlight/featherlight.gallery.min.css', - 'packages/fluidbook/toolbox/css/style.css', - 'packages/fluidbook/toolbox/css/loader.css', - - 'https://cdnjs.cloudflare.com/ajax/libs/jquery-contextmenu/2.9.2/jquery.contextMenu.min.css', - 'https://cdnjs.cloudflare.com/ajax/libs/sweetalert2/11.7.3/sweetalert2.min.css', - 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/css/select2.min.css', - 'https://cdnjs.cloudflare.com/ajax/libs/select2-bootstrap-theme/0.1.0-beta.10/select2-bootstrap.min.css', - - // Here's what's inside the bundle: - // 'packages/@digitallyhappy/backstrap/css/style.min.css', - // 'packages/animate.css/animate.min.css', - // 'packages/noty/noty.css', - - // Load the fonts separately (so that you can replace them at will): - 'packages/source-sans-pro/source-sans-pro.css', - 'packages/line-awesome/css/line-awesome.min.css', - - // Example (the fonts above, loaded from CDN instead) - // 'https://maxcdn.icons8.com/fonts/line-awesome/1.1/css/line-awesome-font-awesome.min.css', - // 'https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic', - - // Example (load font-awesome instead of line-awesome): - // 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.2/css/all.min.css', - - ], - - // CSS files that are loaded in all pages, using Laravel's mix() helper - 'mix_styles' => [ // file_path => manifest_directory_path - // 'css/app.css' => '', - ], - - // CSS files that are loaded in all pages, using Laravel's @vite() helper - // Please note that support for Vite was added in Laravel 9.19. Earlier versions are not able to use this feature. - 'vite_styles' => [ // resource file_path - // 'resources/css/app.css', - ], - - // ------ - // HEADER - // ------ - - // Menu logo. You can replace this with an tag if you have a logo. - 'project_logo' => ''.env('APP_NAME').'', - - // Show / hide breadcrumbs on admin panel pages. - 'breadcrumbs' => true, - - // Horizontal navbar classes. Helps make the admin panel look similar to your project's design. - 'header_class' => 'app-header border-0 navbar navbar-color', - // For background colors use: bg-dark, bg-primary, bg-secondary, bg-danger, bg-warning, bg-success, bg-info, bg-blue, bg-light-blue, bg-indigo, bg-purple, bg-pink, bg-red, bg-orange, bg-yellow, bg-green, bg-teal, bg-cyan, bg-white - // For links to be visible on different background colors use: "navbar-dark", "navbar-light", "navbar-color" - - // ---- - // BODY - // ---- - - // Body element classes. - 'body_class' => 'app aside-menu-fixed sidebar-lg-show skin-blue', - // Try sidebar-hidden, sidebar-fixed, sidebar-compact, sidebar-lg-show - - // Sidebar element classes. - 'sidebar_class' => 'sidebar sidebar-pills bg-light', - // Remove "sidebar-transparent" for standard sidebar look - // Try "sidebar-light" or "sidebar-dark" for dark/light links - // You can also add a background class like bg-dark, bg-primary, bg-secondary, bg-danger, bg-warning, bg-success, bg-info, bg-blue, bg-light-blue, bg-indigo, bg-purple, bg-pink, bg-red, bg-orange, bg-yellow, bg-green, bg-teal, bg-cyan - - // ------ - // FOOTER - // ------ - - // Footer element classes. - 'footer_class' => 'app-footer d-print-none', - // hide it with d-none - // change background color with bg-dark, bg-primary, bg-secondary, bg-danger, bg-warning, bg-success, bg-info, bg-blue, bg-light-blue, bg-indigo, bg-purple, bg-pink, bg-red, bg-orange, bg-yellow, bg-green, bg-teal, bg-cyan, bg-white - - // Developer or company name. Shown in footer. - 'developer_name' => 'Fluidbook', - - // Developer website. Link in footer. Type false if you want to hide it. - 'developer_link' => env('POWERED_BY_LINK','https://www.fluidbook.com'), - - // Show powered by Laravel Backpack in the footer? true/false - 'show_powered_by' => false, - - // ------- - // SCRIPTS - // ------- - - // JS files that are loaded in all pages, using Laravel's asset() helper - 'scripts' => [ - // Backstrap includes jQuery, Bootstrap, CoreUI, PNotify, Popper - 'packages/backpack/base/js/bundle.js', - 'packages/featherlight/featherlight.min.js', - 'packages/featherlight/featherlight.gallery.min.js', - 'packages/fluidbook/toolbox/js/bundle.js', - 'packages/fluidbook/toolbox/js/contextdownload.js', - - 'https://cdnjs.cloudflare.com/ajax/libs/jquery.form/4.3.0/jquery.form.min.js', - "https://cdnjs.cloudflare.com/ajax/libs/jquery-contextmenu/2.9.2/jquery.contextMenu.min.js", - "https://cdnjs.cloudflare.com/ajax/libs/jquery-contextmenu/2.9.2/jquery.ui.position.min.js", - 'https://cdnjs.cloudflare.com/ajax/libs/gsap/3.11.4/gsap.min.js', - 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.min.js', - 'https://cdnjs.cloudflare.com/ajax/libs/sweetalert2/11.7.3/sweetalert2.all.js', - - // examples (everything inside the bundle, loaded from CDN) - // 'https://code.jquery.com/jquery-3.4.1.min.js', - // 'https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js', - // 'https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js', - // 'https://unpkg.com/@coreui/coreui@2.1.16/dist/js/coreui.min.js', - // 'https://cdnjs.cloudflare.com/ajax/libs/pace/1.0.2/pace.min.js', - // 'https://unpkg.com/sweetalert/dist/sweetalert.min.js', - // 'https://cdnjs.cloudflare.com/ajax/libs/noty/3.1.4/noty.min.js' - - // examples (VueJS or React) - // 'https://unpkg.com/vue@2.4.4/dist/vue.min.js', - // 'https://unpkg.com/react@16/umd/react.production.min.js', - // 'https://unpkg.com/react-dom@16/umd/react-dom.production.min.js', - ], - - // JS files that are loaded in all pages, using Laravel's mix() helper - 'mix_scripts' => [// file_path => manifest_directory_path - // 'js/app.js' => '', - ], - - // JS files that are loaded in all pages, using Laravel's @vite() helper - 'vite_scripts' => [ // resource file_path - // 'resources/js/app.js', - ], - - /* - |-------------------------------------------------------------------------- - | Registration Open - |-------------------------------------------------------------------------- - | - | Choose whether new users/admins are allowed to register. - | This will show the Register button on the login page and allow access to the - | Register functions in AuthController. - | - | By default the registration is open only on localhost. - */ - - 'registration_open' => env('BACKPACK_REGISTRATION_OPEN', env('APP_ENV') === 'local'), - - /* - |-------------------------------------------------------------------------- - | Routing - |-------------------------------------------------------------------------- - */ - - // The prefix used in all base routes (the 'admin' in admin/dashboard) - // You can make sure all your URLs use this prefix by using the backpack_url() helper instead of url() - 'route_prefix' => '', - - // The web middleware (group) used in all base & CRUD routes - // If you've modified your "web" middleware group (ex: removed sessions), you can use a different - // route group, that has all the the middleware listed below in the comments. - 'web_middleware' => 'web', - // Or you can comment the above, and uncomment the complete list below. - // 'web_middleware' => [ - // \App\Http\Middleware\EncryptCookies::class, - // \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, - // \Illuminate\Session\Middleware\StartSession::class, - // \Illuminate\View\Middleware\ShareErrorsFromSession::class, - // \App\Http\Middleware\VerifyCsrfToken::class, - // ], - - // Set this to false if you would like to use your own AuthController and PasswordController - // (you then need to setup your auth routes manually in your routes.php file) - // Warning: if you disable this, the password recovery routes (below) will be disabled too! - 'setup_auth_routes' => true, - - // Set this to false if you would like to skip adding the dashboard routes - // (you then need to overwrite the login route on your AuthController) - 'setup_dashboard_routes' => true, - - // Set this to false if you would like to skip adding "my account" routes - // (you then need to manually define the routes in your web.php) - 'setup_my_account_routes' => true, - - // Set this to false if you would like to skip adding the password recovery routes - // (you then need to manually define the routes in your web.php) - 'setup_password_recovery_routes' => true, - - /* - |-------------------------------------------------------------------------- - | Security - |-------------------------------------------------------------------------- - */ - - // Backpack will prevent visitors from requesting password recovery too many times - // for a certain email, to make sure they cannot be spammed that way. - // How many seconds should a visitor wait, after they've requested a - // password reset, before they can try again for the same email? - 'password_recovery_throttle_notifications' => 600, // time in seconds - - // How much time should the token sent to the user email be considered valid? - // After this time expires, user needs to request a new reset token. - 'password_recovery_token_expiration' => 60, // time in minutes - - // Backpack will prevent an IP from trying to reset the password too many times, - // so that a malicious actor cannot try too many emails, too see if they have - // accounts or to increase the AWS/SendGrid/etc bill. - // - // How many times in any given time period should the user be allowed to - // attempt a password reset? Take into account that user might wrongly - // type an email at first, so at least allow one more try. - // Defaults to 3,10 - 3 times in 10 minutes. - 'password_recovery_throttle_access' => '3,10', - - /* - |-------------------------------------------------------------------------- - | Authentication - |-------------------------------------------------------------------------- - */ - - // Fully qualified namespace of the User model - 'user_model_fqn' => App\Models\AuthUser::class, - - // The classes for the middleware to check if the visitor is an admin - // Can be a single class or an array of classes - 'middleware_class' => [ - App\Http\Middleware\CheckIfAdmin::class, - \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, - \Backpack\CRUD\app\Http\Middleware\UseBackpackAuthGuardInsteadOfDefaultAuthGuard::class, - ], - - // Alias for that middleware - 'middleware_key' => 'admin', - // Note: It's recommended to use the backpack_middleware() helper everywhere, which pulls this key for you. - - // Username column for authentication - // The Backpack default is the same as the Laravel default (email) - // If you need to switch to username, you also need to create that column in your db - 'authentication_column' => 'email', - 'authentication_column_name' => 'Email', - - // Backpack assumes that your "database email column" for operations like Login and Register is called "email". - // If your database email column have a different name, you can configure it here. Eg: `user_mail` - 'email_column' => 'email', - - // The guard that protects the Backpack admin panel. - // If null, the config.auth.defaults.guard value will be used. - 'guard' => 'backpack', - - // The password reset configuration for Backpack. - // If null, the config.auth.defaults.passwords value will be used. - 'passwords' => 'backpack', - - // What kind of avatar will you like to show to the user? - // Default: gravatar (automatically use the gravatar for their email) - // Other options: - // - null (generic image with their first letter) - // - example_method_name (specify the method on the User model that returns the URL) - 'avatar_type' => 'avatar', - - /* - |-------------------------------------------------------------------------- - | Theme (User Interface) - |-------------------------------------------------------------------------- - */ - // Change the view namespace in order to load a different theme than the one Backpack provides. - // You can create child themes yourself, by creating a view folder anywhere in your resources/views - // and choosing that view_namespace instead of the default one. Backpack will load a file from there - // if it exists, otherwise it will load it from the default namespace ("backpack::"). - - 'view_namespace' => 'backpack::', - - // EXAMPLE: if you create a new folder in resources/views/vendor/myname/mypackage, - // your namespace would be the one below. IMPORTANT: in this case the namespace ends with a dot. - // 'view_namespace' => 'vendor.myname.mypackage.', - - // Tell Backpack to look in more places for component views (like widgets) - 'component_view_namespaces' => [ - 'widgets' => [ - 'backpack::widgets', // falls back to 'resources/views/vendor/backpack/base/widgets' - ], - ], - - /* - |-------------------------------------------------------------------------- - | File System - |-------------------------------------------------------------------------- - */ - - // Backpack\Base sets up its own filesystem disk, just like you would by - // adding an entry to your config/filesystems.php. It points to the root - // of your project and it's used throughout all Backpack packages. - // - // You can rename this disk here. Default: root - 'root_disk_name' => 'root', - - /* - |-------------------------------------------------------------------------- - | Backpack Token Username - |-------------------------------------------------------------------------- - | - | If you have access to closed-source Backpack add-ons, please provide - | your token username here, if you're getting yellow alerts on your - | admin panel's pages. Normally this is not needed, it is - | preferred to add this as an environment variable - | (most likely in your .env file). - | - | More info and payment form on: - | https://www.backpackforlaravel.com - | - */ - - 'token_username' => env('BACKPACK_TOKEN_USERNAME', false), - - 'locales' => explode(',', env('BACKPACK_LOCALES', 'en')), -]; diff --git a/config/backpack/menu.php b/config/backpack/menu.php new file mode 100644 index 000000000..9ceb1e6cf --- /dev/null +++ b/config/backpack/menu.php @@ -0,0 +1,59 @@ + [ + ['label' => 'Tableau de bord', 'icon' => 'la la-dashboard', 'url' => 'dashboard'], + ['label' => 'Notifications', 'icon' => 'la la-bell', 'url' => 'tasks'], + ['label' => 'Partage de fichiers', 'icon' => 'las la-cloud', 'url' => 'file', 'can' => 'files:read'], + ['label' => 'e-Learning', 'icon' => 'la la-chalkboard-teacher', 'section' => 'elearning', 'items' => [ + ['label' => 'Quiz', 'icon' => 'la la-question', 'url' => 'quiz', 'can' => 'quiz:read'], + ['label' => 'Thèmes', 'icon' => 'la la-palette', 'url' => 'quiz-theme', 'can' => 'quiz-theme:read'], + '----', + ['label' => 'Media', 'icon' => 'la la-photo-video', 'url' => 'elearning-media', 'can' => 'elearning-media:read'], + ['label' => 'Package', 'icon' => 'la la-cubes', 'url' => 'elearning-package', 'can' => 'elearning-package:read'], + ['label' => 'Traductions', 'icon' => 'la la-language', 'url' => 'elearning-translate', 'can' => 'quiztranslation:read'], + ]], + ['label' => 'Fluidbook', 'icon' => '/images/icons/icon-fluidbook.svg', 'section' => 'fluidbook', 'items' => [ + ['label' => 'Publications', 'icon' => 'la la-book-reader', 'url' => 'fluidbook-publication', 'can' => 'fluidbook-publication:read'], + ['label' => 'Thème', 'icon' => 'la la-palette', 'url' => 'fluidbook-theme', 'can' => 'fluidbook-theme:read'], + ['label' => 'Jeux d\'icônes', 'icon' => 'la la-icons', 'url' => 'fluidbook-iconset', 'can' => 'fluidbook-iconset:read'], + ['label' => 'Collections', 'icon' => 'la la-university', 'url' => 'fluidbook-collection', 'can' => 'fluidbook-collection:read'], + ['label' => 'Traductions', 'icon' => 'la la-language', 'url' => 'fluidbook-translate/1/edit/?_locale=en', 'can' => 'fluidbook-translate:write'], + ['label' => 'Signatures', 'icon' => 'la la-signature', 'url' => 'fluidbook-signature', 'can' => 'fluidbook-signature:read'], + ['label' => 'Serveurs externes', 'icon' => 'la la-server', 'url' => 'fluidbook-external-install-server', 'can' => 'fluidbook-external-install-server:read'], + ['label' => 'Demandes de devis', 'icon' => 'la la-wpforms', 'url' => 'fluidbook-quote', 'can' => 'fluidbook-quote:read'], + ]], + ['label' => 'Outils', 'icon' => 'la la-tools', 'section' => 'tools', 'can' => 'tools', 'items' => [ + ['url' => 'opentools/pdf2svg', 'icon' => 'nav-icon la la-images', 'label' => 'Conversion de PDF en images'], + ['url' => 'tools/resizer', 'icon' => 'las la-compress-arrows-alt', 'label' => 'Redimensionner des images'], + ['url' => 'tools/fluidbookassetsdownloader', 'icon' => 'las la-cloud-download-alt', 'label' => 'Téléchargement massif d\'assets dans un fluidbook'], + ['url' => 'tools/gitreposcreate', 'icon' => 'la la-git', 'label' => 'Créer un répertoire GIT'], + ['url' => 'tools/dockerwebcontainer', 'icon' => 'lab la-docker', 'label' => 'Créer un container web'], + ['url' => 'tools/tts', 'icon' => 'la la-volume-up', 'label' => 'Text to speech'], + ['url' => 'tools/json2excel', 'icon' => 'la la-file-excel', 'label' => 'JSON to Excel'], + ['url' => 'opentools/excel2json', 'icon' => 'las la-code', 'label' => 'Excel to JSON'], + ['url' => 'tools/fluidbookcopylinks', 'icon' => 'las la-link', 'label' => 'Copier les liens ou assets d\'un fluidbook'], + ['url' => 'tools/fluidbookbranchcreate', 'icon' => 'la la-git', 'label' => 'Créer une branche du player fluidbook'], + ['url' => 'tools/fluidbookbranchremove', 'icon' => 'la la-git', 'label' => 'Supprimer une branche du player fluidbook'], + ['url' => 'tools/fluidbookrefurl', 'icon' => 'las la-link', 'label' => 'Importer des bases de données de références fluidbook'], + ['url' => 'tools/favicongen', 'icon' => 'las la-icons', 'label' => 'Générer des favicons'], + ['url' => 'tool-sprite', 'icon' => 'las la-marker', 'label' => 'SVG Sprites'], + ['url' => 'opentools/sasscompiler', 'icon' => 'lab la-sass', 'label' => 'Compileur SASS'], + ['url' => 'tools/svgcleaner', 'icon' => 'la la-broom', 'label' => 'Nettoyer un SVG'], + ]], + ['label' => 'Clients', 'icon' => 'la la-group', 'section' => 'users', 'items' => [ + ['label' => 'Clients', 'icon' => 'la la-building', 'url' => 'company', 'can' => 'company:read'], + ['label' => 'Utilisateurs', 'icon' => 'la la-user-lock', 'url' => 'users', 'can' => 'company:read'], + ['label' => 'Rôles', 'icon' => 'la la-group', 'url' => 'role', 'can' => 'managerolesandpersmissions'], + ['label' => 'Permissions', 'icon' => 'la la-key', 'url' => 'permission', 'can' => 'managerolesandpersmissions'], + ]], + ['label' => 'Équipe', 'icon' => 'la la-mug-hot', 'section' => 'team', 'items' => [ + ['label' => 'Emails', 'icon' => 'la la-mail-bulk', 'url' => 'team-emails', 'can' => 'extranet:manage_emails'], + ['label' => 'Serveurs', 'icon' => 'la la-server', 'url' => 'team-servers', 'can' => 'extranet:manage_servers'], + ['label' => 'Bulletins de salaire', 'icon' => 'la la-file-invoice-dollar', 'url' => 'team-pay', 'can' => 'team-pay:read'], + ['label' => 'Heures supp', 'icon' => 'la la-stopwatch', 'url' => 'team-overtime', 'can' => 'team-overtime:read'], + ]], + ['label' => 'Administration', 'icon' => 'la la-cogs', 'section' => 'admin', 'items' => [ + ['label' => 'Traduction', 'icon' => 'la la-language', 'url' => 'toolbox-translate/1/edit/?_locale=en', 'can' => 'toolbox-translate:admin'], + ]], + ] +]; diff --git a/config/backpack/theme-tabler.php b/config/backpack/theme-tabler.php new file mode 100644 index 000000000..6c99b9bd2 --- /dev/null +++ b/config/backpack/theme-tabler.php @@ -0,0 +1,169 @@ + 'horizontal', + + /** + * Pick a login page layout. + * Possible values: default, illustration, cover + */ + 'auth_layout' => 'default', // default, illustration, cover + + /** + * Here you can easily load your own extra css styles. + * Note: if you want to customize the style to create your own custom skin colors: + * - make a copy of the file "vendor/backpack/theme-tabler/resources/assets/css/colors.css" into your project + * - adjust colors variables as you wish + * - replace "base_path('vendor/backpack/theme-tabler/resources/assets/css/colors.css')," with the path to the file created above + * - boom! + */ + 'styles' => [ + base_path('vendor/backpack/theme-tabler/resources/assets/css/color-adjustments.css'), + base_path('vendor/backpack/theme-tabler/resources/assets/css/colors.css'), + ], + + /** + * 2nd Layer of customization + * + * If you need to further customize the way your panel looks, + * these options will help you achieve that. + */ + 'options' => [ + /** + * The available color modes. + */ + 'colorModes' => [ + 'system' => 'la-desktop', + 'light' => 'la-sun', + 'dark' => 'la-moon', + ], + + /** + * The color mode used by default. + */ + 'defaultColorMode' => 'light', // system, light, dark + + /** + * When true, a switch is displayed to let admins choose their favorite theme mode. + * When false, the theme will only use the "defaultColorMode" set above. + * In case "defaultColorMode" is null, system is the default. + */ + 'showColorModeSwitcher' => false, + + /** + * Fix the top-header component (present in "vertical_transparent") and the menu when the layout type is set as "horizontal". + * This value is skipped when the layout type is horizontal-overlap, using false as default. + */ + 'useStickyHeader' => false, + + /** + * When true, the content area will take the whole screen width. + */ + 'useFluidContainers' => false, + + /** + * When true, the sidebar content for vertical layouts will not scroll with the rest of the content. + */ + 'sidebarFixed' => false, + + /** + * When true, horizontal layouts will display the classic top bar on top to free some space when multiple nav items are used. + */ + 'doubleTopBarInHorizontalLayouts' => true, + ], + + /** + * 3rd Layer of customization + * + * In case the first two steps were not enough, here you have full control over + * the classes that make up the look of your panel. + */ + 'classes' => [ + /** + * Use this to pass classes to the HTML element, on all pages. + */ + 'body' => null, + + /** + * For background colors use: + * bg-dark, bg-primary, bg-secondary, bg-danger, bg-warning, bg-success, bg-info, bg-blue, bg-light-blue, + * bg-indigo, bg-purple, bg-pink, bg-red, bg-orange, bg-yellow, bg-green, bg-teal, bg-cyan, bg-white. + * + * For links to be visible on different background colors use: "navbar-dark", "navbar-light". + * + */ + 'topHeader' => null, + + /** + * Applies only for Vertical Menu Layout + * For standard sidebar look (transparent): + * - Remove "navbar-dark/light" + * - Remove "navbar-light/dark" from 'classes.topHeader' and instead use "bg-light" + * You can also add a background class like bg-dark, bg-primary, bg-secondary, bg-danger, bg-warning, bg-success, + * bg-info, bg-blue, bg-light-blue, bg-indigo, bg-purple, bg-pink, bg-red, bg-orange, bg-yellow, bg-green, bg-teal, bg-cyan + */ + 'sidebar' => null, + + /** + * Used in the top container menu when the layout is of horizontal type. + */ + 'menuHorizontalContainer' => null, + + /** + * Used in the top menu content when the layout is of horizontal type. + */ + 'menuHorizontalContent' => null, + + /** + * Make transparent with footer-transparent. + * Hide it with d-none. + * + * Change background color with bg-dark, bg-primary, bg-secondary, bg-danger, bg-warning, bg-success, bg-info, + * bg-blue, bg-light-blue, bg-indigo, bg-purple, bg-pink, bg-red, bg-orange, bg-yellow, bg-green, bg-teal, bg-cyan, bg-white. + */ + 'footer' => null, + + /** + * Use this to pass classes to the table displayed in List Operation + * It defaults to: "table table-striped table-hover nowrap rounded card-table table-vcenter card-table shadow-xs border-xs" + */ + 'table' => null, + + /** + * Use this to pass classes to the table wrapper component displayed in List Operation + */ + 'tableWrapper' => null, + ], + + /** + * 4th Layer of customization + * + * Alright, if nothing so far met your need, then you still have an easy way to build + * a custom layout using the already existing components of this theme. + * + * 1. Create a new blade file in resources/views/layouts/your-custom-layout.blade.php + * 2. Replace the value of layout on this file with "your-custom-layout" + * 3. Customize the blade and place components such as sidebar, header, top-bar, where you need them! + */ +]; diff --git a/config/backpack/ui.php b/config/backpack/ui.php index 1b18900a3..e44444c1d 100644 --- a/config/backpack/ui.php +++ b/config/backpack/ui.php @@ -18,8 +18,9 @@ return [ // and choosing that view_namespace instead of the default one. Backpack will load a file from there // if it exists, otherwise it will load it from the fallback namespace. - 'view_namespace' => 'backpack.theme-coreuiv2::', - 'view_namespace_fallback' => 'backpack.theme-coreuiv2::', + 'view_namespace' => 'toolbox.', + 'view_namespace_fallback' => 'backpack.theme-tabler::', + /* |-------------------------------------------------------------------------- @@ -34,7 +35,7 @@ return [ */ // Date & Datetime Format Syntax: https://carbon.nesbot.com/docs/#api-localization - 'default_date_format' => 'D MMM YYYY', + 'default_date_format' => 'D MMM YYYY', 'default_datetime_format' => 'D MMM YYYY, HH:mm', // Direction, according to language @@ -63,23 +64,23 @@ return [ 'home_link' => '', // Menu logo. You can replace this with an tag if you have a logo. - 'project_logo' => 'Backpack', + 'project_logo' => '' . env('APP_NAME') . '', // Show / hide breadcrumbs on admin panel pages. - 'breadcrumbs' => true, + 'breadcrumbs' => false, // ------ // FOOTER // ------ // Developer or company name. Shown in footer. - 'developer_name' => 'Cristian Tabacitu', + 'developer_name' => 'Fluidbook', // Developer website. Link in footer. Type false if you want to hide it. - 'developer_link' => 'http://tabacitu.ro', + 'developer_link' => env('POWERED_BY_LINK', 'https://www.fluidbook.com'), // Show powered by Laravel Backpack in the footer? true/false - 'show_powered_by' => true, + 'show_powered_by' => false, // --------- // DASHBOARD @@ -147,9 +148,9 @@ return [ 'https://cdnjs.cloudflare.com/ajax/libs/jquery.form/4.3.0/jquery.form.min.js', "https://cdnjs.cloudflare.com/ajax/libs/jquery-contextmenu/2.9.2/jquery.contextMenu.min.js", "https://cdnjs.cloudflare.com/ajax/libs/jquery-contextmenu/2.9.2/jquery.ui.position.min.js", - 'https://cdnjs.cloudflare.com/ajax/libs/gsap/3.11.4/gsap.min.js', + 'https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.3/gsap.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.min.js', - 'https://cdnjs.cloudflare.com/ajax/libs/sweetalert2/11.7.3/sweetalert2.all.js', + 'https://cdnjs.cloudflare.com/ajax/libs/sweetalert2/11.10.1/sweetalert2.all.js', // 'https://unpkg.com/vue@2.4.4/dist/vue.min.js', // 'https://unpkg.com/react@16/umd/react.production.min.js', // 'https://unpkg.com/react-dom@16/umd/react-dom.production.min.js', diff --git a/config/debugbar.php b/config/debugbar.php index 5284132ac..2e818ea28 100644 --- a/config/debugbar.php +++ b/config/debugbar.php @@ -160,7 +160,7 @@ return [ 'exceptions' => true, // Exception displayer 'log' => true, // Logs from Monolog (merged in messages if enabled) 'db' => true, // Show database (PDO) queries and bindings - 'views' => false, // Views with their data + 'views' => true, // Views with their data 'route' => true, // Current route information 'auth' => true, // Display Laravel authentication status 'gate' => true, // Display Laravel Gate checks @@ -209,7 +209,7 @@ return [ 'full_log' => false, ], 'views' => [ - 'timeline' => false, // Add the views to the timeline (Experimental) + 'timeline' => true, // Add the views to the timeline (Experimental) 'data' => false, //Note: Can slow down the application, because the data can be quite large.. 'exclude_paths' => [], // Add the paths which you don't want to appear in the views ], diff --git a/resources/views/toolbox/inc/menu_items.blade.php b/resources/views/toolbox/inc/menu_items.blade.php new file mode 100644 index 000000000..3cf3e20a7 --- /dev/null +++ b/resources/views/toolbox/inc/menu_items.blade.php @@ -0,0 +1,112 @@ + + +@can('files:read') + +@endcan +@canany('["quiz:read","quiz-theme:read","elearning-media:read","elearning-package:read","quiztranslation:read"]') + + @can('quiz:read') + + @endcan + @can('quiz-theme:read') + + @endcan + + @can('elearning-media:read') + + @endcan + @can('elearning-package:read') + + @endcan + @can('quiztranslation:read') + + @endcan + +@endcan +@canany('["fluidbook-publication:read","fluidbook-theme:read","fluidbook-iconset:read","fluidbook-collection:read","fluidbook-translate:write","fluidbook-signature:read","fluidbook-external-install-server:read","fluidbook-quote:read"]') + + @can('fluidbook-publication:read') + + @endcan + @can('fluidbook-theme:read') + + @endcan + @can('fluidbook-iconset:read') + + @endcan + @can('fluidbook-collection:read') + + @endcan + @can('fluidbook-translate:write') + + @endcan + @can('fluidbook-signature:read') + + @endcan + @can('fluidbook-external-install-server:read') + + @endcan + @can('fluidbook-quote:read') + + @endcan + +@endcan +@can('tools') + + + + + + + + + + + + + + + + + + +@endcan +@canany('["company:read","company:read","managerolesandpersmissions","managerolesandpersmissions"]') + + @can('company:read') + + @endcan + @can('company:read') + + @endcan + @can('managerolesandpersmissions') + + @endcan + @can('managerolesandpersmissions') + + @endcan + +@endcan +@canany('["extranet:manage_emails","extranet:manage_servers","team-pay:read","team-overtime:read"]') + + @can('extranet:manage_emails') + + @endcan + @can('extranet:manage_servers') + + @endcan + @can('team-pay:read') + + @endcan + @can('team-overtime:read') + + @endcan + +@endcan +@can('toolbox-translate:admin') + + @can('toolbox-translate:admin') + + @endcan + +@endcan diff --git a/resources/views/toolbox/layouts/_horizontal/header_container.blade.php b/resources/views/toolbox/layouts/_horizontal/header_container.blade.php new file mode 100644 index 000000000..afda756ff --- /dev/null +++ b/resources/views/toolbox/layouts/_horizontal/header_container.blade.php @@ -0,0 +1,13 @@ + diff --git a/resources/views/tools/sidebar.blade.php b/resources/views/tools/sidebar.blade.php deleted file mode 100644 index c1c08adf7..000000000 --- a/resources/views/tools/sidebar.blade.php +++ /dev/null @@ -1,51 +0,0 @@ -{{-- __('!! Outils') --}} - diff --git a/resources/views/vendor/backpack/ui/inc/head.blade.php b/resources/views/vendor/backpack/ui/inc/head.blade.php index 8c0422c35..8eb0c08a1 100644 --- a/resources/views/vendor/backpack/ui/inc/head.blade.php +++ b/resources/views/vendor/backpack/ui/inc/head.blade.php @@ -32,10 +32,3 @@ @stack('after_styles') - -{{-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --}} - {{-- WARNING: Respond.js doesn't work if you view the page via file:// --}} - diff --git a/resources/views/vendor/backpack/ui/inc/menu_items.blade.php b/resources/views/vendor/backpack/ui/inc/menu_items.blade.php index 03b613054..88b7990de 100644 --- a/resources/views/vendor/backpack/ui/inc/menu_items.blade.php +++ b/resources/views/vendor/backpack/ui/inc/menu_items.blade.php @@ -1,10 +1,12 @@ {{-- __('!! Toolbox') --}} @php - function sidebarState($id,$default=false){ - $default=$default?'1':'0'; + if(!function_exists('toolboxSidebarState')){ + function toolboxSidebarState($id,$default=false){ + $default=$default?'1':'0'; - $state=(backpack_user()->getToolboxSetting('sidebar_'.$id,$default)=='1')?' open':''; - return 'class="nav-item nav-dropdown'.$state.'" data-sidebar-id="'.$id.'"'; + $state=(backpack_user()->getToolboxSetting('sidebar_'.$id,$default)=='1')?' open':''; + return 'class="nav-item nav-dropdown'.$state.'" data-sidebar-id="'.$id.'"'; + } } @endphp @@ -61,193 +63,8 @@ }); @endpush -@if(config('app.env') !== 'ysl') - - +@php + $items= - @can('files:read') - - @endcan - - @canany(['quiz:read','quiztranslation:read','elearning_media:read']) -
  • {{__('e-Learning')}} - -
  • - @endcanany -@endif - -@canany(['fluidbook-quote:read','signature:read','fluidbook-theme:read','fluidbook-iconset:read','fluibook-translate:write','fluidbook-publication:read']) -
  • {{__('Fluidbook')}} - -
  • -@endcanany -@if(config('app.env') !== 'ysl') - @can('tools') -
  • {{__('Outils')}} - @include('tools.sidebar') -
  • - @endcan - @canany(['users:read','company:read','managerolesandpersmissions']) -
  • {{__('Clients')}} - -
  • - @endcan - - @canany(['team-leave:read','team-overtime:read','extranet:manage_emails']) -
  • {{__('Équipe')}} - -
  • - @endcan - - @canany(['maintenance','toolbox-translate:admin']) -
  • {{__('Administration')}} - -
  • - @endcanany -@endif - +@endphp -- 2.39.5