Skip to content

Commit

Permalink
Merge pull request #15 from alkrauss48/issue-14/minor-edit-presentati…
Browse files Browse the repository at this point in the history
…on-features

Issue 14/minor edit presentation features
  • Loading branch information
alkrauss48 authored Mar 19, 2024
2 parents e10fdd9 + 63a57a5 commit e466d9e
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 11 deletions.
22 changes: 15 additions & 7 deletions app/Filament/Resources/PresentationResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Support\HtmlString;
use Illuminate\Support\Str;
use Illuminate\Validation\Rules\Unique;

Expand All @@ -38,7 +39,13 @@ public static function form(Form $form): Form
->schema([
Forms\Components\MarkdownEditor::make('content')
->required()
->columnSpan([
->hint(new HtmlString(
'<strong>Tip:</strong> '
.'Slides are separated by 2 newlines.'
))->helperText(new HtmlString(
'Want an example? See the site\'s '
.'<u><a target="_blank" href="/instructions.md">instructions</a></u>.'
))->columnSpan([
'md' => 2,
])->disableToolbarButtons([
'attachFiles',
Expand All @@ -51,7 +58,6 @@ public static function form(Form $form): Form
return null;
}),
Section::make('Details')
->description('All the metadata related to your presentation.')
->columnSpan(1)
->schema([
Forms\Components\TextInput::make('title')
Expand All @@ -61,7 +67,7 @@ public static function form(Form $form): Form
->maxLength(255),
Forms\Components\TextInput::make('slug')
->required()
->hintIcon('heroicon-o-information-circle', tooltip: 'Autogenerated')
->hintIcon('heroicon-o-information-circle', tooltip: 'The slug is autogenerated from the title, but you can still change it.')
->unique(
ignoreRecord: true,
modifyRuleUsing: fn (Unique $rule, Get $get) => $rule->where('user_id', $get('user_id')),
Expand All @@ -79,7 +85,7 @@ public static function form(Form $form): Form
->helperText('You can always view your own presentations, but if they aren\'t published, then no one else can.'),
Forms\Components\Textarea::make('description')
->helperText(
'A short abstract of your presentation. '
'A short summary of your presentation. '
.'This will be only be seen when sharing via social media. '
.'Limit is 160 characters.'
)->placeholder('i.e. In this talk by Abraham Lincoln, we explore yada yada...')
Expand All @@ -103,10 +109,12 @@ function () {
};
},
])
->helperText(
->helperText(new HtmlString(
'Image Size: 1200 x 630. This will be only be seen when sharing via social media. '
.'If omitted, the default Simple Slides thumbnail will be used.'
),
.'If omitted, the '
.'<u><a target="_blank" href="/images/simple-slides-og.jpg">default Simple Slides thumbnail</a></u> '
.'will be used.'
)),
]),
]),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Filament\Resources\Pages\EditRecord;
use Illuminate\Support\HtmlString;
use Spatie\Browsershot\Browsershot;
use Webbingbrasil\FilamentCopyActions\Pages\Actions\CopyAction;

class EditPresentation extends EditRecord
{
Expand All @@ -17,7 +18,15 @@ class EditPresentation extends EditRecord
protected function getHeaderActions(): array
{
return [
CopyAction::make('Copy Share URL')
->label('Copy Share URL')
->color('gray')
->copyable(fn (Presentation $record) => route('presentations.show', [
'user' => $record->user->username,
'slug' => $record->slug,
])),
Actions\Action::make('View')
->color('gray')
->url(fn (Presentation $record): string => route('presentations.show', [
'user' => $record->user->username,
'slug' => $record->slug,
Expand All @@ -26,6 +35,7 @@ protected function getHeaderActions(): array
->openUrlInNewTab(),
Actions\Action::make('Generate Thumbnail')
->icon('heroicon-o-camera')
->color('info')
->requiresConfirmation()
->modalHeading('Generate a thumbnail of your first slide')
->modalIcon('heroicon-o-camera')
Expand Down Expand Up @@ -70,6 +80,9 @@ protected function getHeaderActions(): array
->success()
->send();
}),
Actions\Action::make('save')
->label('Save changes')
->action('save'),
Actions\DeleteAction::make(),
Actions\ForceDeleteAction::make(),
Actions\RestoreAction::make(),
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"php": "^8.1",
"filament/filament": "^3.2",
"filament/spatie-laravel-media-library-plugin": "^3.2",
"spatie/laravel-medialibrary": "^11.4",
"guzzlehttp/guzzle": "^7.2",
"inertiajs/inertia-laravel": "^0.6.8",
"jeffgreco13/filament-breezy": "^2.2",
Expand All @@ -20,8 +19,10 @@
"laravel/tinker": "^2.8",
"league/flysystem-aws-s3-v3": "^3.0",
"spatie/browsershot": "^4.0",
"spatie/laravel-medialibrary": "^11.4",
"spatie/laravel-sluggable": "^3.5",
"tightenco/ziggy": "^1.0"
"tightenco/ziggy": "^1.0",
"webbingbrasil/filament-copyactions": "^3.0"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
Expand Down
58 changes: 56 additions & 2 deletions composer.lock

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

0 comments on commit e466d9e

Please # to comment.