Sha256: f0fad54e61c990171ab505874568e14e37ca465e116b3bf99e337eefab45c5df
Contents?: true
Size: 980 Bytes
Versions: 6
Compression:
Stored size: 980 Bytes
Contents
<template> <Head title="Editing <%= human_name.downcase %>" /> <h1>Editing <%= human_name.downcase %></h1> <Form :<%= singular_table_name %>="<%= singular_table_name %>" submitText="Update <%= human_name.downcase %>" @onSubmit="handleSubmit" /> <br /> <div> <Link :href="`<%= js_resource_path %>`">Show this <%= human_name.downcase %></Link> | <Link href="<%= js_resources_path %>">Back to <%= human_name.pluralize.downcase %></Link> </div> </template> <script setup> import { Link, Head } from '@inertiajs/vue3' import Form from './Form.vue' const { <%= singular_table_name %> } = defineProps(['<%= singular_table_name %>']) const handleSubmit = (form) => { form.transform((data) => ({ <%= singular_table_name %>: data })) <% if attributes.any?(&:attachments?) -%> form.post(`<%= js_resource_path %>`, { headers: { 'X-HTTP-METHOD-OVERRIDE': 'put' }, }) <% else -%> form.patch(`<%= js_resource_path %>`) <% end -%> } </script>
Version data entries
6 entries across 6 versions & 1 rubygems