Skip to content

Commit

Permalink
Merge pull request #19 from ashleyhood/feat_modal_size
Browse files Browse the repository at this point in the history
feat: change modal size
  • Loading branch information
saade authored Jul 2, 2022
2 parents 94a103e + 7a0b713 commit fd54452
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.


Expand Down
2 changes: 1 addition & 1 deletion resources/views/components/create-event-modal.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<x-filament::modal id="fullcalendar--create-event-modal">
<x-filament::modal id="fullcalendar--create-event-modal" :width="$this->getModalWidth()">
<x-slot name="heading">
{{ __('filament::resources/pages/create-record.title', ['label' => 'Event']) }}
</x-slot>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/components/edit-event-modal.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<x-filament::modal id="fullcalendar--edit-event-modal">
<x-filament::modal id="fullcalendar--edit-event-modal" :width="$this->getModalWidth()">
<x-slot name="heading">
{{ __('filament::resources/pages/edit-record.title', ['label' => 'Event']) }}
</x-slot>
Expand Down
7 changes: 7 additions & 0 deletions src/Widgets/Concerns/CanManageEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ trait CanManageEvents
use EditEventForm;
use EvaluateClosures;

protected string $modalWidth = 'sm';

protected function setUpForms(): void
{
if (static::canCreate()) {
Expand All @@ -34,6 +36,11 @@ protected function getForms(): array
];
}

protected function getModalWidth(): string
{
return $this->modalWidth;
}

public function onEventClick($event): void
{
if (! static::canEdit($event)) {
Expand Down

0 comments on commit fd54452

Please sign in to comment.