Skip to content

Commit 683f151

Browse files
Fix styling
1 parent f8e4f92 commit 683f151

File tree

5 files changed

+47
-53
lines changed

5 files changed

+47
-53
lines changed

packages/builder/src/Commands/InstallCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function handle()
4646
if ($panelsToregister != null) {
4747
if (is_array($panelsToregister)) {
4848
foreach ($panelsToregister as $panelprovider) {
49-
$this->registerPlugins($providerPath . '/' . $panelprovider);
49+
$this->registerPlugins($providerPath.'/'.$panelprovider);
5050
}
5151
} else {
5252
$this->registerPlugins($panelsToregister);
@@ -138,11 +138,11 @@ public function registerPlugins(string $providerPath): void
138138
$newPlugins = '';
139139

140140
foreach ($pluginsToAdd as $plugin) {
141-
$searchPlugin = '/' . $plugin . '/';
141+
$searchPlugin = '/'.$plugin.'/';
142142
if (preg_match($searchPlugin, $content)) {
143143
warning("$plugin already registered.");
144144
} else {
145-
$newPlugins .= $intend . $namespace . '\\' . $plugin . $function . "\n";
145+
$newPlugins .= $intend.$namespace.'\\'.$plugin.$function."\n";
146146
}
147147
}
148148

@@ -157,7 +157,7 @@ public function registerPlugins(string $providerPath): void
157157

158158
$pluginsSection = " ->plugins([\n$newPlugins\n ]);";
159159
$placeholderPattern = '/(\->authMiddleware\(\[.*?\]\))\s*\;/s';
160-
$replacement = "$1\n" . $pluginsSection;
160+
$replacement = "$1\n".$pluginsSection;
161161
$newContent = preg_replace($placeholderPattern, $replacement, $content, 1);
162162
}
163163

@@ -184,7 +184,7 @@ public function getPanelProviderPath(): string|array
184184
);
185185
}
186186
if (count($providers) == 1) {
187-
$providerPath .= '/' . $providers[0]->getBasename();
187+
$providerPath .= '/'.$providers[0]->getBasename();
188188
}
189189

190190
return $providerPath;

packages/builder/src/Resources/ItemResource.php

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,32 @@
44

55
namespace Moox\Builder\Resources;
66

7-
use Filament\Forms\Form;
8-
use Filament\Tables\Table;
9-
use Moox\Builder\Models\Item;
10-
use Filament\Resources\Resource;
11-
use Filament\Forms\Components\Grid;
12-
use Filament\Forms\Components\Select;
7+
use Camya\Filament\Forms\Components\TitleWithSlugInput;
138
use Filament\Forms\Components\Actions;
9+
use Filament\Forms\Components\DateTimePicker;
10+
use Filament\Forms\Components\FileUpload;
11+
use Filament\Forms\Components\Grid;
12+
use Filament\Forms\Components\MarkdownEditor;
1413
use Filament\Forms\Components\Section;
14+
use Filament\Forms\Components\Select;
1515
use Filament\Forms\Components\Textarea;
16+
use Filament\Forms\Form;
17+
use Filament\Resources\Resource;
18+
use Filament\Tables\Actions\DeleteBulkAction;
1619
use Filament\Tables\Actions\EditAction;
20+
use Filament\Tables\Actions\RestoreBulkAction;
1721
use Filament\Tables\Actions\ViewAction;
18-
use Filament\Tables\Columns\TextColumn;
1922
use Filament\Tables\Columns\ImageColumn;
20-
use Filament\Forms\Components\FileUpload;
23+
use Filament\Tables\Columns\TextColumn;
2124
use Filament\Tables\Filters\SelectFilter;
25+
use Filament\Tables\Table;
2226
use Illuminate\Database\Eloquent\Builder;
23-
use Filament\Forms\Components\DateTimePicker;
24-
use Filament\Forms\Components\MarkdownEditor;
25-
use Filament\Tables\Actions\DeleteBulkAction;
2627
use Illuminate\Database\Eloquent\SoftDeletes;
27-
use Filament\Tables\Actions\RestoreBulkAction;
28-
use Camya\Filament\Forms\Components\TitleWithSlugInput;
28+
use Moox\Builder\Models\Item;
29+
use Moox\Builder\Resources\ItemResource\Pages\CreateItem;
2930
use Moox\Builder\Resources\ItemResource\Pages\EditItem;
30-
use Moox\Builder\Resources\ItemResource\Pages\ViewItem;
3131
use Moox\Builder\Resources\ItemResource\Pages\ListItems;
32-
use Moox\Builder\Resources\ItemResource\Pages\CreateItem;
32+
use Moox\Builder\Resources\ItemResource\Pages\ViewItem;
3333
use Moox\Builder\Resources\ItemResource\Widgets\ItemWidgets;
3434

