Skip to content

Commit 85d32f9

Browse files
committed
Split actions (temp)
1 parent ec7a6b4 commit 85d32f9

19 files changed

+95
-412
lines changed

banner.jpg

524 KB
Loading

composer.json

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,16 @@
1717
}
1818
],
1919
"require": {
20-
"php": "^8.2.0",
21-
"spatie/laravel-package-tools": "^1.13.0",
20+
"codeat3/blade-google-material-design-icons": "^1.0",
21+
"filament/support": "^4.0",
2222
"laravel/framework": "^11.0|^12.0",
23-
"filament/filament": "4.0.0-beta2",
24-
"codeat3/blade-google-material-design-icons": "^1.0"
23+
"moox/clipboard": "self.version",
24+
"moox/progress": "self.version",
25+
"php": "^8.2.0",
26+
"spatie/laravel-package-tools": "^1.13.0"
27+
},
28+
"require-dev": {
29+
"moox/devtools": "self.version"
2530
},
2631
"autoload": {
2732
"psr-4": {
@@ -73,24 +78,5 @@
7378
}
7479
},
7580
"minimum-stability": "stable",
76-
"prefer-stable": true,
77-
"require-dev": {
78-
"laravel/pint": "^1.14",
79-
"nunomaduro/collision": "^8.1.1||^7.10.0",
80-
"larastan/larastan": "^3.0",
81-
"orchestra/testbench": "^9.0.0||^8.22.0",
82-
"pestphp/pest": "^3.0",
83-
"pestphp/pest-plugin-arch": "^3.0",
84-
"pestphp/pest-plugin-laravel": "^3.0",
85-
"phpstan/extension-installer": "^1.3",
86-
"phpstan/phpstan-deprecation-rules": "^2.0",
87-
"phpstan/phpstan-phpunit": "^2.0",
88-
"spatie/laravel-ray": "^1.35"
89-
},
90-
"config": {
91-
"allow-plugins": {
92-
"pestphp/pest-plugin": true,
93-
"phpstan/extension-installer": true
94-
}
95-
}
81+
"prefer-stable": true
9682
}

resources/dist/progress.css

Lines changed: 0 additions & 162 deletions
This file was deleted.

resources/views/progress.blade.php

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/CoreServiceProvider.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
namespace Moox\Core;
66

7-
use Filament\Support\Assets\Css;
8-
use Filament\Support\Facades\FilamentAsset;
97
use Illuminate\Support\Facades\Gate;
108
use Moox\Core\Console\Commands\MooxInstaller;
119
use Moox\Core\Console\Commands\PackageServiceCommand;
@@ -42,12 +40,7 @@ public function boot(): void
4240
});
4341
}
4442

45-
public function packageBooted(): void
46-
{
47-
FilamentAsset::register([
48-
Css::make('core-progress', __DIR__.'/../resources/dist/progress.css'),
49-
], 'moox/core');
50-
}
43+
public function packageBooted(): void {}
5144

5245
public function configurePackage(Package $package): void
5346
{

src/Entities/BaseResource.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
namespace Moox\Core\Entities;
44

5+
use Filament\Actions\Action;
6+
use Filament\Actions\DeleteBulkAction;
57
use Filament\Actions\EditAction;
6-
use Filament\Actions\ViewAction;
78
use Filament\Actions\RestoreAction;
89
use Filament\Actions\RestoreBulkAction;
9-
use Filament\Actions\DeleteBulkAction;
10-
use Filament\Actions\Action;
10+
use Filament\Actions\ViewAction;
1111
use Filament\Resources\Pages\CreateRecord;
1212
use Filament\Resources\Pages\EditRecord;
1313
use Filament\Resources\Pages\ViewRecord;
@@ -162,7 +162,7 @@ public static function getCancelAction(): Action
162162
->keyBindings(['escape'])
163163
->color('secondary')
164164
->outlined()
165-
->url(fn () => static::getUrl('index', ));
165+
->url(fn () => static::getUrl('index'));
166166
// ->visible(fn ($livewire): bool => $livewire instanceof CreateRecord);
167167
}
168168

