Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Письменов Дмитрий Иванович
/
yourroomads
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a0c60282
authored
Feb 27, 2021
by
Jonathan Reinink
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Standardize form submit handlers
1 parent
5ea932ab
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
30 additions
and
9 deletions
resources/js/Pages/Auth/Login.vue
resources/js/Pages/Contacts/Create.vue
resources/js/Pages/Contacts/Edit.vue
resources/js/Pages/Organizations/Create.vue
resources/js/Pages/Organizations/Edit.vue
resources/js/Pages/Users/Create.vue
resources/js/Pages/Users/Edit.vue
resources/js/Pages/Auth/Login.vue
View file @
a0c6028
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<div
class=
"p-6 bg-indigo-800 min-h-screen flex justify-center items-center"
>
<div
class=
"p-6 bg-indigo-800 min-h-screen flex justify-center items-center"
>
<div
class=
"w-full max-w-md"
>
<div
class=
"w-full max-w-md"
>
<logo
class=
"block mx-auto w-full max-w-xs fill-white"
height=
"50"
/>
<logo
class=
"block mx-auto w-full max-w-xs fill-white"
height=
"50"
/>
<form
class=
"mt-8 bg-white rounded-lg shadow-xl overflow-hidden"
@
submit
.
prevent=
"
submit
"
>
<form
class=
"mt-8 bg-white rounded-lg shadow-xl overflow-hidden"
@
submit
.
prevent=
"
login
"
>
<div
class=
"px-10 py-12"
>
<div
class=
"px-10 py-12"
>
<h1
class=
"text-center font-bold text-3xl"
>
Welcome Back!
</h1>
<h1
class=
"text-center font-bold text-3xl"
>
Welcome Back!
</h1>
<div
class=
"mx-auto mt-6 w-24 border-b-2"
/>
<div
class=
"mx-auto mt-6 w-24 border-b-2"
/>
...
@@ -44,7 +44,7 @@ export default {
...
@@ -44,7 +44,7 @@ export default {
}
}
},
},
methods
:
{
methods
:
{
submit
()
{
login
()
{
this
.
form
this
.
form
.
transform
(
data
=>
({
.
transform
(
data
=>
({
...
data
,
...
data
,
...
...
resources/js/Pages/Contacts/Create.vue
View file @
a0c6028
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<span
class=
"text-indigo-400 font-medium"
>
/
</span>
Create
<span
class=
"text-indigo-400 font-medium"
>
/
</span>
Create
</h1>
</h1>
<div
class=
"bg-white rounded shadow overflow-hidden max-w-3xl"
>
<div
class=
"bg-white rounded shadow overflow-hidden max-w-3xl"
>
<form
@
submit
.
prevent=
"
form.post(route('contacts.store'))
"
>
<form
@
submit
.
prevent=
"
store
"
>
<div
class=
"p-8 -mr-6 -mb-8 flex flex-wrap"
>
<div
class=
"p-8 -mr-6 -mb-8 flex flex-wrap"
>
<text-input
v-model=
"form.first_name"
:error=
"form.errors.first_name"
class=
"pr-6 pb-8 w-full lg:w-1/2"
label=
"First name"
/>
<text-input
v-model=
"form.first_name"
:error=
"form.errors.first_name"
class=
"pr-6 pb-8 w-full lg:w-1/2"
label=
"First name"
/>
<text-input
v-model=
"form.last_name"
:error=
"form.errors.last_name"
class=
"pr-6 pb-8 w-full lg:w-1/2"
label=
"Last name"
/>
<text-input
v-model=
"form.last_name"
:error=
"form.errors.last_name"
class=
"pr-6 pb-8 w-full lg:w-1/2"
label=
"Last name"
/>
...
@@ -67,5 +67,10 @@ export default {
...
@@ -67,5 +67,10 @@ export default {
}),
}),
}
}
},
},
methods
:
{
store
()
{
this
.
form
.
post
(
this
.
route
(
'contacts.store'
))
},
},
}
}
</
script
>
</
script
>
resources/js/Pages/Contacts/Edit.vue
View file @
a0c6028
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
This contact has been deleted.
This contact has been deleted.
</trashed-message>
</trashed-message>
<div
class=
"bg-white rounded shadow overflow-hidden max-w-3xl"
>
<div
class=
"bg-white rounded shadow overflow-hidden max-w-3xl"
>
<form
@
submit
.
prevent=
"
form.put(route('contacts.update', contact.id))
"
>
<form
@
submit
.
prevent=
"
update
"
>
<div
class=
"p-8 -mr-6 -mb-8 flex flex-wrap"
>
<div
class=
"p-8 -mr-6 -mb-8 flex flex-wrap"
>
<text-input
v-model=
"form.first_name"
:error=
"form.errors.first_name"
class=
"pr-6 pb-8 w-full lg:w-1/2"
label=
"First name"
/>
<text-input
v-model=
"form.first_name"
:error=
"form.errors.first_name"
class=
"pr-6 pb-8 w-full lg:w-1/2"
label=
"First name"
/>
<text-input
v-model=
"form.last_name"
:error=
"form.errors.last_name"
class=
"pr-6 pb-8 w-full lg:w-1/2"
label=
"Last name"
/>
<text-input
v-model=
"form.last_name"
:error=
"form.errors.last_name"
class=
"pr-6 pb-8 w-full lg:w-1/2"
label=
"Last name"
/>
...
@@ -81,6 +81,9 @@ export default {
...
@@ -81,6 +81,9 @@ export default {
}
}
},
},
methods
:
{
methods
:
{
update
()
{
this
.
form
.
put
(
this
.
route
(
'contacts.update'
,
this
.
contact
.
id
))
},
destroy
()
{
destroy
()
{
if
(
confirm
(
'Are you sure you want to delete this contact?'
))
{
if
(
confirm
(
'Are you sure you want to delete this contact?'
))
{
this
.
$inertia
.
delete
(
this
.
route
(
'contacts.destroy'
,
this
.
contact
.
id
))
this
.
$inertia
.
delete
(
this
.
route
(
'contacts.destroy'
,
this
.
contact
.
id
))
...
...
resources/js/Pages/Organizations/Create.vue
View file @
a0c6028
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<span
class=
"text-indigo-400 font-medium"
>
/
</span>
Create
<span
class=
"text-indigo-400 font-medium"
>
/
</span>
Create
</h1>
</h1>
<div
class=
"bg-white rounded shadow overflow-hidden max-w-3xl"
>
<div
class=
"bg-white rounded shadow overflow-hidden max-w-3xl"
>
<form
@
submit
.
prevent=
"
form.post(route('organizations.store'))
"
>
<form
@
submit
.
prevent=
"
store
"
>
<div
class=
"p-8 -mr-6 -mb-8 flex flex-wrap"
>
<div
class=
"p-8 -mr-6 -mb-8 flex flex-wrap"
>
<text-input
v-model=
"form.name"
:error=
"form.errors.name"
class=
"pr-6 pb-8 w-full lg:w-1/2"
label=
"Name"
/>
<text-input
v-model=
"form.name"
:error=
"form.errors.name"
class=
"pr-6 pb-8 w-full lg:w-1/2"
label=
"Name"
/>
<text-input
v-model=
"form.email"
:error=
"form.errors.email"
class=
"pr-6 pb-8 w-full lg:w-1/2"
label=
"Email"
/>
<text-input
v-model=
"form.email"
:error=
"form.errors.email"
class=
"pr-6 pb-8 w-full lg:w-1/2"
label=
"Email"
/>
...
@@ -57,5 +57,10 @@ export default {
...
@@ -57,5 +57,10 @@ export default {
}),
}),
}
}
},
},
methods
:
{
store
()
{
this
.
form
.
post
(
this
.
route
(
'organizations.store'
))
},
},
}
}
</
script
>
</
script
>
resources/js/Pages/Organizations/Edit.vue
View file @
a0c6028
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
This organization has been deleted.
This organization has been deleted.
</trashed-message>
</trashed-message>
<div
class=
"bg-white rounded shadow overflow-hidden max-w-3xl"
>
<div
class=
"bg-white rounded shadow overflow-hidden max-w-3xl"
>
<form
@
submit
.
prevent=
"
form.put(route('organizations.update', organization.id))
"
>
<form
@
submit
.
prevent=
"
update
"
>
<div
class=
"p-8 -mr-6 -mb-8 flex flex-wrap"
>
<div
class=
"p-8 -mr-6 -mb-8 flex flex-wrap"
>
<text-input
v-model=
"form.name"
:error=
"form.errors.name"
class=
"pr-6 pb-8 w-full lg:w-1/2"
label=
"Name"
/>
<text-input
v-model=
"form.name"
:error=
"form.errors.name"
class=
"pr-6 pb-8 w-full lg:w-1/2"
label=
"Name"
/>
<text-input
v-model=
"form.email"
:error=
"form.errors.email"
class=
"pr-6 pb-8 w-full lg:w-1/2"
label=
"Email"
/>
<text-input
v-model=
"form.email"
:error=
"form.errors.email"
class=
"pr-6 pb-8 w-full lg:w-1/2"
label=
"Email"
/>
...
@@ -108,6 +108,9 @@ export default {
...
@@ -108,6 +108,9 @@ export default {
}
}
},
},
methods
:
{
methods
:
{
update
()
{
this
.
form
.
put
(
this
.
route
(
'organizations.update'
,
this
.
organization
.
id
))
},
destroy
()
{
destroy
()
{
if
(
confirm
(
'Are you sure you want to delete this organization?'
))
{
if
(
confirm
(
'Are you sure you want to delete this organization?'
))
{
this
.
$inertia
.
delete
(
this
.
route
(
'organizations.destroy'
,
this
.
organization
.
id
))
this
.
$inertia
.
delete
(
this
.
route
(
'organizations.destroy'
,
this
.
organization
.
id
))
...
...
resources/js/Pages/Users/Create.vue
View file @
a0c6028
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<span
class=
"text-indigo-400 font-medium"
>
/
</span>
Create
<span
class=
"text-indigo-400 font-medium"
>
/
</span>
Create
</h1>
</h1>
<div
class=
"bg-white rounded shadow overflow-hidden max-w-3xl"
>
<div
class=
"bg-white rounded shadow overflow-hidden max-w-3xl"
>
<form
@
submit
.
prevent=
"
form.post(route('users.store'))
"
>
<form
@
submit
.
prevent=
"
store
"
>
<div
class=
"p-8 -mr-6 -mb-8 flex flex-wrap"
>
<div
class=
"p-8 -mr-6 -mb-8 flex flex-wrap"
>
<text-input
v-model=
"form.first_name"
:error=
"form.errors.first_name"
class=
"pr-6 pb-8 w-full lg:w-1/2"
label=
"First name"
/>
<text-input
v-model=
"form.first_name"
:error=
"form.errors.first_name"
class=
"pr-6 pb-8 w-full lg:w-1/2"
label=
"First name"
/>
<text-input
v-model=
"form.last_name"
:error=
"form.errors.last_name"
class=
"pr-6 pb-8 w-full lg:w-1/2"
label=
"Last name"
/>
<text-input
v-model=
"form.last_name"
:error=
"form.errors.last_name"
class=
"pr-6 pb-8 w-full lg:w-1/2"
label=
"Last name"
/>
...
@@ -54,5 +54,10 @@ export default {
...
@@ -54,5 +54,10 @@ export default {
}),
}),
}
}
},
},
methods
:
{
store
()
{
this
.
form
.
post
(
this
.
route
(
'users.store'
))
},
},
}
}
</
script
>
</
script
>
resources/js/Pages/Users/Edit.vue
View file @
a0c6028
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
This user has been deleted.
This user has been deleted.
</trashed-message>
</trashed-message>
<div
class=
"bg-white rounded shadow overflow-hidden max-w-3xl"
>
<div
class=
"bg-white rounded shadow overflow-hidden max-w-3xl"
>
<form
@
submit
.
prevent=
"
submit
"
>
<form
@
submit
.
prevent=
"
update
"
>
<div
class=
"p-8 -mr-6 -mb-8 flex flex-wrap"
>
<div
class=
"p-8 -mr-6 -mb-8 flex flex-wrap"
>
<text-input
v-model=
"form.first_name"
:error=
"form.errors.first_name"
class=
"pr-6 pb-8 w-full lg:w-1/2"
label=
"First name"
/>
<text-input
v-model=
"form.first_name"
:error=
"form.errors.first_name"
class=
"pr-6 pb-8 w-full lg:w-1/2"
label=
"First name"
/>
<text-input
v-model=
"form.last_name"
:error=
"form.errors.last_name"
class=
"pr-6 pb-8 w-full lg:w-1/2"
label=
"Last name"
/>
<text-input
v-model=
"form.last_name"
:error=
"form.errors.last_name"
class=
"pr-6 pb-8 w-full lg:w-1/2"
label=
"Last name"
/>
...
@@ -73,7 +73,7 @@ export default {
...
@@ -73,7 +73,7 @@ export default {
}
}
},
},
methods
:
{
methods
:
{
submit
()
{
update
()
{
this
.
form
.
post
(
this
.
route
(
'users.update'
,
this
.
user
.
id
),
{
this
.
form
.
post
(
this
.
route
(
'users.update'
,
this
.
user
.
id
),
{
onSuccess
:
()
=>
this
.
form
.
reset
(
'password'
,
'photo'
),
onSuccess
:
()
=>
this
.
form
.
reset
(
'password'
,
'photo'
),
})
})
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment