Skip to content

Commit

Permalink
Fix HasOne field not working on initial page load (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
milewski authored Nov 14, 2023
1 parent 29efad7 commit c1ce61b
Show file tree
Hide file tree
Showing 6 changed files with 645 additions and 616 deletions.
2 changes: 1 addition & 1 deletion dist/css/card.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 17 additions & 20 deletions nova.mix.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,28 @@ const webpack = require('webpack')
const path = require('path')

class NovaExtension {
name() {
return 'nova-extension'
}

register(name) {
this.name = name
}

webpackConfig(webpackConfig) {
webpackConfig.externals = {
vue: 'Vue',
name() {
return 'nova-extension'
}

webpackConfig.resolve.alias = {
...(webpackConfig.resolve.alias || {}),
'laravel-nova': path.join(
__dirname,
'../../vendor/laravel/nova/resources/js/mixins/packages.js'
),
register(name) {
this.name = name
}

webpackConfig.output = {
uniqueName: this.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())
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
"nova:install": "npm --prefix='../../vendor/laravel/nova' ci"
},
"devDependencies": {
"@vue/compiler-sfc": "^3.3.4",
"@vue/compiler-sfc": "^3.3.8",
"laravel-mix": "^6.0.49",
"mix-tailwindcss": "^1.3.0",
"postcss": "^8.4.31",
"tailwindcss": "^3.3.3",
"vue-loader": "^17.3.0"
"tailwindcss": "^3.3.5",
"vue-loader": "^17.3.1"
}
}
4 changes: 4 additions & 0 deletions src/ResourceNavigationField.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public function isActive(): bool
$activeSlug = static::$active = $this->getSlug();
}

if (is_null($activeSlug) && !is_null(static::$active)) {
$activeSlug = static::$active;
}

if ($activeSlug === $this->getSlug()) {
return true;
}
Expand Down
5 changes: 2 additions & 3 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module.exports = {
mode: 'jit',
content: [ './resources/**/*.vue' ],
important: '.resource-navigation-card'
...require('../../vendor/laravel/nova/tailwind.config'),
important: '.resource-navigation-card',
}
Loading

0 comments on commit c1ce61b

Please sign in to comment.