1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-25 01:05:36 +00:00

Update home settings, add bio counter. Fixes #59

This commit is contained in:
Daniel Supernault 2018-11-21 20:02:41 -07:00
parent 685df5f690
commit 5b6a589c43
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -38,10 +38,10 @@
<div class="form-group row">
<label for="bio" class="col-sm-3 col-form-label font-weight-bold text-right">Bio</label>
<div class="col-sm-9">
<textarea class="form-control" id="bio" name="bio" placeholder="Add a bio here" rows="2">{{Auth::user()->profile->bio}}</textarea>
<small class="form-text text-muted">
Max length: {{config('pixelfed.max_bio_length')}} characters.
</small>
<textarea class="form-control" id="bio" name="bio" placeholder="Add a bio here" rows="2" data-max-length="{{config('pixelfed.max_bio_length')}}">{{Auth::user()->profile->bio}}</textarea>
<p class="form-text">
<span class="bio-counter float-right small text-muted">0/{{config('pixelfed.max_bio_length')}}</span>
</p>
</div>
</div>
<div class="pt-5">
@ -112,6 +112,25 @@
swal.close();
});
$('#bio').on('change keyup paste', function(e) {
let el = $(this);
let len = el.val().length;
let limit = el.data('max-length');
if(len > 100) {
el.attr('rows', '4');
}
let val = len + ' / ' + limit;
if(len > limit) {
let diff = len - limit;
val = '<span class="text-danger">-' + diff + '</span> / ' + limit;
}
$('.bio-counter').html(val);
});
$(document).on('click', '.change-profile-photo', function(e) {
e.preventDefault();
var content = $('<ul>').addClass('list-group');