Sha256: 9018b40cf2cc1c06bf3f8d95a85291ac352c25ed077c0b8a85af65ccc7316cbb

Contents?: true

Size: 1.08 KB

Versions: 6

Compression:

Stored size: 1.08 KB

Contents

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

  export let <%= singular_table_name %>
  export let flash

  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 />

  <button
    use:inertia={{ href: `<%= js_resource_path %>`, method: 'delete' }}
    on:click={onDestroy}
    type="button"
  >
    Destroy this <%= human_name.downcase %>
  </button>
</div>

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

Version data entries

6 entries across 6 versions & 1 rubygems

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