Skip to content

Commit f189ba5

Browse files
committed
Drop onDestroy alert to align with Rails scaffolds
1 parent 49e6f31 commit f189ba5

File tree

16 files changed

+2
-112
lines changed

16 files changed

+2
-112
lines changed

lib/generators/inertia_templates/scaffold/templates/react/Show.jsx.tt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@ import { Link, Head } from '@inertiajs/react'
22
import <%= inertia_component_name %> from './<%= inertia_component_name %>'
33

44
export default function Show({ <%= singular_table_name %>, flash }) {
5-
const onDestroy = (e) => {
6-
if (!confirm('Are you sure you want to delete this <%= human_name.downcase %>?')) {
7-
e.preventDefault()
8-
}
9-
}
10-
115
return (
126
<>
137
<Head title={`<%= human_name %> #${<%= singular_table_name %>.id}`} />
@@ -27,7 +21,6 @@ export default function Show({ <%= singular_table_name %>, flash }) {
2721

2822
<Link
2923
href={`<%= js_resource_path %>`}
30-
onClick={onDestroy}
3124
as="button"
3225
method="delete"
3326
>

lib/generators/inertia_templates/scaffold/templates/react/Show.tsx.tt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ interface ShowProps {
99
}
1010

1111
export default function Show({ <%= singular_table_name %>, flash }: ShowProps) {
12-
const onDestroy = (e: MouseEvent) => {
13-
if (!confirm('Are you sure you want to delete this <%= human_name.downcase %>?')) {
14-
e.preventDefault()
15-
}
16-
}
17-
1812
return (
1913
<>
2014
<Head title={`<%= human_name %> #${<%= singular_table_name %>.id}`} />
@@ -34,7 +28,6 @@ export default function Show({ <%= singular_table_name %>, flash }: ShowProps) {
3428

3529
<Link
3630
href={`<%= js_resource_path %>`}
37-
onClick={onDestroy}
3831
as="button"
3932
method="delete"
4033
>

lib/generators/inertia_templates/scaffold/templates/svelte/Show.svelte.tt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
import <%= inertia_component_name %> from './<%= inertia_component_name %>.svelte'
44

55
let { <%= singular_table_name %>, flash } = $props()
6-
7-
const onDestroy = (e) => {
8-
if (!confirm('Are you sure you want to delete this <%= human_name.downcase %>?')) {
9-
e.preventDefault()
10-
}
11-
}
126
</script>
137

148
<svelte:head>
@@ -29,7 +23,7 @@
2923

3024
<br />
3125

32-
<Link href={`<%= js_resource_path %>`} method="delete" onclick={onDestroy}>
26+
<Link href={`<%= js_resource_path %>`} method="delete">
3327
Destroy this <%= human_name.downcase %>
3428
</Link>
3529
</div>

lib/generators/inertia_templates/scaffold/templates/svelte/Show.ts.svelte.tt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77
<%= singular_table_name %>: <%= inertia_model_type %>
88
flash: { notice?: string }
99
}>()
10-
11-
const onDestroy = (e: MouseEvent) => {
12-
if (!confirm('Are you sure you want to delete this <%= human_name.downcase %>?')) {
13-
e.preventDefault()
14-
}
15-
}
1610
</script>
1711

1812
<svelte:head>
@@ -33,7 +27,7 @@
3327

3428
<br />
3529

36-
<Link href={`<%= js_resource_path %>`} method="delete" onclick={onDestroy}>
30+
<Link href={`<%= js_resource_path %>`} method="delete">
3731
Destroy this <%= human_name.downcase %>
3832
</Link>
3933
</div>

lib/generators/inertia_templates/scaffold/templates/svelte4/Show.svelte.tt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44

55
export let <%= singular_table_name %>
66
export let flash
7-
8-
const onDestroy = (e) => {
9-
if (!confirm('Are you sure you want to delete this <%= human_name.downcase %>?')) {
10-
e.preventDefault()
11-
}
12-
}
137
</script>
148

159
<svelte:head>
@@ -32,7 +26,6 @@
3226

3327
<button
3428
use:inertia={{ href: `<%= js_resource_path %>`, method: 'delete' }}
35-
on:click={onDestroy}
3629
type="button"
3730
>
3831
Destroy this <%= human_name.downcase %>

lib/generators/inertia_templates/scaffold/templates/svelte4/Show.ts.svelte.tt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55

66
export let <%= singular_table_name %>: <%= inertia_model_type %>
77
export let flash: { notice?: string }
8-
9-
const onDestroy = (e: MouseEvent) => {
10-
if (!confirm('Are you sure you want to delete this <%= human_name.downcase %>?')) {
11-
e.preventDefault()
12-
}
13-
}
148
</script>
159

1610
<svelte:head>
@@ -33,7 +27,6 @@
3327

3428
<button
3529
use:inertia={{ href: `<%= js_resource_path %>`, method: 'delete' }}
36-
on:click={onDestroy}
3730
type="button"
3831
>
3932
Destroy this <%= human_name.downcase %>

lib/generators/inertia_templates/scaffold/templates/vue/Show.ts.vue.tt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
<Link
1717
:href="`<%= js_resource_path %>`"
18-
@click="onDestroy"
1918
as="button"
2019
method="delete"
2120
>
@@ -33,12 +32,6 @@ const { <%= singular_table_name %>, flash } = defineProps<{
3332
<%= singular_table_name %>: <%= inertia_model_type %>
3433
flash: { notice?: string }
3534
}>()
36-
37-
const onDestroy = (e: Event) => {
38-
if (!confirm('Are you sure you want to delete this <%= human_name.downcase %>?')) {
39-
e.preventDefault()
40-
}
41-
}
4235
</script>
4336

4437
<style scoped>

lib/generators/inertia_templates/scaffold/templates/vue/Show.vue.tt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
<Link
1717
:href="`<%= js_resource_path %>`"
18-
@click="onDestroy"
1918
as="button"
2019
method="delete"
2120
>
@@ -29,12 +28,6 @@ import { Link, Head } from '@inertiajs/vue3'
2928
import <%= inertia_component_name %> from './<%= inertia_component_name %>.vue'
3029

3130
const { <%= singular_table_name %>, flash } = defineProps(['<%= singular_table_name %>', 'flash'])
32-
33-
const onDestroy = (e) => {
34-
if (!confirm('Are you sure you want to delete this <%= human_name.downcase %>?')) {
35-
e.preventDefault()
36-
}
37-
}
3831
</script>
3932

4033
<style scoped>

lib/generators/inertia_tw_templates/scaffold/templates/react/Show.jsx.tt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@ import { Link, Head } from '@inertiajs/react'
22
import <%= inertia_component_name %> from './<%= inertia_component_name %>'
33

44
export default function Show({ <%= singular_table_name %>, flash }) {
5-
const onDestroy = (e) => {
6-
if (!confirm('Are you sure you want to delete this <%= human_name.downcase %>?')) {
7-
e.preventDefault()
8-
}
9-
}
10-
115
return (
126
<>
137
<Head title={`<%= human_name %> #${<%= singular_table_name %>.id}`} />
@@ -39,7 +33,6 @@ export default function Show({ <%= singular_table_name %>, flash }) {
3933
<div className="inline-block ml-2">
4034
<Link
4135
href={`<%= js_resource_path %>`}
42-
onClick={onDestroy}
4336
as="button"
4437
method="delete"
4538
className="mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium"

lib/generators/inertia_tw_templates/scaffold/templates/react/Show.tsx.tt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ interface ShowProps {
99
}
1010

1111
export default function Show({ <%= singular_table_name %>, flash }: ShowProps) {
12-
const onDestroy = (e: MouseEvent) => {
13-
if (!confirm('Are you sure you want to delete this <%= human_name.downcase %>?')) {
14-
e.preventDefault()
15-
}
16-
}
17-
1812
return (
1913
<>
2014
<Head title={`<%= human_name %> #${<%= singular_table_name %>.id}`} />
@@ -46,7 +40,6 @@ export default function Show({ <%= singular_table_name %>, flash }: ShowProps) {
4640
<div className="inline-block ml-2">
4741
<Link
4842
href={`<%= js_resource_path %>`}
49-
onClick={onDestroy}
5043
as="button"
5144
method="delete"
5245
className="mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium"

lib/generators/inertia_tw_templates/scaffold/templates/svelte/Show.svelte.tt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
import <%= inertia_component_name %> from './<%= inertia_component_name %>.svelte'
44

55
let { <%= singular_table_name %>, flash } = $props()
6-
7-
const onDestroy = (e) => {
8-
if (!confirm('Are you sure you want to delete this <%= human_name.downcase %>?')) {
9-
e.preventDefault()
10-
}
11-
}
126
</script>
137

148
<svelte:head>
@@ -43,7 +37,6 @@
4337
<Link
4438
href={`<%= js_resource_path %>`}
4539
method="delete"
46-
onclick={onDestroy}
4740
class="mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium"
4841
>
4942
Destroy this <%= human_name.downcase %>

lib/generators/inertia_tw_templates/scaffold/templates/svelte/Show.ts.svelte.tt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77
<%= singular_table_name %>: <%= inertia_model_type %>
88
flash: { notice?: string }
99
}>()
10-
11-
const onDestroy = (e: MouseEvent) => {
12-
if (!confirm('Are you sure you want to delete this <%= human_name.downcase %>?')) {
13-
e.preventDefault()
14-
}
15-
}
1610
</script>
1711

1812
<svelte:head>
@@ -47,7 +41,6 @@
4741
<Link
4842
href={`<%= js_resource_path %>`}
4943
method="delete"
50-
onclick={onDestroy}
5144
class="mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium"
5245
>
5346
Destroy this <%= human_name.downcase %>

lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Show.svelte.tt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44

55
export let <%= singular_table_name %>
66
export let flash
7-
8-
const onDestroy = (e) => {
9-
if (!confirm('Are you sure you want to delete this <%= human_name.downcase %>?')) {
10-
e.preventDefault()
11-
}
12-
}
137
</script>
148

159
<svelte:head>
@@ -43,7 +37,6 @@
4337
<div class="inline-block ml-2">
4438
<button
4539
use:inertia={{ href: `<%= js_resource_path %>`, method: 'delete' }}
46-
on:click={onDestroy}
4740
type="button"
4841
class="mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium"
4942
>

lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Show.ts.svelte.tt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55

66
export let <%= singular_table_name %>: <%= inertia_model_type %>
77
export let flash: { notice?: string }
8-
9-
const onDestroy = (e: MouseEvent) => {
10-
if (!confirm('Are you sure you want to delete this <%= human_name.downcase %>?')) {
11-
e.preventDefault()
12-
}
13-
}
148
</script>
159

1610
<svelte:head>
@@ -44,7 +38,6 @@
4438
<div class="inline-block ml-2">
4539
<button
4640
use:inertia={{ href: `<%= js_resource_path %>`, method: 'delete' }}
47-
on:click={onDestroy}
4841
type="button"
4942
class="mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium"
5043
>

lib/generators/inertia_tw_templates/scaffold/templates/vue/Show.ts.vue.tt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
<div class="inline-block ml-2">
3131
<Link
3232
:href="`<%= js_resource_path %>`"
33-
@click="onDestroy"
3433
as="button"
3534
method="delete"
3635
class="mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium"
@@ -51,10 +50,4 @@ const { <%= singular_table_name %>, flash } = defineProps<{
5150
<%= singular_table_name %>: <%= inertia_model_type %>
5251
flash: { notice?: string }
5352
}>()
54-
55-
const onDestroy = (e: Event) => {
56-
if (!confirm('Are you sure you want to delete this <%= human_name.downcase %>?')) {
57-
e.preventDefault()
58-
}
59-
}
6053
</script>

lib/generators/inertia_tw_templates/scaffold/templates/vue/Show.vue.tt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
<div class="inline-block ml-2">
3131
<Link
3232
:href="`<%= js_resource_path %>`"
33-
@click="onDestroy"
3433
as="button"
3534
method="delete"
3635
class="mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium"
@@ -47,10 +46,4 @@ import { Link, Head } from '@inertiajs/vue3'
4746
import <%= inertia_component_name %> from './<%= inertia_component_name %>.vue'
4847

4948
const { <%= singular_table_name %>, flash } = defineProps(['<%= singular_table_name %>', 'flash'])
50-
51-
const onDestroy = (e) => {
52-
if (!confirm('Are you sure you want to delete this <%= human_name.downcase %>?')) {
53-
e.preventDefault()
54-
}
55-
}
5649
</script>

0 commit comments

Comments
 (0)