Skip to content

Commit

Permalink
add Share Form for Bolt Pro
Browse files Browse the repository at this point in the history
  • Loading branch information
atmonshi committed Jan 12, 2024
1 parent d696972 commit c471f5f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 25 deletions.
18 changes: 9 additions & 9 deletions composer.lock

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

5 changes: 5 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
->name('entry.show')
->middleware('auth');

if (class_exists(\LaraZeus\BoltPro\BoltProServiceProvider::class)) {
Route::get('embed/{slug}', \LaraZeus\BoltPro\Livewire\EmbedForm::class)
->name('form.embed');
}

Route::get('{slug}/{extensionSlug?}', FillForms::class)
->name('form.show');
});
15 changes: 0 additions & 15 deletions src/Concerns/Schemata.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,21 +299,6 @@ public static function getTabsSchema(): array
}),
]),

Tabs\Tab::make('embed-tab')
->label(__('Embed'))
->visible(fn (
string $operation
): bool => class_exists(\LaraZeus\Sky\SkyServiceProvider::class) && $operation === 'edit')
->schema([
TextInput::make('form_embed')
->label(__('to embed the form in any post or page'))
->dehydrated(false)
->disabled()
->formatStateUsing(function (Get $get) {
return '<bolt>' . $get('slug') . '</bolt>';
}),
]),

Tabs\Tab::make('design')
->label(__('Design'))
->visible(class_exists(\LaraZeus\BoltPro\BoltProServiceProvider::class) && config('zeus-bolt.allow_design'))
Expand Down
17 changes: 16 additions & 1 deletion src/Filament/Resources/FormResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ public static function getPages(): array
if (class_exists(\LaraZeus\BoltPro\BoltProServiceProvider::class)) {
//@phpstan-ignore-next-line
$pages['prefilled'] = \LaraZeus\BoltPro\Livewire\PrefilledForm::route('/{record}/prefilled');
//@phpstan-ignore-next-line
$pages['share'] = \LaraZeus\BoltPro\Livewire\ShareForm::route('/{record}/share');
}

return $pages;
Expand Down Expand Up @@ -256,11 +258,24 @@ public static function getActions(): array

public static function getRecordSubNavigation(Page $page): array
{
return $page->generateNavigationItems([
$formNavs = [
Pages\ViewForm::class,
Pages\EditForm::class,
];

if (class_exists(\LaraZeus\BoltPro\BoltProServiceProvider::class)) {
//@phpstan-ignore-next-line
$formNavs[] = \LaraZeus\BoltPro\Livewire\ShareForm::class;
}

$respNavs = [
Pages\ManageResponses::class,
Pages\BrowseResponses::class,
];

return $page->generateNavigationItems([
...$formNavs,
...$respNavs,
]);
}
}

0 comments on commit c471f5f

Please sign in to comment.