-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3af55da
commit 700d56d
Showing
11 changed files
with
111 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,13 +7,6 @@ | |
"menu" | ||
], | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Artem Stepanenko", | ||
"email": "[email protected]", | ||
"role": "Maintainer" | ||
} | ||
], | ||
"require": { | ||
"php": ">=8.0", | ||
"laravel/nova": "^4.0" | ||
|
@@ -32,7 +25,7 @@ | |
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"Stepanenko3\\NovaMenuCollapsed\\MenuCollapsedServiceProvider" | ||
"Stepanenko3\\NovaMenuCollapsed\\ToolServiceProvider" | ||
] | ||
} | ||
}, | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"/js/entry.js": "/js/entry.js" | ||
"/js/tool.js": "/js/tool.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const mix = require('laravel-mix') | ||
const webpack = require('webpack') | ||
const path = require('path') | ||
|
||
class NovaExtension { | ||
name() { | ||
return '' | ||
} | ||
|
||
register(name) { | ||
this.name = name | ||
} | ||
|
||
webpackConfig(webpackConfig) { | ||
webpackConfig.externals = { | ||
vue: 'Vue', | ||
} | ||
|
||
webpackConfig.resolve.alias = { | ||
...(webpackConfig.resolve.alias || {}), | ||
'laravel-nova': path.join( | ||
__dirname, | ||
'vendor/laravel/nova/resources/js/mixins/packages.js' | ||
), | ||
} | ||
|
||
webpackConfig.output = { | ||
uniqueName: this.name, | ||
} | ||
} | ||
} | ||
|
||
mix.extend('nova', new NovaExtension()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,20 @@ | ||
{ | ||
"private": true, | ||
"scripts": { | ||
"dev": "mix", | ||
"dev": "npm run development", | ||
"development": "mix", | ||
"watch": "mix watch", | ||
"watch-poll": "mix watch -- --watch-options-poll=1000", | ||
"hot": "mix watch --hot", | ||
"prod": "mix --production", | ||
"format": "prettier --write 'resources/**/*.{css,js,vue}'" | ||
"prod": "npm run production", | ||
"production": "mix --production", | ||
"nova:install": "npm --prefix='../../vendor/laravel/nova' ci" | ||
}, | ||
"devDependencies": { | ||
"@inertiajs/inertia": "^0.11.0", | ||
"@vue/babel-plugin-jsx": "^1.1.1", | ||
"axios": "^0.26.1", | ||
"cross-env": "^7.0.3", | ||
"form-backend-validation": "^2.4.0", | ||
"laravel-mix": "^6.0.43", | ||
"postcss": "^8.4.12", | ||
"prettier": "^2.6.2", | ||
"resolve-url-loader": "^5.0.0", | ||
"sass": "^1.50.0", | ||
"sass-loader": "^12.6.0", | ||
"terser-webpack-plugin": "^5.3.1", | ||
"vue-loader": "^17.0.0", | ||
"vue-template-compiler": "^2.6.14", | ||
"vuex": "^4.0.2" | ||
"@vue/compiler-sfc": "^3.2.22", | ||
"laravel-mix": "^6.0.41", | ||
"postcss": "^8.3.11", | ||
"vue-loader": "^16.8.3" | ||
}, | ||
"dependencies": { | ||
"vue": "^3.2.31" | ||
} | ||
"dependencies": {} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
function setMenuItemCollapsed(menuItem, collapsed = true) { | ||
const key = `nova.navigation.${menuItem.key}.collapsed`; | ||
|
||
if (localStorage.getItem(key)) | ||
return; | ||
|
||
localStorage.setItem(key, collapsed); | ||
} | ||
|
||
function collapseMenuRecursive(menu) { | ||
menu | ||
.filter(menuItem => menuItem.items && menuItem.items.length > 0) | ||
.forEach(menuItem => { | ||
setMenuItemCollapsed(menuItem); | ||
|
||
if (menuItem.items.length > 0) { | ||
collapseMenuRecursive(menuItem.items); | ||
} | ||
}); | ||
} | ||
|
||
Nova.booting(function () { | ||
if (!Nova.config('novaMenuCollapsed')) | ||
return; | ||
|
||
const menu = Nova.config('mainMenu'); | ||
|
||
collapseMenuRecursive(menu); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,9 @@ | ||
let mix = require('laravel-mix'); | ||
let path = require('path'); | ||
let mix = require('laravel-mix') | ||
|
||
require('./nova.mix') | ||
|
||
console.log(path.join(__dirname, 'vendor/laravel/nova/resources/js/mixins/packages.js')); | ||
mix | ||
.setPublicPath('dist') | ||
.js('resources/js/entry.js', 'js') | ||
.vue({ version: 3 }) | ||
.webpackConfig({ | ||
externals: { | ||
vue: 'Vue', | ||
}, | ||
output: { | ||
uniqueName: 'stepanenko3/nova-menu-collapsed', | ||
}, | ||
}) | ||
.alias({ | ||
'laravel-nova': path.join(__dirname, 'vendor/laravel/nova/resources/js/mixins/packages.js'), | ||
}); | ||
.setPublicPath('dist') | ||
.js('resources/js/tool.js', 'js') | ||
.vue({ version: 3 }) | ||
.nova('stepanenko3/nova-menu-collpsed') |