forked from mirror/pixelfed
Update Settings Home view, allow user to delete existing profile photo
This commit is contained in:
parent
227a930ef9
commit
0456ea45eb
1 changed files with 18 additions and 1 deletions
|
@ -12,7 +12,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<p class="lead font-weight-bold mb-0">{{Auth::user()->username}}</p>
|
<p class="lead font-weight-bold mb-0">{{Auth::user()->username}}</p>
|
||||||
<p><a href="#" class="font-weight-bold change-profile-photo" data-toggle="collapse" data-target="#avatarCollapse" aria-expanded="false" aria-controls="avatarCollapse">Change Profile Photo</a></p>
|
<p class="">
|
||||||
|
<a href="#" class="font-weight-bold change-profile-photo" data-toggle="collapse" data-target="#avatarCollapse" aria-expanded="false" aria-controls="avatarCollapse">Change Profile Photo</a>
|
||||||
|
</p>
|
||||||
<div class="collapse" id="avatarCollapse">
|
<div class="collapse" id="avatarCollapse">
|
||||||
<form method="post" action="/settings/avatar" enctype="multipart/form-data">
|
<form method="post" action="/settings/avatar" enctype="multipart/form-data">
|
||||||
@csrf
|
@csrf
|
||||||
|
@ -27,6 +29,9 @@
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<p class="">
|
||||||
|
<a class="font-weight-bold text-muted delete-profile-photo" href="#">Delete Profile Photo</a>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
|
@ -144,5 +149,17 @@
|
||||||
reader.readAsDataURL(file);
|
reader.readAsDataURL(file);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.delete-profile-photo').on('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
if(window.confirm('Are you sure you want to delete your profile photo.') == false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
axios.delete('/settings/avatar').then(res => {
|
||||||
|
window.location.href = window.location.href;
|
||||||
|
}).catch(err => {
|
||||||
|
swal('Error', 'An error occured, please try again later', 'error');
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
|
|
Loading…
Reference in a new issue