From 1b41c3e49e53a9c5caf50378f6789058de71189c Mon Sep 17 00:00:00 2001 From: milewski Date: Sat, 28 Sep 2019 20:03:54 +0800 Subject: [PATCH] add readme, prepare for first release --- LICENSE | 21 +++ README.md | 84 ++++++++++++ composer.json | 9 +- config/collapsible-resource-manager.php | 32 +++++ dist/js/tool.js | 2 +- .../components/CollapsibleResourceManager.vue | 15 +- resources/views/navigation.blade.php | 7 +- screenshoots/demo-1.png | Bin 0 -> 123681 bytes screenshoots/demo-2.png | Bin 0 -> 24765 bytes src/CollapsibleResourceManager.php | 129 ++++++++---------- ...lapsibleResourceManagerServiceProvider.php | 34 +++++ src/ToolServiceProvider.php | 18 --- 12 files changed, 249 insertions(+), 102 deletions(-) create mode 100644 LICENSE create mode 100644 README.md create mode 100644 config/collapsible-resource-manager.php create mode 100644 screenshoots/demo-1.png create mode 100644 screenshoots/demo-2.png create mode 100644 src/CollapsibleResourceManagerServiceProvider.php delete mode 100644 src/ToolServiceProvider.php diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..86742aa --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Digital Creative + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..b9e4c62 --- /dev/null +++ b/README.md @@ -0,0 +1,84 @@ +# Collapsible Resource Manager + +[![Latest Version on Packagist](https://img.shields.io/packagist/v/digital-creative/collapsible-resource-manager.svg)](https://packagist.org/packages/digital-creative/collapsible-resource-manager) +[![Total Downloads](https://img.shields.io/packagist/dt/digital-creative/collapsible-resource-manager.svg)](https://packagist.org/packages/digital-creative/collapsible-resource-manager) +[![License](https://img.shields.io/packagist/l/digital-creative/collapsible-resource-manager.svg)](https://github.com/digital-creative/collapsible-resource-manager/blob/master/LICENSE) + +![Laravel Nova Collapsible Resource Manager in action](https://github.com/dcasia/collapsible-resource-manager/screenshoots/demo-1.png) + +Provides an easy way to order and group your resources on the sidebar. + +# Installation + +You can install the package via composer: + +``` +composer require digital-creative/collapsible-resource-manager +``` + +Next up, you must register the tool with Nova. This is typically done in the `tools` method of the `NovaServiceProvider.` + +```php +class NovaServiceProvider extends NovaApplicationServiceProvider +{ + public function tools() + { + return [ + // ... + new CollapsibleResourceManager() + ]; + + } +} +``` + +Publish the configuration file + +```bash +php artisan vendor:publish --provider="DigitalCreative\CollapsibleResourceManager\CollapsibleResourceManagerServiceProvider" --tag="config" +``` + +Config file reference: + +```php +return [ + /** + * If false the default resource manager will coexist with this tool + */ + 'disable_default_resource_manage' => true, + + /** + * If true all titles within navigation array will pass through laravel trans helper + */ + 'translate_title' => false, + + /** + * Main navigation, each item on this array creates a new entry on the sidebar with an icon + */ + 'navigation' => [ + [ + 'title' => 'Resource Title', + 'icon' => null, // or + 'groups' => [ + [ + 'title' => 'Group Title', + 'expanded' => true, + 'resources' => [ + \App\Nova\User::class, + ] + ] + ] + ] + ] +]; +``` + +# Notes + +A key difference between `CollapsibleResourceManager` and the default Nova `ResourceManager` is that the later auto scan +for resources within the `App\Nova` directory and adds it to the navigation, `CollapsibleResourceManager` expects +every entry to be added manually from the configuration file. + +## License + +The MIT License (MIT). Please see [License File](https://github.com/dcasia/collapsible-resource-manager/raw/master/LICENSE) for more information. diff --git a/composer.json b/composer.json index ab0e8c9..fee95de 100644 --- a/composer.json +++ b/composer.json @@ -1,9 +1,12 @@ { "name": "digital-creative/collapsible-resource-manager", - "description": "A Laravel Nova tool.", + "description": "A custom sidebar menu with collapsible groups", "keywords": [ "laravel", - "nova" + "nova", + "sidebar", + "collapse", + "collapsible" ], "license": "MIT", "require": { @@ -17,7 +20,7 @@ "extra": { "laravel": { "providers": [ - "DigitalCreative\\CollapsibleResourceManager\\ToolServiceProvider" + "DigitalCreative\\CollapsibleResourceManager\\CollapsibleResourceManagerServiceProvider" ] } }, diff --git a/config/collapsible-resource-manager.php b/config/collapsible-resource-manager.php new file mode 100644 index 0000000..429af91 --- /dev/null +++ b/config/collapsible-resource-manager.php @@ -0,0 +1,32 @@ + true, + + /** + * If true all titles within navigation array will pass through laravel trans helper + */ + 'translate_title' => false, + + /** + * Main navigation, each item on this array creates a new entry on the sidebar with an icon + */ + 'navigation' => [ + [ + 'title' => 'Resource Title', + 'icon' => null, // or + 'groups' => [ + [ + 'title' => 'Group Title', + 'expanded' => true, + 'resources' => [ + \App\Nova\User::class, + ] + ] + ] + ] + ] +]; diff --git a/dist/js/tool.js b/dist/js/tool.js index 4dda859..9579e15 100644 --- a/dist/js/tool.js +++ b/dist/js/tool.js @@ -1 +1 @@ -!function(t){var e={};function n(a){if(e[a])return e[a].exports;var o=e[a]={i:a,l:!1,exports:{}};return t[a].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,a){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:a})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){t.exports=n(1)},function(t,e,n){Nova.booting(function(t,e,a){t.component("collapsible-resource-manager",n(2))})},function(t,e,n){var a=n(8)(n(9),n(10),!1,function(t){n(3)},"data-v-318664a2",null);t.exports=a.exports},function(t,e,n){var a=n(4);"string"==typeof a&&(a=[[t.i,a,""]]),a.locals&&(t.exports=a.locals);n(6)("74aa7e2a",a,!0,{})},function(t,e,n){(t.exports=n(5)(!1)).push([t.i,".collapsible-indicator[data-v-318664a2]{left:-20px;width:12px;height:12px;display:flex;justify-content:center;align-content:center}",""])},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n=function(t,e){var n=t[1]||"",a=t[3];if(!a)return n;if(e&&"function"==typeof btoa){var o=(i=a,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */"),s=a.sources.map(function(t){return"/*# sourceURL="+a.sourceRoot+t+" */"});return[n].concat(s).concat([o]).join("\n")}var i;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var a={},o=0;on.parts.length&&(a.parts.length=n.parts.length)}else{var i=[];for(o=0;on.parts.length&&(a.parts.length=n.parts.length)}else{var i=[];for(o=0;o -