3535
//use Moox\Core\Forms\Components\TitleWithSlugInput;
@@ -66,7 +66,6 @@ public static function form(Form $form): Form
6666
fieldSlug: 'slug', // The name of the field in your model that will store the slug.
6767
),
6868

69-
7069
/*TitleWithSlugInput::make('title')
7170
->titleLabel(__('core::core.title'))
7271
->slugLabel(__('core::core.slug'))
@@ -102,8 +101,8 @@ public static function form(Form $form): Form
102101
->color('success')
103102
->button()
104103
->extraAttributes(['class' => 'w-full'])
105-
->action(fn($record) => $record->restore())
106-
->visible(fn($livewire, $record) => $record && $record->trashed() && $livewire instanceof ViewItem),
104+
->action(fn ($record) => $record->restore())
105+
->visible(fn ($livewire, $record) => $record && $record->trashed() && $livewire instanceof ViewItem),
107106
Actions\Action::make('save')
108107
->label(__('core::core.save'))
109108
->color('primary')
@@ -112,7 +111,7 @@ public static function form(Form $form): Form
112111
->action(function ($livewire) {
113112
$livewire instanceof CreateItem ? $livewire->create() : $livewire->save();
114113
})
115-
->visible(fn($livewire) => $livewire instanceof CreateItem || $livewire instanceof EditItem),
114+
->visible(fn ($livewire) => $livewire instanceof CreateItem || $livewire instanceof EditItem),
116115
Actions\Action::make('publish')
117116
->label(__('core::core.publish'))
118117
->color('success')
@@ -126,7 +125,7 @@ public static function form(Form $form): Form
126125
$livewire->form->fill($data);
127126
$livewire instanceof CreateItem ? $livewire->create() : $livewire->save();
128127
})
129-
->hidden(fn($livewire, $record) => $record && $record->trashed()),
128+
->hidden(fn ($livewire, $record) => $record && $record->trashed()),
130129
Actions\Action::make('saveAndCreateAnother')
131130
->label(__('core::core.save_and_create_another'))
132131
->color('secondary')
@@ -135,35 +134,35 @@ public static function form(Form $form): Form
135134
->action(function ($livewire) {
136135
$livewire->saveAndCreateAnother();
137136
})
138-
->visible(fn($livewire) => $livewire instanceof CreateItem),
137+
->visible(fn ($livewire) => $livewire instanceof CreateItem),
139138
Actions\Action::make('cancel')
140139
->label(__('core::core.cancel'))
141140
->color('secondary')
142141
->outlined()
143142
->extraAttributes(['class' => 'w-full'])
144-
->url(fn() => static::getUrl('index'))
145-
->visible(fn($livewire) => $livewire instanceof CreateItem),
143+
->url(fn () => static::getUrl('index'))
144+
->visible(fn ($livewire) => $livewire instanceof CreateItem),
146145
Actions\Action::make('edit')
147146
->label(__('core::core.edit'))
148147
->color('primary')
149148
->button()
150149
->extraAttributes(['class' => 'w-full'])
151-
->url(fn($record) => static::getUrl('edit', ['record' => $record]))
152-
->visible(fn($livewire, $record) => $livewire instanceof ViewItem && ! $record->trashed()),
150+
->url(fn ($record) => static::getUrl('edit', ['record' => $record]))
151+
->visible(fn ($livewire, $record) => $livewire instanceof ViewItem && ! $record->trashed()),
153152
Actions\Action::make('restore')
154153
->label(__('core::core.restore'))
155154
->color('success')
156155
->button()
157156
->extraAttributes(['class' => 'w-full'])
158-
->action(fn($record) => $record->restore())
159-
->visible(fn($livewire, $record) => $record && $record->trashed() && $livewire instanceof EditItem),
157+
->action(fn ($record) => $record->restore())
158+
->visible(fn ($livewire, $record) => $record && $record->trashed() && $livewire instanceof EditItem),
160159
Actions\Action::make('delete')
161160
->label(__('core::core.delete'))
162161
->color('danger')
163162
->link()
164163
->extraAttributes(['class' => 'w-full'])
165-
->action(fn($record) => $record->delete())
166-
->visible(fn($livewire, $record) => $record && ! $record->trashed() && $livewire instanceof EditItem),
164+
->action(fn ($record) => $record->delete())
165+
->visible(fn ($livewire, $record) => $record && ! $record->trashed() && $livewire instanceof EditItem),
167166
]),
168167
Select::make('type')
169168
->options(static::getModel()::getTypeOptions())
@@ -175,11 +174,11 @@ public static function form(Form $form): Form
175174

176175
Select::make('author_id')
177176
->label(__('core::core.author'))
178-
->options(fn() => static::getAuthorOptions())
179-
->default(fn() => auth()->id())
177+
->options(fn () => static::getAuthorOptions())
178+
->default(fn () => auth()->id())
180179
->required()
181180
->searchable()
182-
->visible(fn() => static::shouldShowAuthorField()),
181+
->visible(fn () => static::shouldShowAuthorField()),
183182
]),
184183
// TODO: Taxonomy Plugin
185184
])
@@ -222,22 +221,22 @@ public static function table(Table $table): Table
222221
->toggleable(),
223222
ImageColumn::make('author.avatar_url')
224223
->label(__('core::core.author'))
225-
->tooltip(fn($record) => $record->author?->name)
224+
->tooltip(fn ($record) => $record->author?->name)
226225
->alignment('center')
227226
->circular()
228-
->visible(fn() => static::shouldShowAuthorField())
227+
->visible(fn () => static::shouldShowAuthorField())
229228
->toggleable(),
230229
TextColumn::make('type')
231230
->label(__('core::core.type'))
232231
->visible(! empty(config('builder.types')))
233-
->formatStateUsing(fn($record): string => config('builder.types')[$record->type] ?? ucfirst($record->type))
232+
->formatStateUsing(fn ($record): string => config('builder.types')[$record->type] ?? ucfirst($record->type))
234233
->sortable(),
235234
TextColumn::make('status')
236235
->label(__('core::core.status'))
237236
->alignment('center')
238237
->badge()
239-
->formatStateUsing(fn(string $state): string => strtoupper($state))
240-
->color(fn(string $state): string => match ($state) {
238+
->formatStateUsing(fn (string $state): string => strtoupper($state))
239+
->color(fn (string $state): string => match ($state) {
241240
'draft' => 'primary',
242241
'published' => 'success',
243242
'scheduled' => 'info',
@@ -256,7 +255,7 @@ public static function table(Table $table): Table
256255
->defaultSort('slug', 'desc')
257256
->actions([
258257
ViewAction::make(),
259-
EditAction::make()->hidden(fn() => in_array(static::getCurrentTab(), ['trash', 'deleted'])),
258+
EditAction::make()->hidden(fn () => in_array(static::getCurrentTab(), ['trash', 'deleted'])),
260259
])
261260
->bulkActions([
262261
DeleteBulkAction::make()->hidden(function () use ($currentTab) {

packages/builder/src/Resources/ItemResource/Pages/ListItems.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected function getHeaderActions(): array
4848
->using(function (array $data, string $model): Item {
4949
return $model::create($data);
5050
})
51-
->hidden(fn() => $this->activeTab === 'deleted'),
51+
->hidden(fn () => $this->activeTab === 'deleted'),
5252
Action::make('emptyTrash')
5353
->label(__('core::core.empty_trash'))
5454
->icon('heroicon-o-trash')
@@ -63,7 +63,7 @@ protected function getHeaderActions(): array
6363
->send();
6464
})
6565
->requiresConfirmation()
66-
->visible(fn() => $this->activeTab === 'deleted' && Item::onlyTrashed()->exists()),
66+
->visible(fn () => $this->activeTab === 'deleted' && Item::onlyTrashed()->exists()),
6767
];
6868
}
6969

packages/builder/src/Resources/ItemResource/Pages/ViewItem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function getTitle(): string
2626
{
2727
$title = parent::getTitle();
2828
if ($this->isRecordTrashed()) {
29-
$title = $title . ' - ' . __('core::core.deleted');
29+
$title = $title.' - '.__('core::core.deleted');
3030
}
3131

3232
return $title;

packages/builder/tests/Feature/Item/ListItemTest.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22

33
use Moox\Builder\Models\Item;
4-
use function Pest\Livewire\livewire;
5-
64
use Moox\Builder\Resources\ItemResource;
75
use Moox\Builder\Resources\ItemResource\Pages\ListItems;
86

7+
use function Pest\Livewire\livewire;
8+
99
/*_____________________________________________________
1010
1111
table
@@ -24,8 +24,6 @@
2424
->assertCanSeeTableRecords($items);
2525
});
2626

27-
28-
2927
//it('can edit an item', function () {
3028
// $item = Item::factory()->create();
3129
//
@@ -34,8 +32,6 @@
3432
// ->assertRedirectTo(ItemResource::getUrl('edit', ['record' => $item->id]));
3533
//});
3634

37-
38-
3935
/*
4036
it('can render all tabs', function () {
4137
config(['builder.resources.builder.tabs' => ['all']]);
@@ -51,7 +47,6 @@
5147
});
5248
*/
5349

54-
5550
it('can render index view ', function () {
5651
$this->get(ItemResource::getUrl('index'))->assertSuccessful();
5752
});

0 commit comments

Comments
 (0)