Sha256: cef2519bf10bdec448c62d6e11475fea319348677733fc11d46e01300dc92ee9
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
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 })) <% 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.ts.svelte.tt |