From 7a0b71337a80079e926c38d9c1080d4dc8252f5f Mon Sep 17 00:00:00 2001 From: Ashley Hood Date: Fri, 1 Jul 2022 14:24:20 +0100 Subject: [PATCH] feat: change modal size --- README.md | 2 ++ resources/views/components/create-event-modal.blade.php | 2 +- resources/views/components/edit-event-modal.blade.php | 2 +- src/Widgets/Concerns/CanManageEvents.php | 7 +++++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 38129ce..636b52f 100644 --- a/README.md +++ b/README.md @@ -180,6 +180,8 @@ public function onEventDrop($newEvent, $oldEvent, $relatedEvents): void Since [v1.0.0](https://github.com/saade/filament-fullcalendar/releases/tag/v1.0.0) you can create and edit events using a modal. +To change the modal size, override the `protected string $modalWidth` property in your widget. + The process of saving and editing the event is up to you, since this plugin does not rely on a Model to save the calendar events. diff --git a/resources/views/components/create-event-modal.blade.php b/resources/views/components/create-event-modal.blade.php index 3a41bee..dabd728 100644 --- a/resources/views/components/create-event-modal.blade.php +++ b/resources/views/components/create-event-modal.blade.php @@ -1,4 +1,4 @@ - + {{ __('filament::resources/pages/create-record.title', ['label' => 'Event']) }} diff --git a/resources/views/components/edit-event-modal.blade.php b/resources/views/components/edit-event-modal.blade.php index 9dfd660..b802099 100644 --- a/resources/views/components/edit-event-modal.blade.php +++ b/resources/views/components/edit-event-modal.blade.php @@ -1,4 +1,4 @@ - + {{ __('filament::resources/pages/edit-record.title', ['label' => 'Event']) }} diff --git a/src/Widgets/Concerns/CanManageEvents.php b/src/Widgets/Concerns/CanManageEvents.php index bd69a3b..47bd089 100644 --- a/src/Widgets/Concerns/CanManageEvents.php +++ b/src/Widgets/Concerns/CanManageEvents.php @@ -15,6 +15,8 @@ trait CanManageEvents use EditEventForm; use EvaluateClosures; + protected string $modalWidth = 'sm'; + protected function setUpForms(): void { if (static::canCreate()) { @@ -34,6 +36,11 @@ protected function getForms(): array ]; } + protected function getModalWidth(): string + { + return $this->modalWidth; + } + public function onEventClick($event): void { if (! static::canEdit($event)) {