Skip to content

Commit c661f76

Browse files
committed
user profile edit on bootstrap 4
1 parent 06b3149 commit c661f76

15 files changed

+203
-90
lines changed

.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ DEFAULT_GRAVATAR_MAX_RATING=g
8484
DEFAULT_GRAVATAR_FORCE_DEFAULT=false
8585
DEFAULT_GRAVATAR_FORCE_EXTENSION=jpg
8686

87+
DROPZONE_JS_CDN=https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.4.0/dropzone.js
88+
8789
LARAVEL_LOGGER_DATABASE_CONNECTION=mysql
8890
LARAVEL_LOGGER_DATABASE_TABLE=laravel_logger_activity
8991
LARAVEL_LOGGER_ROLES_ENABLED=true
@@ -158,4 +160,3 @@ INSTAGRAM_REDIRECT_URI=http://laravel-authentication.local/social/handle/instagr
158160
37SIGNALS_KEY=YOURKEYHERE
159161
37SIGNALS_SECRET=YOURSECRETHERE
160162
37SIGNALS_REDIRECT_URI=http://laravel-authentication.local/social/handle/37signals
161-

app/Http/Controllers/ProfilesController.php

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -161,48 +161,47 @@ public function update($username, Request $request)
161161
return redirect('profile/'.$user->name.'/edit')->with('success', trans('profile.updateSuccess'));
162162
}
163163

