mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-01-30 16:30:45 +00:00
Update home settings, add bio counter. Fixes #59
This commit is contained in:
parent
685df5f690
commit
5b6a589c43
1 changed files with 23 additions and 4 deletions
|
@ -38,10 +38,10 @@
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="bio" class="col-sm-3 col-form-label font-weight-bold text-right">Bio</label>
|
<label for="bio" class="col-sm-3 col-form-label font-weight-bold text-right">Bio</label>
|
||||||
<div class="col-sm-9">
|
<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>
|
<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>
|
||||||
<small class="form-text text-muted">
|
<p class="form-text">
|
||||||
Max length: {{config('pixelfed.max_bio_length')}} characters.
|
<span class="bio-counter float-right small text-muted">0/{{config('pixelfed.max_bio_length')}}</span>
|
||||||
</small>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="pt-5">
|
<div class="pt-5">
|
||||||
|
@ -112,6 +112,25 @@
|
||||||
swal.close();
|
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) {
|
$(document).on('click', '.change-profile-photo', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var content = $('<ul>').addClass('list-group');
|
var content = $('<ul>').addClass('list-group');
|
||||||
|
|
Loading…
Reference in a new issue