From 77ed32ee4d62a1210e8866133c1a4348d58aa711 Mon Sep 17 00:00:00 2001 From: "Christopher C. Wells" Date: Thu, 22 Apr 2021 11:38:28 -0700 Subject: [PATCH] Create partials for shared user/profile inputs --- app/Http/Requests/UpdateUserRequest.php | 2 +- resources/views/profiles/edit.blade.php | 47 +-------------- resources/views/profiles/show.blade.php | 6 +- resources/views/users/edit.blade.php | 58 ++----------------- .../users/partials/inputs/admin.blade.php | 9 +++ .../users/partials/inputs/name.blade.php | 10 ++++ .../users/partials/inputs/password.blade.php | 18 ++++++ .../users/partials/inputs/username.blade.php | 11 ++++ 8 files changed, 59 insertions(+), 102 deletions(-) create mode 100644 resources/views/users/partials/inputs/admin.blade.php create mode 100644 resources/views/users/partials/inputs/name.blade.php create mode 100644 resources/views/users/partials/inputs/password.blade.php create mode 100644 resources/views/users/partials/inputs/username.blade.php diff --git a/app/Http/Requests/UpdateUserRequest.php b/app/Http/Requests/UpdateUserRequest.php index 5673ac9..c4d5d54 100644 --- a/app/Http/Requests/UpdateUserRequest.php +++ b/app/Http/Requests/UpdateUserRequest.php @@ -15,7 +15,7 @@ class UpdateUserRequest extends FormRequest { $rules = [ 'username' => ['required', 'string', Rule::unique('users')->ignore($this->user)], - 'name' => ['nullable', 'string'], + 'name' => ['required', 'string'], 'password' => ['nullable', 'string', 'confirmed'], 'password_confirmation' => ['nullable', 'string'], 'admin' => ['nullable', 'boolean'], diff --git a/resources/views/profiles/edit.blade.php b/resources/views/profiles/edit.blade.php index b90240b..fd1b683 100644 --- a/resources/views/profiles/edit.blade.php +++ b/resources/views/profiles/edit.blade.php @@ -8,53 +8,12 @@ @csrf
- -
- - - -
- - -
- - - -
- + @include('users.partials.inputs.username') + @include('users.partials.inputs.name')
- -
- - - -
- - -
- - - -
+ @include('users.partials.inputs.password')
diff --git a/resources/views/profiles/show.blade.php b/resources/views/profiles/show.blade.php index f2c2c80..4af01ee 100644 --- a/resources/views/profiles/show.blade.php +++ b/resources/views/profiles/show.blade.php @@ -17,8 +17,8 @@ {{ $user->getFirstMedia()('icon') }}
-
- {{ $user->name }} -
@endif +
+ {{ $user->name }} +
diff --git a/resources/views/users/edit.blade.php b/resources/views/users/edit.blade.php index b4d4a76..ee17f6f 100644 --- a/resources/views/users/edit.blade.php +++ b/resources/views/users/edit.blade.php @@ -9,65 +9,15 @@ @csrf
- -
- - - -
- - -
- - - -
- + @include('users.partials.inputs.username') + @include('users.partials.inputs.name')
- -
- - - -
- - -
- - - -
+ @include('users.partials.inputs.password')
- -
- - - - -
+ @include('users.partials.inputs.admin')
diff --git a/resources/views/users/partials/inputs/admin.blade.php b/resources/views/users/partials/inputs/admin.blade.php new file mode 100644 index 0000000..4577b26 --- /dev/null +++ b/resources/views/users/partials/inputs/admin.blade.php @@ -0,0 +1,9 @@ +
+ + + + +
diff --git a/resources/views/users/partials/inputs/name.blade.php b/resources/views/users/partials/inputs/name.blade.php new file mode 100644 index 0000000..51c6212 --- /dev/null +++ b/resources/views/users/partials/inputs/name.blade.php @@ -0,0 +1,10 @@ +
+ + + +
diff --git a/resources/views/users/partials/inputs/password.blade.php b/resources/views/users/partials/inputs/password.blade.php new file mode 100644 index 0000000..f2f4809 --- /dev/null +++ b/resources/views/users/partials/inputs/password.blade.php @@ -0,0 +1,18 @@ +
+ + + +
+
+ + + +
diff --git a/resources/views/users/partials/inputs/username.blade.php b/resources/views/users/partials/inputs/username.blade.php new file mode 100644 index 0000000..309abb1 --- /dev/null +++ b/resources/views/users/partials/inputs/username.blade.php @@ -0,0 +1,11 @@ +
+ + + +