@@ -175,7 +175,7 @@ public static function getDeleteAction(): Action
175175
->extraAttributes(attributes: ['class' => 'w-full'])
176176
->action(function ($livewire): void {
177177
$livewire->record->delete();
178-
$livewire->redirect(static::getUrl('index', ));
178+
$livewire->redirect(static::getUrl('index'));
179179
})
180180
->keyBindings(['delete'])
181181
->visible(fn ($livewire): bool => $livewire instanceof EditRecord)
@@ -201,6 +201,6 @@ public static function getRestoreAction(): Action
201201
->button()
202202
->extraAttributes(['class' => 'w-full'])
203203
->action(fn ($record) => $record->restore())
204-
->visible(fn ($livewire, $record): bool => $record && $record->trashed());
204+
->visible(fn ($livewire, $record): bool => $record && method_exists($record, 'trashed') && $record->trashed());
205205
}
206206
}

src/Entities/Items/Draft/BaseDraftResource.php

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public static function enableEdit(): bool
4040

4141
return true;
4242
}
43+
4344
public static function enablePublish(): bool
4445
{
4546
if (static::getReadonlyConfig()) {
@@ -63,6 +64,15 @@ public static function enableDelete(): bool
6364
return true;
6465
}
6566

67+
public static function enableRestore(): bool
68+
{
69+
if (static::getReadonlyConfig()) {
70+
return false;
71+
}
72+
73+
return true;
74+
}
75+
6676
/**
6777
* @return mixed[]
6878
*/
@@ -98,25 +108,30 @@ public static function getBulkActions(): array
98108
public static function getFormActions(): Actions
99109
{
100110
$actions = [
101-
static::getSaveAction()->extraAttributes(attributes: ['class' => 'w-full']),
102-
static::getCancelAction()->extraAttributes(attributes: ['class' => 'w-full']),
111+
static::getSaveAction()->extraAttributes(attributes: ['style' => 'width: 100%;']),
112+
static::getCancelAction()->extraAttributes(attributes: ['style' => 'width: 100%;']),
103113
];
104-
114+
115+
if (static::enableRestore()) {
116+
$actions[] = static::getRestoreAction()->extraAttributes(attributes: ['style' => 'width: 100%;']);
117+
}
118+
105119
if (static::enableCreate()) {
106-
$actions[] = static::getSaveAndCreateAnotherAction()->extraAttributes(attributes: ['class' => 'w-full']);
120+
$actions[] = static::getSaveAndCreateAnotherAction()->extraAttributes(attributes: ['style' => 'width: 100%;']);
107121
}
108-
122+
109123
if (static::enableDelete()) {
110-
$actions[] = static::getDeleteAction()->extraAttributes(attributes: ['class' => 'w-full']);
124+
$actions[] = static::getDeleteAction()->extraAttributes(attributes: ['style' => 'width: 100%;']);
111125
}
112-
126+
113127
if (static::enableEdit()) {
114-
$actions[] = static::getEditAction()->extraAttributes(attributes: ['class' => 'w-full']);
128+
$actions[] = static::getEditAction()->extraAttributes(attributes: ['style' => 'width: 100%;']);
115129
}
116-
if(static::enablePublish()) {
117-
$actions[] = static::getPublishAction()->extraAttributes(attributes: ['class' => 'w-full']);
130+
131+
if (static::enablePublish()) {
132+
$actions[] = static::getPublishAction()->extraAttributes(attributes: ['style' => 'width: 100%;']);
118133
}
119-
134+
120135
return Actions::make($actions);
121136
}
122137

src/Entities/Items/Draft/BaseDraftTranslationModel.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@
33
namespace Moox\Core\Entities\Items\Draft;
44

55
use Illuminate\Database\Eloquent\Model;
6-
use Illuminate\Database\Eloquent\SoftDeletes;
76
use Illuminate\Database\Eloquent\Relations\MorphTo;
8-
use Illuminate\Database\Eloquent\Relations\BelongsTo;
9-
use Astrotomic\Translatable\Contracts\Translatable as TranslatableContract;
10-
use Astrotomic\Translatable\Translatable;
7+
use Illuminate\Database\Eloquent\SoftDeletes;
118

12-
abstract class BaseDraftTranslationModel extends Model
9+
abstract class BaseDraftTranslationModel extends Model
1310
{
1411
use SoftDeletes;
1512

@@ -20,7 +17,7 @@ public function getCasts(): array
2017
'published_at' => 'datetime',
2118
'to_unpublish_at' => 'datetime',
2219
'unpublished_at' => 'datetime',
23-
'restored_at' => 'datetime'
20+
'restored_at' => 'datetime',
2421
], $this->getCustomCasts());
2522
}
2623

0 commit comments

Comments
 (0)