Sha256: cba1511e246a612a38fb2d35e1d82dd693326f417d12aa0c8d0018343fe736d4

Contents?: true

Size: 1.13 KB

Versions: 6

Compression:

Stored size: 1.13 KB

Contents

import { Link, Head } from '@inertiajs/react'
import <%= inertia_component_name %> from './<%= inertia_component_name %>'

export default function Show({ <%= singular_table_name %>, flash }) {
  const onDestroy = (e) => {
    if (!confirm('Are you sure you want to delete this <%= human_name.downcase %>?')) {
      e.preventDefault()
    }
  }

  return (
    <>
      <Head title={`<%= human_name %> #${<%= singular_table_name %>.id}`} />

      {flash.notice && <p style={{ color: 'green' }}>{flash.notice}</p>}

      <h1><%= human_name %> #{<%= singular_table_name %>.id}</h1>

      <<%= inertia_component_name %> <%= singular_table_name %>={<%= singular_table_name %>} />

      <div>
        <Link href={`<%= js_edit_resource_path %>`}>Edit this <%= human_name.downcase %></Link>
        {' | '}
        <Link href="<%= js_resources_path %>">Back to <%= human_name.pluralize.downcase %></Link>

        <br />

        <Link
          href={`<%= js_resource_path %>`}
          onClick={onDestroy}
          as="button"
          method="delete"
        >
          Destroy this <%= human_name.downcase %>
        </Link>
      </div>
    </>
  )
}

Version data entries

6 entries across 6 versions & 1 rubygems

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