Lib: Use progressive form enhancement for all cards
This commit is contained in:
@ -6,6 +6,7 @@
|
||||
import { getModalStore, type ModalStore } from "@skeletonlabs/skeleton";
|
||||
import { DRIVER_HEADSHOT_HEIGHT, DRIVER_HEADSHOT_WIDTH } from "$lib/config";
|
||||
import { driver_dropdown_options } from "$lib/dropdown";
|
||||
import { enhance } from "$app/forms";
|
||||
|
||||
interface RacePickCardProps {
|
||||
/** The [RacePick] object used to prefill values. */
|
||||
@ -91,7 +92,7 @@
|
||||
imgheight={DRIVER_HEADSHOT_HEIGHT}
|
||||
imgonclick={(event: Event) => modalStore.close()}
|
||||
>
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
<form method="POST" enctype="multipart/form-data" use:enhance>
|
||||
<!-- This is also disabled, because the ID should only be -->
|
||||
<!-- "leaked" to users that are allowed to use the inputs -->
|
||||
{#if racepick && !disable_inputs}
|
||||
@ -134,6 +135,7 @@
|
||||
disabled={disable_inputs}
|
||||
submit
|
||||
width="w-1/2"
|
||||
onclick={() => modalStore.close()}
|
||||
>
|
||||
Save Changes
|
||||
</Button>
|
||||
@ -143,11 +145,18 @@
|
||||
disabled={disable_inputs}
|
||||
formaction="?/delete_racepick"
|
||||
width="w-1/2"
|
||||
onclick={() => modalStore.close()}
|
||||
>
|
||||
Delete
|
||||
</Button>
|
||||
{:else}
|
||||
<Button formaction="?/create_racepick" color="tertiary" submit width="w-full">
|
||||
<Button
|
||||
formaction="?/create_racepick"
|
||||
color="tertiary"
|
||||
submit
|
||||
width="w-full"
|
||||
onclick={() => modalStore.close()}
|
||||
>
|
||||
Make Pick
|
||||
</Button>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user