Sha256: d1094e79b285ec665f3b1db6d845c2c349175bcfc78ecd2bb8634628a5c5988f

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

<script>
  import { Link } from '@inertiajs/svelte'
  import <%= inertia_component_name %> from './<%= inertia_component_name %>.svelte'

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

  const onDestroy = (e) => {
    if (!confirm('Are you sure you want to delete this <%= human_name.downcase %>?')) {
      e.preventDefault()
    }
  }
</script>

<svelte:head>
  <title><%= human_name %> #{<%= singular_table_name %>.id}</title>
</svelte:head>

{#if flash.notice}
  <p class="notice">{flash.notice}</p>
{/if}

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

<<%= inertia_component_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 %>`} method="delete" onclick={onDestroy}>
    Destroy this <%= human_name.downcase %>
  </Link>
</div>

<style>
  .notice {
    color: green;
  }
</style>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
inertia_rails-contrib-0.3.0 lib/generators/inertia_templates/scaffold/templates/svelte/Show.svelte.tt