Skip to content
This repository was archived by the owner on Oct 16, 2023. It is now read-only.

Commit aa28c27

Browse files
authored
Merge pull request #25 from MACscr/main
Made form a bit more responsive. Mobile record was squished.
2 parents 1c48f74 + 29ad237 commit aa28c27

File tree

2 files changed

+43
-19
lines changed

2 files changed

+43
-19
lines changed

src/RelationManagers/ActivitiesRelationManager.php

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,27 @@
33
namespace AlexJustesen\FilamentSpatieLaravelActivitylog\RelationManagers;
44

55
use AlexJustesen\FilamentSpatieLaravelActivitylog\Resources\ActivityResource;
6+
use Filament\Facades\Filament;
67
use Filament\Resources\Form;
7-
use Filament\Resources\RelationManagers\HasManyRelationManager;
8+
use Filament\Resources\RelationManagers\RelationManager;
89
use Filament\Resources\Table;
910
use Filament\Tables;
1011
use Illuminate\Database\Eloquent\Model;
1112

12-
class ActivitiesRelationManager extends HasManyRelationManager
13+
class ActivitiesRelationManager extends RelationManager
1314
{
1415
protected static string $relationship = 'activities';
1516

1617
protected static ?string $recordTitleAttribute = 'description';
1718

1819
public static function form(Form $form): Form
1920
{
20-
return $form
21-
->schema([
22-
//
23-
]);
21+
return ActivityResource::form($form);
2422
}
2523

2624
public static function table(Table $table): Table
2725
{
28-
return ActivityResource::table($table)
29-
->bulkActions([])
30-
->pushActions([
31-
Tables\Actions\LinkAction::make('View')
32-
->url(fn ($record) => ActivityResource::getUrl('view', ['record' => $record]), shouldOpenInNewTab: true),
33-
]);
26+
return ActivityResource::table($table);
3427
}
3528

3629
protected function canCreate(): bool

src/Resources/ActivityResource.php

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,44 @@ public static function form(Form $form): Form
3636
{
3737
return $form
3838
->schema([
39-
Forms\Components\TextInput::make('causer_type')->label(__('filament-spatie-activitylog::activity.causer_type')),
40-
Forms\Components\TextInput::make('causer_id')->label(__('filament-spatie-activitylog::activity.causer_id')),
41-
Forms\Components\TextInput::make('subject_type')->label(__('filament-spatie-activitylog::activity.subject_type')),
42-
Forms\Components\TextInput::make('subject_id')->label(__('filament-spatie-activitylog::activity.subject_id')),
43-
Forms\Components\TextInput::make('description')->label(__('filament-spatie-activitylog::activity.description'))->columnSpan(2),
44-
Forms\Components\KeyValue::make('properties.attributes')->label(__('filament-spatie-activitylog::activity.attributes')),
45-
Forms\Components\KeyValue::make('properties.old')->label(__('filament-spatie-activitylog::activity.old')),
39+
Forms\Components\TextInput::make('causer_type')
40+
->label(__('filament-spatie-activitylog::activity.causer_type'))
41+
->columnSpan([
42+
'default' => 2,
43+
'sm' => 1
44+
]),
45+
Forms\Components\TextInput::make('causer_id')
46+
->label(__('filament-spatie-activitylog::activity.causer_id'))
47+
->columnSpan([
48+
'default' => 2,
49+
'sm' => 1
50+
]),
51+
Forms\Components\TextInput::make('subject_type')
52+
->label(__('filament-spatie-activitylog::activity.subject_type'))
53+
->columnSpan([
54+
'default' => 2,
55+
'sm' => 1
56+
]),
57+
Forms\Components\TextInput::make('subject_id')
58+
->label(__('filament-spatie-activitylog::activity.subject_id'))
59+
->columnSpan([
60+
'default' => 2,
61+
'sm' => 1
62+
]),
63+
Forms\Components\TextInput::make('description')
64+
->label(__('filament-spatie-activitylog::activity.description'))->columnSpan(2),
65+
Forms\Components\KeyValue::make('properties.attributes')
66+
->label(__('filament-spatie-activitylog::activity.attributes'))
67+
->columnSpan([
68+
'default' => 2,
69+
'sm' => 1
70+
]),
71+
Forms\Components\KeyValue::make('properties.old')
72+
->label(__('filament-spatie-activitylog::activity.old'))
73+
->columnSpan([
74+
'default' => 2,
75+
'sm' => 1
76+
]),
4677
]);
4778
}
4879

0 commit comments

Comments
 (0)