Sha256: a093252390c1a0b9aee990de207526738162b90f31f6df8b5eb907bd4ecbe5e3

Contents?: true

Size: 1012 Bytes

Versions: 5

Compression:

Stored size: 1012 Bytes

Contents

import { Link, Head } from '@inertiajs/react'
import Form from './Form'

export default function Edit({ <%= singular_table_name %> }) {
  return (
    <>
      <Head title="Editing <%= human_name.downcase %>" />

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

      <Form
        <%= singular_table_name %>={<%= singular_table_name %>}
        onSubmit={(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 -%>
        }}
        submitText="Update <%= human_name.downcase %>"
      />

      <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

5 entries across 5 versions & 1 rubygems

Version Path
inertia_rails-contrib-0.3.0 lib/generators/inertia_templates/scaffold/templates/react/Edit.jsx.tt
inertia_rails-contrib-0.2.2 lib/generators/inertia_templates/scaffold/templates/react/Edit.jsx.tt
inertia_rails-contrib-0.2.1 lib/generators/inertia_templates/scaffold/templates/react/Edit.jsx.tt
inertia_rails-contrib-0.2.0 lib/generators/inertia_templates/scaffold/templates/react/Edit.jsx.tt
inertia_rails-contrib-0.1.1 lib/generators/inertia_templates/scaffold/templates/react/Edit.jsx.tt