164-
/**
165-
* Get a validator for an incoming update user request.
166-
*
167-
* @param array $data
168-
*
169-
* @return \Illuminate\Contracts\Validation\Validator
170-
*/
171-
public function validator(array $data)
172-
{
173-
return Validator::make($data, [
174-
'name' => 'required|max:255',
175-
]);
176-
}
177-
178164
/**
179165
* Update the specified resource in storage.
180166
*
181167
* @param \Illuminate\Http\Request $request
182-
* @param int $id
168+
* @param int $id
183169
*
184170
* @return \Illuminate\Http\Response
185171
*/
186172
public function updateUserAccount(Request $request, $id)
187173
{
188-
$currentUser = \Auth::user();
189-
$user = User::findOrFail($id);
190-
$emailCheck = ($request->input('email') != '') && ($request->input('email') != $user->email);
191-
$ipAddress = new CaptureIpTrait();
192-
193-
$validator = Validator::make($request->all(), [
194-
'name' => 'required|max:255',
195-
]);
196-
197-
$rules = [];
198-
174+
$currentUser = \Auth::user();
175+
$user = User::findOrFail($id);
176+
$emailCheck = ($request->input('email') != '') && ($request->input('email') != $user->email);
177+
$ipAddress = new CaptureIpTrait();
178+
$rules = [];
179+
180+
if ($user->name != $request->input('name')) {
181+
$usernameRules = [
182+
'name' => 'required|max:255|unique:users',
183+
];
184+
} else {
185+
$usernameRules = [
186+
'name' => 'required|max:255',
187+
];
188+
}
199189
if ($emailCheck) {
200-
$rules = [
190+
$emailRules = [
201191
'email' => 'email|max:255|unique:users',
202192
];
193+
} else {
194+
$emailRules = [
195+
'email' => 'email|max:255',
196+
];
203197
}
198+
$additionalRules = [
199+
'first_name' => 'nullable|string|max:255',
200+
'last_name' => 'nullable|string|max:255',
201+
];
204202

205-
$validator = $this->validator($request->all(), $rules);
203+
$rules = array_merge($usernameRules, $emailRules, $additionalRules);
204+
$validator = Validator::make($request->all(), $rules);
206205

207206
if ($validator->fails()) {
208207
return back()->withErrors($validator)->withInput();

app/Http/Controllers/UsersManagementController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,13 @@ public function update(Request $request, $id)
171171

172172
if ($emailCheck) {
173173
$validator = Validator::make($request->all(), [
174-
'name' => 'required|max:255',
174+
'name' => 'required|max:255|unique:users',
175175
'email' => 'email|max:255|unique:users',
176176
'password' => 'present|confirmed|min:6',
177177
]);
178178
} else {
179179
$validator = Validator::make($request->all(), [
180-
'name' => 'required|max:255',
180+
'name' => 'required|max:255|unique:users',
181181
'password' => 'nullable|confirmed|min:6',
182182
]);
183183
}

config/settings.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,8 @@
6767
*/
6868
'googleMapsAPIKey' => env('GOOGLEMAPS_API_KEY', 'YOURGOOGLEMAPSkeyHERE'),
6969

70+
/*
71+
* DropZone CDN
72+
*/
73+
'dropZoneJsCDN' => env('DROPZONE_JS_CDN', 'https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.4.0/dropzone.js'),
7074
];

public/css/app.css

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14715,6 +14715,20 @@ a.text-dark:focus {
1471514715
margin-left: auto;
1471614716
}
1471714717

14718+
@media (min-width: 576px) {
14719+
.rounded-left-sm-up {
14720+
border-top-left-radius: 0.25rem !important;
14721+
border-bottom-left-radius: 0.25rem !important;
14722+
}
14723+
}
14724+
14725+
@media (min-width: 767px) {
14726+
.rounded-left-md-up {
14727+
border-top-left-radius: 0.25rem !important;
14728+
border-bottom-left-radius: 0.25rem !important;
14729+
}
14730+
}
14731+
1471814732
.text-danger {
1471914733
color: #bf5329;
1472014734
}
@@ -14801,6 +14815,14 @@ a.text-dark:focus {
1480114815
background-color: #bf5329;
1480214816
}
1480314817

14818+
.warning-pill-trigger.active {
14819+
background: #ffc107 !important;
14820+
}
14821+
14822+
.danger-pill-trigger.active {
14823+
background: #dc3545 !important;
14824+
}
14825+
1480414826
.badge.badge-primary {
1480514827
background-color: #3097D1;
1480614828
}
@@ -15048,6 +15070,10 @@ form.form-inline {
1504815070
cursor: not-allowed;
1504915071
}
1505015072

15073+
input[type="checkbox"] {
15074+
opacity: 0;
15075+
}
15076+
1505115077
label input[type="radio"] ~ i.fa.fa-circle-o {
1505215078
color: #c8c8c8;
1505315079
display: inline;
@@ -15557,3 +15583,35 @@ div[data-toggle="buttons"] label.active {
1555715583
}
1555815584
}
1555915585

15586+
.profile-sidebar {
15587+
border-right: 2px solid #f5f8fa;
15588+
padding: 0 !important;
15589+
}
15590+
15591+
.profile-sidebar .nav-pills a {
15592+
border-radius: 0 !important;
15593+
border-bottom: 2px solid #f5f8fa;
15594+
}
15595+
15596+
.profile-sidebar .nav-pills a:first-child {
15597+
border-radius: 0.25rem 0.25rem 0 0 !important;
15598+
}
15599+
15600+
@media (min-width: 576px) {
15601+
.profile-sidebar .nav-pills a:first-child {
15602+
border-radius: 0.25rem 0 0 0 !important;
15603+
}
15604+
}
15605+
15606+
.profile-sidebar .nav-pills a.active {
15607+
background: #6c757d;
15608+
}
15609+
15610+
.account-admin-subnav li:first-child {
15611+
border-radius: 0.25rem 0 0 0.25rem;
15612+
}
15613+
15614+
.account-admin-subnav li:last-child {
15615+
border-radius: 0 0.25rem 0.25rem 0;
15616+
}
15617+

public/mix-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"/js/app.js": "/js/app.js?id=4e6c7c07b25e280ea90f",
3-
"/css/app.css": "/css/app.css?id=b74d2f3230371358c4f6"
3+
"/css/app.css": "/css/app.css?id=fd1e565ca0f9524e678e"
44
}

resources/assets/sass/_buttons.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,15 @@
6767
color: $white;
6868
background-color: $brand-danger;
6969
}
70+
71+
.warning-pill-trigger {
72+
&.active {
73+
background: $warning !important;
74+
}
75+
}
76+
.danger-pill-trigger {
77+
&.active {
78+
background: $danger !important;
79+
}
80+
}
81+

resources/assets/sass/_forms.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ form {
5656
}
5757
}
5858

59+
input[type="checkbox"] {
60+
opacity: 0;
61+
}
62+
5963
label {
6064

6165
input[type="radio"] ~ i.fa.fa-circle-o{
@@ -116,4 +120,4 @@ div[data-toggle="buttons"] {
116120
left: 0;
117121
position: absolute;
118122
width: 40px;
119-
}
123+
}

resources/assets/sass/_helpers.scss

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,50 @@
33
}
44

55
.start-hidden {
6-
display: none;
6+
display: none;
77
}
88

99
.no-shadow {
10-
@include vendor(box-shadow, none !important);
11-
@include vendor(outline, none !important);
12-
-webkit-appearance: none !important;
10+
@include vendor(box-shadow, none !important);
11+
@include vendor(outline, none !important);
12+
-webkit-appearance: none !important;
1313
}
1414

