Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: change modal size #19

Merged
merged 1 commit into from
Jul 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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