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

Commit

Permalink
Merge pull request #17 from simonbuehler/translate
Browse files Browse the repository at this point in the history
Translate strings
  • Loading branch information
alexjustesen authored May 14, 2022
2 parents b7ac72e + 70bb387 commit 19a88c5
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 11 deletions.
16 changes: 16 additions & 0 deletions resources/lang/de/activity.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

return [
'causer_type' => 'Auslösender Typ',
'causer_id' => 'Id des Auslösers',
'subject_type' => 'Typ des Subjekts',
'subject_id' => 'Id des Subjekts',
'description' => 'Beschreibung',
'attributes' => 'Neue Werte',
'old' => 'Alte Werte',
'subject' => "Subjekt",
'logged_at' => "Änderungszeit",
'has_subject' => "besitzt Subjekt",
'label' => 'Aktivität',
'plural_label' => 'Aktivitäten',
];
16 changes: 16 additions & 0 deletions resources/lang/en/activity.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

return [
'causer_type' => 'Causer Type',
'causer_id' => 'Causer Id',
'subject_type' => 'Subject type',
'subject_id' => 'Subject Id',
'description' => 'Description',
'attributes' => 'Attributes',
'old' => 'Old',
'subject' => "Subject",
'logged_at' => "Logged at",
'has_subject' => "Has Subject",
'label' => 'Activity',
'plural_label' => 'Activity'
];
31 changes: 20 additions & 11 deletions src/Resources/ActivityResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,27 @@ class ActivityResource extends Resource

protected static ?string $navigationIcon = 'heroicon-o-table';

protected static ?string $pluralLabel = 'Activity';
public static function getLabel(): string
{
return __('filament-spatie-activitylog::activity.label');
}

public static function getPluralLabel(): string
{
return __('filament-spatie-activitylog::activity.plural_label');
}

public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('causer_type'),
Forms\Components\TextInput::make('causer_id')->label('Causer ID'),
Forms\Components\TextInput::make('subject_type'),
Forms\Components\TextInput::make('subject_id')->label('Subject ID'),
Forms\Components\TextInput::make('description')->columnSpan(2),
Forms\Components\KeyValue::make('properties.attributes'),
Forms\Components\KeyValue::make('properties.old'),
Forms\Components\TextInput::make('causer_type')->label(__('filament-spatie-activitylog::activity.causer_type')),
Forms\Components\TextInput::make('causer_id')->label(__('filament-spatie-activitylog::activity.causer_id')),
Forms\Components\TextInput::make('subject_type')->label(__('filament-spatie-activitylog::activity.subject_type')),
Forms\Components\TextInput::make('subject_id')->label(__('filament-spatie-activitylog::activity.subject_id')),
Forms\Components\TextInput::make('description')->label(__('filament-spatie-activitylog::activity.description'))->columnSpan(2),
Forms\Components\KeyValue::make('properties.attributes')->label(__('filament-spatie-activitylog::activity.attributes')),
Forms\Components\KeyValue::make('properties.old')->label(__('filament-spatie-activitylog::activity.old')),
]);
}

Expand All @@ -46,9 +54,10 @@ public static function table(Table $table): Table
->label('ID')
->sortable(),
Tables\Columns\TextColumn::make('description')
->label(__('filament-spatie-activitylog::activity.description'))
->searchable(),
Tables\Columns\TextColumn::make('subject.name')
->label('Subject')
->label(__('filament-spatie-activitylog::activity.subject'))
->hidden(fn (Component $livewire) => $livewire instanceof ActivitiesRelationManager)
->getStateUsing(function (Activity $record) {
if (! $record->subject || ! $record->subject instanceof IsActivitySubject) {
Expand All @@ -75,12 +84,12 @@ public static function table(Table $table): Table
return $resource::getUrl('edit', ['record' => $record->subject]) ?? null;
}, shouldOpenInNewTab: true),
Tables\Columns\TextColumn::make('created_at')
->label('Logged at')
->label(__('filament-spatie-activitylog::activity.logged_at'))
->dateTime()
->sortable(),
])
->filters([
Tables\Filters\Filter::make('Has Subject')
Tables\Filters\Filter::make('has_subject') ->label(__('filament-spatie-activitylog::activity.has_subject'))
->query(fn (Builder $query) => $query->has('subject')),
])
->bulkActions([])
Expand Down

0 comments on commit 19a88c5

Please sign in to comment.