1515
.border-bottom {
16-
border-bottom:1px #f8f8f8 solid;
17-
margin:5px 0 5px 0;
16+
border-bottom:1px #f8f8f8 solid;
17+
margin:5px 0 5px 0;
1818
}
1919

2020
.border-radius {
21-
@include vendor(border-radius, $standard-radius);
21+
@include vendor(border-radius, $standard-radius);
2222
}
2323

2424
@media(max-width: $mq-tiny) {
25-
.hidden-xxxs {
26-
display: none;
27-
}
25+
.hidden-xxxs {
26+
display: none;
27+
}
2828
}
2929

3030
@media(max-width: $phone) {
31-
.hidden-xxs {
32-
display: none;
33-
}
31+
.hidden-xxs {
32+
display: none;
33+
}
3434
}
35-
3635
.center-block {
37-
display: block;
38-
margin-right: auto;
39-
margin-left: auto;
36+
display: block;
37+
margin-right: auto;
38+
margin-left: auto;
39+
}
40+
@media(min-width: $bs4-phone) {
41+
.rounded-left-sm-up {
42+
border-top-left-radius: $border-radius !important;
43+
border-bottom-left-radius: $border-radius !important;
44+
}
45+
}
46+
@media(min-width: $tablet) {
47+
.rounded-left-md-up {
48+
border-top-left-radius: $border-radius !important;
49+
border-bottom-left-radius: $border-radius !important;
50+
}
4051
}
52+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
.profile-sidebar {
2+
border-right: 2px solid $body-bg;
3+
padding: 0 !important;
4+
.nav-pills {
5+
a {
6+
border-radius: 0 !important;
7+
border-bottom: 2px solid $body-bg;
8+
&:first-child{
9+
border-radius: $border-radius $border-radius 0 0 !important;
10+
@media(min-width: $bs4-phone) {
11+
border-radius: $border-radius 0 0 0 !important;
12+
}
13+
}
14+
&.active {
15+
background: $secondary;
16+
}
17+
}
18+
}
19+
}
20+
21+
.account-admin-subnav {
22+
li {
23+
&:first-child {
24+
border-radius: $border-radius 0 0 $border-radius;
25+
}
26+
&:last-child {
27+
border-radius: 0 $border-radius $border-radius 0;
28+
}
29+
}
30+
}

resources/assets/sass/_variables.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ $standard-radius: 3px;
3030
// MQ's
3131
$mq-tiny: 320px;
3232
$phone: 480px;
33+
$bs4-phone: 576px;
3334
$tablet: 767px;
3435
$desktop: 992px;
3536
$lg-desktop: 1200px;

resources/assets/sass/app.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@
3939
@import "password";
4040
@import "hideShowPassword";
4141
@import "visibility";
42+
@import "user-profile";

resources/views/modals/modal-form.blade.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,27 @@
22
<div class="modal-dialog">
33
<div class="modal-content">
44
<div class="modal-header">
5-
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
65
<h4 class="modal-title">
76
{{ trans('modals.form_modal_default_title') }}
87
</h4>
8+
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
99
</div>
10+
11+
12+
1013
<div class="modal-body">
1114
<p>
1215
{{ trans('modals.form_modal_default_message') }}
1316
</p>
1417
</div>
1518
<div class="modal-footer">
16-
{!! Form::button('<i class="fa fa-fw fa-close" aria-hidden="true"></i> ' . trans('modals.form_modal_default_btn_cancel'), array('class' => 'btn pull-left', 'type' => 'button', 'data-dismiss' => 'modal' )) !!}
17-
{!! Form::button('<i class="fa fa-fw fa-check" aria-hidden="true"></i> ' . trans('modals.form_modal_default_btn_submit'), array('class' => 'btn btn-default pull-right', 'type' => 'button', 'id' => 'confirm' )) !!}
19+
20+
{!! Form::button('<i class="fa fa-fw fa-close" aria-hidden="true"></i> ' . trans('modals.form_modal_default_btn_cancel'), array('class' => 'btn btn-secondary', 'type' => 'button', 'data-dismiss' => 'modal' )) !!}
21+
22+
{!! Form::button('<i class="fa fa-fw fa-check" aria-hidden="true"></i> ' . trans('modals.form_modal_default_btn_submit'), array('class' => 'btn btn-primary', 'type' => 'button', 'id' => 'confirm' )) !!}
23+
24+
1825
</div>
1926
</div>
2027
</div>
21-
</div>
28+
</div>

0 commit comments

Comments
 (0)