inertia_rails 3.12.1 → 3.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/generators/inertia/controller/templates/controller.rb.tt +1 -1
- data/lib/generators/inertia/install/frameworks.yml +16 -36
- data/lib/generators/inertia/install/install_generator.rb +51 -8
- data/lib/generators/inertia/install/js_package_manager.rb +6 -6
- data/lib/generators/inertia/install/templates/controller.rb +2 -4
- data/lib/generators/inertia/install/templates/inertia_controller.rb +5 -0
- data/lib/generators/inertia/install/templates/react/InertiaExample.jsx +2 -2
- data/lib/generators/inertia/install/templates/react/InertiaExample.tsx +2 -2
- data/lib/generators/inertia/install/templates/react/inertia.jsx +65 -0
- data/lib/generators/inertia/install/templates/react/inertia.tsx +65 -0
- data/lib/generators/inertia/install/templates/react/tsconfig.app.json +7 -0
- data/lib/generators/inertia/install/templates/react/types/globals.d.ts +8 -0
- data/lib/generators/inertia/install/templates/react/types/index.ts +8 -0
- data/lib/generators/inertia/install/templates/svelte/InertiaExample.svelte +1 -1
- data/lib/generators/inertia/install/templates/svelte/InertiaExample.ts.svelte +1 -1
- data/lib/generators/inertia/install/templates/svelte/inertia.js +14 -3
- data/lib/generators/inertia/install/templates/svelte/{inertia.ts.tt → inertia.ts} +12 -2
- data/lib/generators/inertia/install/templates/svelte/tsconfig.json +8 -0
- data/lib/generators/inertia/install/templates/svelte/types/globals.d.ts +8 -0
- data/lib/generators/inertia/install/templates/svelte/types/index.ts +8 -0
- data/lib/generators/inertia/install/templates/tailwind/application.css +3 -3
- data/lib/generators/inertia/install/templates/vue/InertiaExample.ts.vue +1 -1
- data/lib/generators/inertia/install/templates/vue/InertiaExample.vue +1 -1
- data/lib/generators/inertia/install/templates/vue/inertia.js +30 -3
- data/lib/generators/inertia/install/templates/vue/inertia.ts +31 -3
- data/lib/generators/inertia/install/templates/vue/tsconfig.app.json +9 -1
- data/lib/generators/inertia/install/templates/vue/types/globals.d.ts +8 -0
- data/lib/generators/inertia/install/templates/vue/types/index.ts +8 -0
- data/lib/generators/inertia/scaffold_controller/scaffold_controller_generator.rb +4 -0
- data/lib/generators/inertia/scaffold_controller/templates/controller.rb.tt +7 -5
- data/lib/generators/inertia_templates/scaffold/templates/react/{Edit.jsx.tt → edit.jsx.tt} +5 -8
- data/lib/generators/inertia_templates/scaffold/templates/react/{Edit.tsx.tt → edit.tsx.tt} +7 -9
- data/lib/generators/inertia_templates/scaffold/templates/react/form.jsx.tt +94 -0
- data/lib/generators/inertia_templates/scaffold/templates/react/form.tsx.tt +109 -0
- data/lib/generators/inertia_templates/scaffold/templates/react/{Index.jsx.tt → index.jsx.tt} +1 -1
- data/lib/generators/inertia_templates/scaffold/templates/react/{Index.tsx.tt → index.tsx.tt} +1 -1
- data/lib/generators/inertia_templates/scaffold/templates/react/{New.jsx.tt → new.jsx.tt} +3 -5
- data/lib/generators/inertia_templates/scaffold/templates/react/{New.tsx.tt → new.tsx.tt} +5 -6
- data/lib/generators/inertia_templates/scaffold/templates/react/{Show.jsx.tt → show.jsx.tt} +1 -1
- data/lib/generators/inertia_templates/scaffold/templates/react/{Show.tsx.tt → show.tsx.tt} +1 -1
- data/lib/generators/inertia_templates/scaffold/templates/svelte/{Edit.svelte.tt → edit.svelte.tt} +9 -13
- data/lib/generators/inertia_templates/scaffold/templates/{svelte4/Edit.svelte.tt → svelte/edit.ts.svelte.tt} +11 -15
- data/lib/generators/inertia_templates/scaffold/templates/svelte/form.svelte.tt +96 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte/form.ts.svelte.tt +103 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte/{Index.svelte.tt → index.svelte.tt} +1 -1
- data/lib/generators/inertia_templates/scaffold/templates/svelte/{Index.ts.svelte.tt → index.ts.svelte.tt} +1 -1
- data/lib/generators/inertia_templates/scaffold/templates/svelte/{New.svelte.tt → new.svelte.tt} +4 -7
- data/lib/generators/inertia_templates/scaffold/templates/{svelte4/New.svelte.tt → svelte/new.ts.svelte.tt} +6 -9
- data/lib/generators/inertia_templates/scaffold/templates/svelte/{Show.svelte.tt → show.svelte.tt} +1 -1
- data/lib/generators/inertia_templates/scaffold/templates/svelte/{Show.ts.svelte.tt → show.ts.svelte.tt} +1 -1
- data/lib/generators/inertia_templates/scaffold/templates/vue/{Edit.ts.vue.tt → edit.ts.vue.tt} +11 -15
- data/lib/generators/inertia_templates/scaffold/templates/vue/{Edit.vue.tt → edit.vue.tt} +9 -13
- data/lib/generators/inertia_templates/scaffold/templates/vue/form.ts.vue.tt +102 -0
- data/lib/generators/inertia_templates/scaffold/templates/vue/form.vue.tt +98 -0
- data/lib/generators/inertia_templates/scaffold/templates/vue/{Index.ts.vue.tt → index.ts.vue.tt} +1 -1
- data/lib/generators/inertia_templates/scaffold/templates/vue/{Index.vue.tt → index.vue.tt} +1 -1
- data/lib/generators/inertia_templates/scaffold/templates/vue/{New.ts.vue.tt → new.ts.vue.tt} +6 -9
- data/lib/generators/inertia_templates/scaffold/templates/vue/{New.vue.tt → new.vue.tt} +4 -7
- data/lib/generators/inertia_templates/scaffold/templates/vue/{Show.ts.vue.tt → show.ts.vue.tt} +1 -1
- data/lib/generators/inertia_templates/scaffold/templates/vue/{Show.vue.tt → show.vue.tt} +1 -1
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/{Edit.jsx.tt → edit.jsx.tt} +5 -8
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/{Edit.tsx.tt → edit.tsx.tt} +6 -9
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/form.jsx.tt +106 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/form.tsx.tt +122 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/{Index.jsx.tt → index.jsx.tt} +1 -1
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/{Index.tsx.tt → index.tsx.tt} +1 -1
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/{New.jsx.tt → new.jsx.tt} +3 -5
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/{New.tsx.tt → new.tsx.tt} +4 -6
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/{Show.jsx.tt → show.jsx.tt} +1 -1
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/{Show.tsx.tt → show.tsx.tt} +1 -1
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/{Edit.svelte.tt → edit.svelte.tt} +9 -13
- data/lib/generators/inertia_tw_templates/scaffold/templates/{svelte4/Edit.svelte.tt → svelte/edit.ts.svelte.tt} +11 -15
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/form.svelte.tt +109 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/form.ts.svelte.tt +115 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/{Index.svelte.tt → index.svelte.tt} +1 -1
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/{Index.ts.svelte.tt → index.ts.svelte.tt} +1 -1
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/{New.svelte.tt → new.svelte.tt} +4 -6
- data/lib/generators/inertia_tw_templates/scaffold/templates/{svelte4/New.svelte.tt → svelte/new.ts.svelte.tt} +6 -9
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/{Show.svelte.tt → show.svelte.tt} +1 -1
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/{Show.ts.svelte.tt → show.ts.svelte.tt} +1 -1
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/{Edit.ts.vue.tt → edit.ts.vue.tt} +10 -15
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/{Edit.vue.tt → edit.vue.tt} +8 -13
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/{Form.ts.vue.tt → form.ts.vue.tt} +19 -42
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/{Form.vue.tt → form.vue.tt} +18 -38
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/{Index.ts.vue.tt → index.ts.vue.tt} +1 -1
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/{Index.vue.tt → index.vue.tt} +1 -1
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/{New.ts.vue.tt → new.ts.vue.tt} +6 -9
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/{New.vue.tt → new.vue.tt} +4 -7
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/{Show.ts.vue.tt → show.ts.vue.tt} +1 -1
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/{Show.vue.tt → show.vue.tt} +1 -1
- data/lib/inertia_rails/generators/controller_template_base.rb +1 -1
- data/lib/inertia_rails/generators/helper.rb +2 -3
- data/lib/inertia_rails/generators/scaffold_template_base.rb +3 -3
- data/lib/inertia_rails/version.rb +1 -1
- metadata +87 -116
- data/lib/generators/inertia/install/templates/react/inertia.js +0 -45
- data/lib/generators/inertia/install/templates/react/inertia.ts +0 -51
- data/lib/generators/inertia/install/templates/svelte4/InertiaExample.svelte +0 -116
- data/lib/generators/inertia/install/templates/svelte4/InertiaExample.ts.svelte +0 -116
- data/lib/generators/inertia/install/templates/svelte4/inertia.js +0 -43
- data/lib/generators/inertia/install/templates/svelte4/inertia.ts.tt +0 -44
- data/lib/generators/inertia/install/templates/svelte4/svelte.config.js +0 -7
- data/lib/generators/inertia/install/templates/svelte4/tsconfig.json +0 -21
- data/lib/generators/inertia/install/templates/svelte4/tsconfig.node.json +0 -12
- data/lib/generators/inertia/install/templates/svelte4/vite-env.d.ts +0 -2
- data/lib/generators/inertia_templates/controller/templates/svelte4/view.svelte.tt +0 -2
- data/lib/generators/inertia_templates/scaffold/templates/react/Form.jsx.tt +0 -111
- data/lib/generators/inertia_templates/scaffold/templates/react/Form.tsx.tt +0 -130
- data/lib/generators/inertia_templates/scaffold/templates/svelte/Edit.ts.svelte.tt +0 -37
- data/lib/generators/inertia_templates/scaffold/templates/svelte/Form.svelte.tt +0 -97
- data/lib/generators/inertia_templates/scaffold/templates/svelte/Form.ts.svelte.tt +0 -102
- data/lib/generators/inertia_templates/scaffold/templates/svelte/New.ts.svelte.tt +0 -30
- data/lib/generators/inertia_templates/scaffold/templates/svelte4/Edit.ts.svelte.tt +0 -38
- data/lib/generators/inertia_templates/scaffold/templates/svelte4/Form.svelte.tt +0 -96
- data/lib/generators/inertia_templates/scaffold/templates/svelte4/Form.ts.svelte.tt +0 -106
- data/lib/generators/inertia_templates/scaffold/templates/svelte4/Index.svelte.tt +0 -36
- data/lib/generators/inertia_templates/scaffold/templates/svelte4/Index.ts.svelte.tt +0 -37
- data/lib/generators/inertia_templates/scaffold/templates/svelte4/New.ts.svelte.tt +0 -31
- data/lib/generators/inertia_templates/scaffold/templates/svelte4/One.svelte.tt +0 -28
- data/lib/generators/inertia_templates/scaffold/templates/svelte4/One.ts.svelte.tt +0 -30
- data/lib/generators/inertia_templates/scaffold/templates/svelte4/Show.svelte.tt +0 -39
- data/lib/generators/inertia_templates/scaffold/templates/svelte4/Show.ts.svelte.tt +0 -40
- data/lib/generators/inertia_templates/scaffold/templates/svelte4/types.ts.tt +0 -19
- data/lib/generators/inertia_templates/scaffold/templates/vue/Form.ts.vue.tt +0 -101
- data/lib/generators/inertia_templates/scaffold/templates/vue/Form.vue.tt +0 -94
- data/lib/generators/inertia_tw_templates/controller/templates/svelte4/view.svelte.tt +0 -2
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/Form.jsx.tt +0 -122
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/Form.tsx.tt +0 -142
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Edit.ts.svelte.tt +0 -45
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Form.svelte.tt +0 -118
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Form.ts.svelte.tt +0 -123
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/New.ts.svelte.tt +0 -33
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Edit.ts.svelte.tt +0 -46
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Form.svelte.tt +0 -120
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Form.ts.svelte.tt +0 -130
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Index.svelte.tt +0 -43
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Index.ts.svelte.tt +0 -44
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/New.ts.svelte.tt +0 -34
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/One.svelte.tt +0 -28
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/One.ts.svelte.tt +0 -30
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Show.svelte.tt +0 -51
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Show.ts.svelte.tt +0 -52
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/types.ts.tt +0 -19
- /data/lib/generators/inertia/install/templates/react/{vite-env.d.ts → types/vite-env.d.ts} +0 -0
- /data/lib/generators/inertia/install/templates/svelte/{vite-env.d.ts → types/vite-env.d.ts} +0 -0
- /data/lib/generators/inertia/install/templates/vue/{vite-env.d.ts → types/vite-env.d.ts} +0 -0
- /data/lib/generators/inertia_templates/scaffold/templates/react/{One.jsx.tt → one.jsx.tt} +0 -0
- /data/lib/generators/inertia_templates/scaffold/templates/react/{One.tsx.tt → one.tsx.tt} +0 -0
- /data/lib/generators/inertia_templates/scaffold/templates/svelte/{One.svelte.tt → one.svelte.tt} +0 -0
- /data/lib/generators/inertia_templates/scaffold/templates/svelte/{One.ts.svelte.tt → one.ts.svelte.tt} +0 -0
- /data/lib/generators/inertia_templates/scaffold/templates/vue/{One.ts.vue.tt → one.ts.vue.tt} +0 -0
- /data/lib/generators/inertia_templates/scaffold/templates/vue/{One.vue.tt → one.vue.tt} +0 -0
- /data/lib/generators/inertia_tw_templates/scaffold/templates/react/{One.jsx.tt → one.jsx.tt} +0 -0
- /data/lib/generators/inertia_tw_templates/scaffold/templates/react/{One.tsx.tt → one.tsx.tt} +0 -0
- /data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/{One.svelte.tt → one.svelte.tt} +0 -0
- /data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/{One.ts.svelte.tt → one.ts.svelte.tt} +0 -0
- /data/lib/generators/inertia_tw_templates/scaffold/templates/vue/{One.ts.vue.tt → one.ts.vue.tt} +0 -0
- /data/lib/generators/inertia_tw_templates/scaffold/templates/vue/{One.vue.tt → one.vue.tt} +0 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { Form } from '@inertiajs/svelte'
|
|
3
|
+
|
|
4
|
+
let { <%= singular_table_name %>, submitText, restProps } = $props()
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<Form
|
|
8
|
+
transform={(data) => ({ <%= singular_table_name %>: data })}
|
|
9
|
+
{...restProps}
|
|
10
|
+
>
|
|
11
|
+
{#snippet children({
|
|
12
|
+
errors,
|
|
13
|
+
processing,
|
|
14
|
+
})}
|
|
15
|
+
<% attributes.each do |attribute| -%>
|
|
16
|
+
<% if attribute.password_digest? -%>
|
|
17
|
+
<div>
|
|
18
|
+
<label for="password">Password</label>
|
|
19
|
+
<input
|
|
20
|
+
type="password"
|
|
21
|
+
name="password"
|
|
22
|
+
id="password"
|
|
23
|
+
/>
|
|
24
|
+
{#if errors.password}
|
|
25
|
+
<div class="error">{errors.password.join(', ')}</div>
|
|
26
|
+
{/if}
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<div>
|
|
30
|
+
<label for="password_confirmation">Password confirmation</label>
|
|
31
|
+
<input
|
|
32
|
+
type="password"
|
|
33
|
+
name="password_confirmation"
|
|
34
|
+
id="password_confirmation"
|
|
35
|
+
/>
|
|
36
|
+
{#if errors.password_confirmation}
|
|
37
|
+
<div class="error">{errors.password_confirmation.join(', ')}</div>
|
|
38
|
+
{/if}
|
|
39
|
+
</div>
|
|
40
|
+
<% else -%>
|
|
41
|
+
<div>
|
|
42
|
+
<label for="<%= attribute.singular_name %>"><%= attribute.human_name %></label>
|
|
43
|
+
<% if input_type(attribute) == "text_area" -%>
|
|
44
|
+
<textarea
|
|
45
|
+
name="<%= attribute.singular_name %>"
|
|
46
|
+
id="<%= attribute.singular_name %>"
|
|
47
|
+
defaultValue={<%= singular_table_name %>.<%= attribute.column_name %> ?? ''}
|
|
48
|
+
></textarea>
|
|
49
|
+
<% elsif attribute.attachment? -%>
|
|
50
|
+
<input
|
|
51
|
+
type="file"
|
|
52
|
+
name="<%= attribute.singular_name %>"
|
|
53
|
+
id="<%= attribute.singular_name %>"
|
|
54
|
+
/>
|
|
55
|
+
<% elsif attribute.attachments? -%>
|
|
56
|
+
<input
|
|
57
|
+
type="file"
|
|
58
|
+
multiple
|
|
59
|
+
name="<%= attribute.singular_name %>[]"
|
|
60
|
+
id="<%= attribute.singular_name %>"
|
|
61
|
+
/>
|
|
62
|
+
<% elsif input_type(attribute) == "checkbox" -%>
|
|
63
|
+
<input
|
|
64
|
+
type="<%= input_type(attribute) %>"
|
|
65
|
+
name="<%= attribute.singular_name %>"
|
|
66
|
+
id="<%= attribute.singular_name %>"
|
|
67
|
+
defaultChecked={<%= singular_table_name %>.<%= attribute.column_name %>}
|
|
68
|
+
/>
|
|
69
|
+
<% else -%>
|
|
70
|
+
<input
|
|
71
|
+
type="<%= input_type(attribute) %>"
|
|
72
|
+
name="<%= attribute.singular_name %>"
|
|
73
|
+
id="<%= attribute.singular_name %>"
|
|
74
|
+
defaultValue={<%= singular_table_name %>.<%= attribute.column_name %> ?? ''}
|
|
75
|
+
/>
|
|
76
|
+
<% end -%>
|
|
77
|
+
{#if errors.<%= attribute.column_name %>}
|
|
78
|
+
<div class="error">{errors.<%= attribute.column_name %>.join(', ')}</div>
|
|
79
|
+
{/if}
|
|
80
|
+
</div>
|
|
81
|
+
<% end -%>
|
|
82
|
+
<% end -%>
|
|
83
|
+
<div>
|
|
84
|
+
<button type="submit" disabled={processing}>{submitText}</button>
|
|
85
|
+
</div>
|
|
86
|
+
{/snippet}
|
|
87
|
+
</Form>
|
|
88
|
+
|
|
89
|
+
<style>
|
|
90
|
+
label {
|
|
91
|
+
display: block;
|
|
92
|
+
}
|
|
93
|
+
.error {
|
|
94
|
+
color: red;
|
|
95
|
+
}
|
|
96
|
+
</style>
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { type FormComponentSlotProps } from "@inertiajs/core"
|
|
3
|
+
import { Form } from '@inertiajs/svelte'
|
|
4
|
+
import type { ComponentProps } from 'svelte'
|
|
5
|
+
|
|
6
|
+
import type { <%= inertia_model_type %> } from './types'
|
|
7
|
+
|
|
8
|
+
let { <%= singular_table_name %>, submitText, ...restProps } = $props<{
|
|
9
|
+
<%= singular_table_name %>: <%= inertia_model_type %>
|
|
10
|
+
submitText: string
|
|
11
|
+
} & ComponentProps<Form>>()
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Form
|
|
15
|
+
transform={(data) => ({ <%= singular_table_name %>: data })}
|
|
16
|
+
{...restProps}
|
|
17
|
+
>
|
|
18
|
+
{#snippet children({
|
|
19
|
+
errors,
|
|
20
|
+
processing,
|
|
21
|
+
}: FormComponentSlotProps)}
|
|
22
|
+
<% attributes.each do |attribute| -%>
|
|
23
|
+
<% if attribute.password_digest? -%>
|
|
24
|
+
<div>
|
|
25
|
+
<label for="password">Password</label>
|
|
26
|
+
<input
|
|
27
|
+
type="password"
|
|
28
|
+
name="password"
|
|
29
|
+
id="password"
|
|
30
|
+
/>
|
|
31
|
+
{#if errors.password}
|
|
32
|
+
<div class="error">{errors.password}</div>
|
|
33
|
+
{/if}
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<div>
|
|
37
|
+
<label for="password_confirmation">Password confirmation</label>
|
|
38
|
+
<input
|
|
39
|
+
type="password"
|
|
40
|
+
name="password_confirmation"
|
|
41
|
+
id="password_confirmation"
|
|
42
|
+
/>
|
|
43
|
+
{#if errors.password_confirmation}
|
|
44
|
+
<div class="error">{errors.password_confirmation}</div>
|
|
45
|
+
{/if}
|
|
46
|
+
</div>
|
|
47
|
+
<% else -%>
|
|
48
|
+
<div>
|
|
49
|
+
<label for="<%= attribute.singular_name %>"><%= attribute.human_name %></label>
|
|
50
|
+
<% if input_type(attribute) == "text_area" -%>
|
|
51
|
+
<textarea
|
|
52
|
+
name="<%= attribute.singular_name %>"
|
|
53
|
+
id="<%= attribute.singular_name %>"
|
|
54
|
+
defaultValue={<%= singular_table_name %>.<%= attribute.column_name %> ?? ''}
|
|
55
|
+
></textarea>
|
|
56
|
+
<% elsif attribute.attachment? -%>
|
|
57
|
+
<input
|
|
58
|
+
type="file"
|
|
59
|
+
name="<%= attribute.singular_name %>"
|
|
60
|
+
id="<%= attribute.singular_name %>"
|
|
61
|
+
/>
|
|
62
|
+
<% elsif attribute.attachments? -%>
|
|
63
|
+
<input
|
|
64
|
+
type="file"
|
|
65
|
+
multiple
|
|
66
|
+
name="<%= attribute.singular_name %>[]"
|
|
67
|
+
id="<%= attribute.singular_name %>"
|
|
68
|
+
/>
|
|
69
|
+
<% elsif input_type(attribute) == "checkbox" -%>
|
|
70
|
+
<input
|
|
71
|
+
type="<%= input_type(attribute) %>"
|
|
72
|
+
name="<%= attribute.singular_name %>"
|
|
73
|
+
id="<%= attribute.singular_name %>"
|
|
74
|
+
defaultChecked={<%= singular_table_name %>.<%= attribute.column_name %>}
|
|
75
|
+
/>
|
|
76
|
+
<% else -%>
|
|
77
|
+
<input
|
|
78
|
+
type="<%= input_type(attribute) %>"
|
|
79
|
+
name="<%= attribute.singular_name %>"
|
|
80
|
+
id="<%= attribute.singular_name %>"
|
|
81
|
+
defaultValue={<%= singular_table_name %>.<%= attribute.column_name %> ?? ''}
|
|
82
|
+
/>
|
|
83
|
+
<% end -%>
|
|
84
|
+
{#if errors.<%= attribute.column_name %>}
|
|
85
|
+
<div class="error">{errors.<%= attribute.column_name %>}</div>
|
|
86
|
+
{/if}
|
|
87
|
+
</div>
|
|
88
|
+
<% end -%>
|
|
89
|
+
<% end -%>
|
|
90
|
+
<div>
|
|
91
|
+
<button type="submit" disabled={processing}>{submitText}</button>
|
|
92
|
+
</div>
|
|
93
|
+
{/snippet}
|
|
94
|
+
</Form>
|
|
95
|
+
|
|
96
|
+
<style>
|
|
97
|
+
label {
|
|
98
|
+
display: block;
|
|
99
|
+
}
|
|
100
|
+
.error {
|
|
101
|
+
color: red;
|
|
102
|
+
}
|
|
103
|
+
</style>
|
data/lib/generators/inertia_templates/scaffold/templates/svelte/{Index.svelte.tt → index.svelte.tt}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { Link } from '@inertiajs/svelte'
|
|
3
|
-
import <%= inertia_component_name %> from './<%=
|
|
3
|
+
import <%= inertia_component_name %> from './<%= singular_name %>.svelte'
|
|
4
4
|
|
|
5
5
|
let { <%= plural_table_name %>, flash } = $props()
|
|
6
6
|
</script>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Link } from '@inertiajs/svelte'
|
|
3
|
-
import <%= inertia_component_name %> from './<%=
|
|
3
|
+
import <%= inertia_component_name %> from './<%= singular_name %>.svelte'
|
|
4
4
|
import type { <%= inertia_model_type %> } from './types'
|
|
5
5
|
|
|
6
6
|
let { <%= plural_table_name %>, flash } = $props<{
|
data/lib/generators/inertia_templates/scaffold/templates/svelte/{New.svelte.tt → new.svelte.tt}
RENAMED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { Link } from '@inertiajs/svelte'
|
|
3
|
-
import Form from './Form.svelte'
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
import Form from './form.svelte'
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
form.transform((data) => ({ <%= singular_table_name %>: data }))
|
|
9
|
-
form.post('<%= js_resources_path %>')
|
|
10
|
-
}
|
|
6
|
+
let { <%= singular_table_name %> } = $props()
|
|
11
7
|
</script>
|
|
12
8
|
|
|
13
9
|
<svelte:head>
|
|
@@ -19,7 +15,8 @@
|
|
|
19
15
|
<Form
|
|
20
16
|
{<%= singular_table_name %>}
|
|
21
17
|
submitText="Create <%= human_name %>"
|
|
22
|
-
|
|
18
|
+
action="<%= js_resource_path %>"
|
|
19
|
+
method="post"
|
|
23
20
|
/>
|
|
24
21
|
|
|
25
22
|
<br />
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script lang="ts">
|
|
2
2
|
import { Link } from '@inertiajs/svelte'
|
|
3
|
-
import Form from './Form.svelte'
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
import type { <%= inertia_model_type %> } from './types'
|
|
5
|
+
import Form from './form.svelte'
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
const { form } = e.detail
|
|
9
|
-
form.transform((data) => ({ <%= singular_table_name %>: data }))
|
|
10
|
-
form.post('<%= js_resources_path %>')
|
|
11
|
-
}
|
|
7
|
+
let { <%= singular_table_name %> } = $props<{ <%= singular_table_name %>: <%= inertia_model_type %> }>()
|
|
12
8
|
</script>
|
|
13
9
|
|
|
14
10
|
<svelte:head>
|
|
@@ -20,7 +16,8 @@
|
|
|
20
16
|
<Form
|
|
21
17
|
{<%= singular_table_name %>}
|
|
22
18
|
submitText="Create <%= human_name %>"
|
|
23
|
-
|
|
19
|
+
action="<%= js_resource_path %>"
|
|
20
|
+
method="post"
|
|
24
21
|
/>
|
|
25
22
|
|
|
26
23
|
<br />
|
data/lib/generators/inertia_templates/scaffold/templates/svelte/{Show.svelte.tt → show.svelte.tt}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { Link } from '@inertiajs/svelte'
|
|
3
|
-
import <%= inertia_component_name %> from './<%=
|
|
3
|
+
import <%= inertia_component_name %> from './<%= singular_name %>.svelte'
|
|
4
4
|
|
|
5
5
|
let { <%= singular_table_name %>, flash } = $props()
|
|
6
6
|
</script>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Link } from '@inertiajs/svelte'
|
|
3
|
-
import <%= inertia_component_name %> from './<%=
|
|
3
|
+
import <%= inertia_component_name %> from './<%= singular_name %>.svelte'
|
|
4
4
|
import type { <%= inertia_model_type %> } from './types'
|
|
5
5
|
|
|
6
6
|
let { <%= singular_table_name %>, flash } = $props<{
|
data/lib/generators/inertia_templates/scaffold/templates/vue/{Edit.ts.vue.tt → edit.ts.vue.tt}
RENAMED
|
@@ -6,7 +6,13 @@
|
|
|
6
6
|
<Form
|
|
7
7
|
:<%= singular_table_name %>="<%= singular_table_name %>"
|
|
8
8
|
submitText="Update <%= human_name %>"
|
|
9
|
-
|
|
9
|
+
:action="`<%= js_resource_path %>`"
|
|
10
|
+
<% if attributes.any?(&:attachments?) -%>
|
|
11
|
+
method="post"
|
|
12
|
+
:headers="{ 'X-HTTP-METHOD-OVERRIDE': 'patch' }"
|
|
13
|
+
<% else -%>
|
|
14
|
+
method="patch"
|
|
15
|
+
<% end -%>
|
|
10
16
|
/>
|
|
11
17
|
|
|
12
18
|
<br />
|
|
@@ -18,20 +24,10 @@
|
|
|
18
24
|
</template>
|
|
19
25
|
|
|
20
26
|
<script setup lang="ts">
|
|
21
|
-
import { Head,
|
|
22
|
-
import Form from './Form.vue'
|
|
23
|
-
import { <%= inertia_model_form_type %>, <%= inertia_model_type %> } from './types'
|
|
27
|
+
import { Head, Link } from '@inertiajs/vue3'
|
|
24
28
|
|
|
25
|
-
|
|
29
|
+
import Form from './form.vue'
|
|
30
|
+
import type { <%= inertia_model_type %> } from './types'
|
|
26
31
|
|
|
27
|
-
const
|
|
28
|
-
form.transform((data) => ({ <%= singular_table_name %>: data }))
|
|
29
|
-
<% if attributes.any?(&:attachments?) -%>
|
|
30
|
-
form.post(`<%= js_resource_path %>`, {
|
|
31
|
-
headers: { 'X-HTTP-METHOD-OVERRIDE': 'put' },
|
|
32
|
-
})
|
|
33
|
-
<% else -%>
|
|
34
|
-
form.patch(`<%= js_resource_path %>`)
|
|
35
|
-
<% end -%>
|
|
36
|
-
}
|
|
32
|
+
const { <%= singular_table_name %> } = defineProps<{ <%= singular_table_name %>: <%= inertia_model_type %> }>()
|
|
37
33
|
</script>
|
|
@@ -6,7 +6,13 @@
|
|
|
6
6
|
<Form
|
|
7
7
|
:<%= singular_table_name %>="<%= singular_table_name %>"
|
|
8
8
|
submitText="Update <%= human_name %>"
|
|
9
|
-
|
|
9
|
+
:action="`<%= js_resource_path %>`"
|
|
10
|
+
<% if attributes.any?(&:attachments?) -%>
|
|
11
|
+
method="post"
|
|
12
|
+
:headers="{ 'X-HTTP-METHOD-OVERRIDE': 'patch' }"
|
|
13
|
+
<% else -%>
|
|
14
|
+
method="patch"
|
|
15
|
+
<% end -%>
|
|
10
16
|
/>
|
|
11
17
|
|
|
12
18
|
<br />
|
|
@@ -19,18 +25,8 @@
|
|
|
19
25
|
|
|
20
26
|
<script setup>
|
|
21
27
|
import { Head, Link } from '@inertiajs/vue3'
|
|
22
|
-
import Form from './Form.vue'
|
|
23
28
|
|
|
24
|
-
|
|
29
|
+
import Form from './form.vue'
|
|
25
30
|
|
|
26
|
-
const
|
|
27
|
-
form.transform((data) => ({ <%= singular_table_name %>: data }))
|
|
28
|
-
<% if attributes.any?(&:attachments?) -%>
|
|
29
|
-
form.post(`<%= js_resource_path %>`, {
|
|
30
|
-
headers: { 'X-HTTP-METHOD-OVERRIDE': 'put' },
|
|
31
|
-
})
|
|
32
|
-
<% else -%>
|
|
33
|
-
form.patch(`<%= js_resource_path %>`)
|
|
34
|
-
<% end -%>
|
|
35
|
-
}
|
|
31
|
+
const { <%= singular_table_name %> } = defineProps(['<%= singular_table_name %>'])
|
|
36
32
|
</script>
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Form
|
|
3
|
+
:transform="data => ({ <%= singular_table_name %>: data })"
|
|
4
|
+
v-slot="{ processing, errors }"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
>
|
|
7
|
+
<% attributes.each do |attribute| -%>
|
|
8
|
+
<% if attribute.password_digest? -%>
|
|
9
|
+
<div>
|
|
10
|
+
<label class="label" for="password">Password</label>
|
|
11
|
+
<input
|
|
12
|
+
type="password"
|
|
13
|
+
name="password"
|
|
14
|
+
id="password"
|
|
15
|
+
/>
|
|
16
|
+
<div v-if="errors.password" class="error">
|
|
17
|
+
{{ errors.password }}
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<div>
|
|
22
|
+
<label class="label" for="password_confirmation">
|
|
23
|
+
Password confirmation
|
|
24
|
+
</label>
|
|
25
|
+
<input
|
|
26
|
+
type="password"
|
|
27
|
+
name="password_confirmation"
|
|
28
|
+
id="password_confirmation"
|
|
29
|
+
/>
|
|
30
|
+
<div v-if="errors.password_confirmation" class="error">
|
|
31
|
+
{{ errors.password_confirmation }}
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
<% else -%>
|
|
35
|
+
<div>
|
|
36
|
+
<label class="label" for="<%= attribute.singular_name %>"><%= attribute.human_name %></label>
|
|
37
|
+
<% if input_type(attribute) == "text_area" -%>
|
|
38
|
+
<textarea
|
|
39
|
+
name="<%= attribute.singular_name %>"
|
|
40
|
+
id="<%= attribute.singular_name %>"
|
|
41
|
+
:value="<%= singular_table_name %>.<%= attribute.column_name %>"
|
|
42
|
+
/>
|
|
43
|
+
<% elsif attribute.attachment? -%>
|
|
44
|
+
<input
|
|
45
|
+
type="file"
|
|
46
|
+
name="<%= attribute.singular_name %>"
|
|
47
|
+
id="<%= attribute.singular_name %>"
|
|
48
|
+
/>
|
|
49
|
+
<% elsif attribute.attachments? -%>
|
|
50
|
+
<input
|
|
51
|
+
type="file"
|
|
52
|
+
multiple
|
|
53
|
+
name="<%= attribute.singular_name %>[]"
|
|
54
|
+
id="<%= attribute.singular_name %>"
|
|
55
|
+
/>
|
|
56
|
+
<% elsif input_type(attribute) == "checkbox" -%>
|
|
57
|
+
<input
|
|
58
|
+
type="<%= input_type(attribute) %>"
|
|
59
|
+
name="<%= attribute.singular_name %>"
|
|
60
|
+
id="<%= attribute.singular_name %>"
|
|
61
|
+
:checked="<%= singular_table_name %>.<%= attribute.column_name %>"
|
|
62
|
+
/>
|
|
63
|
+
<% else -%>
|
|
64
|
+
<input
|
|
65
|
+
type="<%= input_type(attribute) %>"
|
|
66
|
+
name="<%= attribute.singular_name %>"
|
|
67
|
+
id="<%= attribute.singular_name %>"
|
|
68
|
+
:value="<%= singular_table_name %>.<%= attribute.column_name %>"
|
|
69
|
+
/>
|
|
70
|
+
<% end -%>
|
|
71
|
+
<div v-if="errors.<%= attribute.column_name %>" class="error">
|
|
72
|
+
{{ errors.<%= attribute.column_name %> }}
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
<% end -%>
|
|
76
|
+
<% end -%>
|
|
77
|
+
<div>
|
|
78
|
+
<button type="submit" :disabled="processing">
|
|
79
|
+
{{ submitText }}
|
|
80
|
+
</button>
|
|
81
|
+
</div>
|
|
82
|
+
</Form>
|
|
83
|
+
</template>
|
|
84
|
+
|
|
85
|
+
<script setup lang="ts">
|
|
86
|
+
import { Form } from '@inertiajs/vue3'
|
|
87
|
+
import { <%= inertia_model_type %> } from './types'
|
|
88
|
+
|
|
89
|
+
const { <%= singular_table_name %>, submitText } = defineProps<{
|
|
90
|
+
<%= singular_table_name %>: <%= inertia_model_type %>
|
|
91
|
+
submitText: string
|
|
92
|
+
}>()
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
<style scoped>
|
|
96
|
+
.label {
|
|
97
|
+
display: block;
|
|
98
|
+
}
|
|
99
|
+
.error {
|
|
100
|
+
color: red;
|
|
101
|
+
}
|
|
102
|
+
</style>
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Form
|
|
3
|
+
:transform="data => ({ <%= singular_table_name %>: data })"
|
|
4
|
+
v-slot="{ processing, errors }"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
>
|
|
7
|
+
<% attributes.each do |attribute| -%>
|
|
8
|
+
<% if attribute.password_digest? -%>
|
|
9
|
+
<div>
|
|
10
|
+
<label class="label" for="password">Password</label>
|
|
11
|
+
<input
|
|
12
|
+
type="password"
|
|
13
|
+
name="password"
|
|
14
|
+
id="password"
|
|
15
|
+
/>
|
|
16
|
+
<div v-if="errors.password" class="error">
|
|
17
|
+
{{ errors.password.join(', ') }}
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<div>
|
|
22
|
+
<label class="label" for="password_confirmation">
|
|
23
|
+
Password confirmation
|
|
24
|
+
</label>
|
|
25
|
+
<input
|
|
26
|
+
type="password"
|
|
27
|
+
name="password_confirmation"
|
|
28
|
+
id="password_confirmation"
|
|
29
|
+
/>
|
|
30
|
+
<div v-if="errors.password_confirmation" class="error">
|
|
31
|
+
{{ errors.password_confirmation.join(', ') }}
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
<% else -%>
|
|
35
|
+
<div>
|
|
36
|
+
<label class="label" for="<%= attribute.singular_name %>"><%= attribute.human_name %></label>
|
|
37
|
+
<% if input_type(attribute) == "text_area" -%>
|
|
38
|
+
<textarea
|
|
39
|
+
name="<%= attribute.singular_name %>"
|
|
40
|
+
id="<%= attribute.singular_name %>"
|
|
41
|
+
:value="<%= singular_table_name %>.<%= attribute.column_name %>"
|
|
42
|
+
/>
|
|
43
|
+
<% elsif attribute.attachment? -%>
|
|
44
|
+
<input
|
|
45
|
+
type="file"
|
|
46
|
+
name="<%= attribute.singular_name %>"
|
|
47
|
+
id="<%= attribute.singular_name %>"
|
|
48
|
+
/>
|
|
49
|
+
<% elsif attribute.attachments? -%>
|
|
50
|
+
<input
|
|
51
|
+
type="file"
|
|
52
|
+
multiple
|
|
53
|
+
name="<%= attribute.singular_name %>[]"
|
|
54
|
+
id="<%= attribute.singular_name %>"
|
|
55
|
+
/>
|
|
56
|
+
<% elsif input_type(attribute) == "checkbox" -%>
|
|
57
|
+
<input
|
|
58
|
+
type="<%= input_type(attribute) %>"
|
|
59
|
+
name="<%= attribute.singular_name %>"
|
|
60
|
+
id="<%= attribute.singular_name %>"
|
|
61
|
+
:checked="<%= singular_table_name %>.<%= attribute.column_name %>"
|
|
62
|
+
/>
|
|
63
|
+
<% else -%>
|
|
64
|
+
<input
|
|
65
|
+
type="<%= input_type(attribute) %>"
|
|
66
|
+
name="<%= attribute.singular_name %>"
|
|
67
|
+
id="<%= attribute.singular_name %>"
|
|
68
|
+
:value="<%= singular_table_name %>.<%= attribute.column_name %>"
|
|
69
|
+
/>
|
|
70
|
+
<% end -%>
|
|
71
|
+
<div v-if="errors.<%= attribute.column_name %>" class="error">
|
|
72
|
+
{{ errors.<%= attribute.column_name %>.join(', ') }}
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
<% end -%>
|
|
76
|
+
<% end -%>
|
|
77
|
+
<div>
|
|
78
|
+
<button type="submit" :disabled="processing">
|
|
79
|
+
{{ submitText }}
|
|
80
|
+
</button>
|
|
81
|
+
</div>
|
|
82
|
+
</Form>
|
|
83
|
+
</template>
|
|
84
|
+
|
|
85
|
+
<script setup>
|
|
86
|
+
import { Form } from '@inertiajs/vue3'
|
|
87
|
+
|
|
88
|
+
const { <%= singular_table_name %>, submitText } = defineProps(['<%= singular_table_name %>', 'submitText'])
|
|
89
|
+
</script>
|
|
90
|
+
|
|
91
|
+
<style scoped>
|
|
92
|
+
.label {
|
|
93
|
+
display: block;
|
|
94
|
+
}
|
|
95
|
+
.error {
|
|
96
|
+
color: red;
|
|
97
|
+
}
|
|
98
|
+
</style>
|
data/lib/generators/inertia_templates/scaffold/templates/vue/{Index.ts.vue.tt → index.ts.vue.tt}
RENAMED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
<script setup lang="ts">
|
|
21
21
|
import { Head, Link } from '@inertiajs/vue3'
|
|
22
|
-
import <%= inertia_component_name %> from './<%=
|
|
22
|
+
import <%= inertia_component_name %> from './<%= singular_name %>.vue'
|
|
23
23
|
import { <%= inertia_model_type %> } from './types'
|
|
24
24
|
|
|
25
25
|
const { <%= plural_table_name %>, flash } = defineProps<{
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
<script setup>
|
|
21
21
|
import { Head, Link } from '@inertiajs/vue3'
|
|
22
|
-
import <%= inertia_component_name %> from './<%=
|
|
22
|
+
import <%= inertia_component_name %> from './<%= singular_name %>.vue'
|
|
23
23
|
|
|
24
24
|
const { <%= plural_table_name %>, flash } = defineProps(['<%= plural_table_name %>', 'flash'])
|
|
25
25
|
</script>
|
data/lib/generators/inertia_templates/scaffold/templates/vue/{New.ts.vue.tt → new.ts.vue.tt}
RENAMED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
<Form
|
|
7
7
|
:<%= singular_table_name %>="<%= singular_table_name %>"
|
|
8
8
|
submitText="Create <%= human_name %>"
|
|
9
|
-
|
|
9
|
+
action="<%= js_resources_path %>"
|
|
10
|
+
method="post"
|
|
10
11
|
/>
|
|
11
12
|
|
|
12
13
|
<br />
|
|
@@ -17,14 +18,10 @@
|
|
|
17
18
|
</template>
|
|
18
19
|
|
|
19
20
|
<script setup lang="ts">
|
|
20
|
-
import { Head,
|
|
21
|
-
import Form from './Form.vue'
|
|
22
|
-
import { <%= inertia_model_form_type %>, <%= inertia_model_type %> } from './types'
|
|
21
|
+
import { Head, Link } from '@inertiajs/vue3'
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
import Form from './form.vue'
|
|
24
|
+
import type { <%= inertia_model_type %> } from './types'
|
|
25
25
|
|
|
26
|
-
const
|
|
27
|
-
form.transform((data) => ({ <%= singular_table_name %>: data }))
|
|
28
|
-
form.post('<%= js_resources_path %>')
|
|
29
|
-
}
|
|
26
|
+
const { <%= singular_table_name %> } = defineProps<{ <%= singular_table_name %>: <%= inertia_model_type %> }>()
|
|
30
27
|
</script>
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
<Form
|
|
7
7
|
:<%= singular_table_name %>="<%= singular_table_name %>"
|
|
8
8
|
submitText="Create <%= human_name %>"
|
|
9
|
-
|
|
9
|
+
action="<%= js_resources_path %>"
|
|
10
|
+
method="post"
|
|
10
11
|
/>
|
|
11
12
|
|
|
12
13
|
<br />
|
|
@@ -18,12 +19,8 @@
|
|
|
18
19
|
|
|
19
20
|
<script setup>
|
|
20
21
|
import { Head, Link } from '@inertiajs/vue3'
|
|
21
|
-
import Form from './Form.vue'
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
import Form from './form.vue'
|
|
24
24
|
|
|
25
|
-
const
|
|
26
|
-
form.transform((data) => ({ <%= singular_table_name %>: data }))
|
|
27
|
-
form.post('<%= js_resources_path %>')
|
|
28
|
-
}
|
|
25
|
+
const { <%= singular_table_name %> } = defineProps(['<%= singular_table_name %>'])
|
|
29
26
|
</script>
|
data/lib/generators/inertia_templates/scaffold/templates/vue/{Show.ts.vue.tt → show.ts.vue.tt}
RENAMED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
<script setup lang="ts">
|
|
27
27
|
import { Head, Link } from '@inertiajs/vue3'
|
|
28
|
-
import <%= inertia_component_name %> from './<%=
|
|
28
|
+
import <%= inertia_component_name %> from './<%= singular_name %>.vue'
|
|
29
29
|
import { <%= inertia_model_type %> } from './types'
|
|
30
30
|
|
|
31
31
|
const { <%= singular_table_name %>, flash } = defineProps<{
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
<script setup>
|
|
27
27
|
import { Head, Link } from '@inertiajs/vue3'
|
|
28
|
-
import <%= inertia_component_name %> from './<%=
|
|
28
|
+
import <%= inertia_component_name %> from './<%= singular_name %>.vue'
|
|
29
29
|
|
|
30
30
|
const { <%= singular_table_name %>, flash } = defineProps(['<%= singular_table_name %>', 'flash'])
|
|
31
31
|
</script>
|