mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-01-24 05:20:46 +00:00
Merge pull request #1165 from pixelfed/frontend-ui-refactor
Frontend ui refactor
This commit is contained in:
commit
1c7dad0711
3 changed files with 51 additions and 31 deletions
|
@ -42,7 +42,7 @@ trait HomeSettings
|
||||||
|
|
||||||
$changes = false;
|
$changes = false;
|
||||||
$name = strip_tags($request->input('name'));
|
$name = strip_tags($request->input('name'));
|
||||||
$bio = $request->filled('bio') ? Purify::clean($request->input('bio')) : null;
|
$bio = $request->filled('bio') ? strip_tags(Purify::clean($request->input('bio'))) : null;
|
||||||
$website = $request->input('website');
|
$website = $request->input('website');
|
||||||
$email = $request->input('email');
|
$email = $request->input('email');
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
|
|
|
@ -67,7 +67,7 @@ return [
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'HTML.Allowed' => 'a[href|title|rel],p,strong,em,i,u,h1,h2,h3,h4,h5,ul,ol,li',
|
'HTML.Allowed' => 'a[href|title|rel],p,strong,em,i,u,h1,h2,h3,h4,h5,ul,ol,li,br',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
@ -128,12 +128,8 @@
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
$(document).on('click', '.modal-close', function(e) {
|
$(document).ready(function() {
|
||||||
swal.close();
|
let el = $('#bio');
|
||||||
});
|
|
||||||
|
|
||||||
$('#bio').on('change keyup paste', function(e) {
|
|
||||||
let el = $(this);
|
|
||||||
let len = el.val().length;
|
let len = el.val().length;
|
||||||
let limit = el.data('max-length');
|
let limit = el.data('max-length');
|
||||||
|
|
||||||
|
@ -149,33 +145,57 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.bio-counter').html(val);
|
$('.bio-counter').html(val);
|
||||||
});
|
|
||||||
|
|
||||||
$('#maxAvatarSize').text(filesize({{config('pixelfed.max_avatar_size') * 1024}}, {round: 0}));
|
$('#bio').on('change keyup paste', function(e) {
|
||||||
|
let el = $(this);
|
||||||
|
let len = el.val().length;
|
||||||
|
let limit = el.data('max-length');
|
||||||
|
|
||||||
$('#avatarInput').on('change', function(e) {
|
if(len > 100) {
|
||||||
var file = document.getElementById('avatarInput').files[0];
|
el.attr('rows', '4');
|
||||||
var reader = new FileReader();
|
|
||||||
|
|
||||||
reader.addEventListener("load", function() {
|
|
||||||
$('#previewAvatar').html('<img src="' + reader.result + '" class="rounded-circle box-shadow mb-3" width="100%" height="100%"/>');
|
|
||||||
}, false);
|
|
||||||
|
|
||||||
if (file) {
|
|
||||||
reader.readAsDataURL(file);
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
$('.delete-profile-photo').on('click', function(e) {
|
let val = len + ' / ' + limit;
|
||||||
e.preventDefault();
|
|
||||||
if(window.confirm('Are you sure you want to delete your profile photo.') == false) {
|
if(len > limit) {
|
||||||
return;
|
let diff = len - limit;
|
||||||
}
|
val = '<span class="text-danger">-' + diff + '</span> / ' + limit;
|
||||||
axios.delete('/settings/avatar').then(res => {
|
}
|
||||||
window.location.href = window.location.href;
|
|
||||||
}).catch(err => {
|
$('.bio-counter').html(val);
|
||||||
swal('Error', 'An error occured, please try again later', 'error');
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
$(document).on('click', '.modal-close', function(e) {
|
||||||
|
swal.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#maxAvatarSize').text(filesize({{config('pixelfed.max_avatar_size') * 1024}}, {round: 0}));
|
||||||
|
|
||||||
|
$('#avatarInput').on('change', function(e) {
|
||||||
|
var file = document.getElementById('avatarInput').files[0];
|
||||||
|
var reader = new FileReader();
|
||||||
|
|
||||||
|
reader.addEventListener("load", function() {
|
||||||
|
$('#previewAvatar').html('<img src="' + reader.result + '" class="rounded-circle box-shadow mb-3" width="100%" height="100%"/>');
|
||||||
|
}, false);
|
||||||
|
|
||||||
|
if (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