Sha256: 3c5dbeed699bc0788de262cdb5d96368885a086f09c226b32c5282d481b43009

Contents?: true

Size: 903 Bytes

Versions: 1

Compression:

Stored size: 903 Bytes

Contents

<script>
  import { Link } from '@inertiajs/svelte'
  import Form from './Form.svelte'

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

  const handleSubmit = ({ form }) => {
    form.transform((data) => ({ <%= singular_table_name %>: data }))
<% if attributes.any?(&:attachments?) -%>
    form.post(`<%= js_resource_path %>`, {
      headers: { 'X-HTTP-METHOD-OVERRIDE': 'put' },
    })
<% else -%>
    form.patch(`<%= js_resource_path %>`)
<% end -%>
  }
</script>

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

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

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

<br />

<div>
  <Link href={`<%= js_resource_path %>`}>Show this <%= human_name.downcase %></Link> |
  <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/Edit.svelte.tt