Sha256: 92cc050e494e081691946dd3e7fd584b5efc94d06339ceeae3ef56371c7fb648

Contents?: true

Size: 884 Bytes

Versions: 1

Compression:

Stored size: 884 Bytes

Contents

<script lang="ts">
  import { Link, type InertiaFormProps } from '@inertiajs/svelte'
  import type { <%= inertia_model_type %>, <%= inertia_model_form_type %> } from './types'
  import Form from './Form.svelte'

  let { <%= singular_table_name %> } = $props<{ <%= singular_table_name %>: <%= inertia_model_type %> }>()

  const handleSubmit = ({ form }: { form: InertiaFormProps<<%= inertia_model_form_type %>> }) => {
    form.transform((data) => ({ <%= singular_table_name %>: data }))
    form.post('<%= js_resources_path %>')
  }
</script>

<svelte:head>
  <title>New <%= human_name.downcase %></title>
</svelte:head>

<h1>New <%= human_name.downcase %></h1>

<Form
  {<%= singular_table_name %>}
  submitText="Create <%= human_name %>"
  onSubmit={handleSubmit}
/>

<br />

<div>
  <Link href="<%= js_resources_path %>">Back to <%= human_name.pluralize.downcase %></Link>
</div>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
inertia_rails-3.5.0 lib/generators/inertia_templates/scaffold/templates/svelte/New.ts.svelte.tt