Add description toggle to info page

* Fixes #1546
This commit is contained in:
JonnyWong16 2021-11-13 21:53:32 -08:00
commit 876741b40b
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
3 changed files with 44 additions and 8 deletions

View file

@ -402,12 +402,15 @@ DOCUMENTATION :: END
</div>
</div>
% if data['tagline']:
<div class="summary-content-summary">
<p><strong> ${data['tagline']} </strong></p>
<div class="summary-content-text summary-content-tagline">
<p>${data['tagline']}</p>
</div>
% endif
<div class="summary-content-summary">
<p> ${data['summary'] | br, n} </p>
<div class="summary-content-text summary-content-summary">
<p>${data['summary'] | br, n}</p>
</div>
<div class="summary-content-text summary-toggle">
<a href="#" class="show-more">Read more &nbsp;<i class="fa fa-chevron-down"></i></a>
</div>
</div>
</div>
@ -997,6 +1000,21 @@ DOCUMENTATION :: END
return '<div class="channel-thumbnail" style="background-image: url(' + $(this).data('img') + ');" />';
}
});
$('.summary-content-summary').hasScrollBar() ? $('.summary-toggle').show() : $('.summary-toggle').hide();
$('.summary-toggle a').on('click', function() {
var $this = $(this);
var $content = $this.parent().prev('div.summary-content-summary');
if ($this.hasClass('show-more')) {
$this.html('Read less &nbsp;<i class="fa fa-chevron-up"></i>').toggleClass('show-more').toggleClass('show-less');
$content.animate({'height': $content[0].scrollHeight});
} else {
$this.html('Read more &nbsp;<i class="fa fa-chevron-down"></i>').toggleClass('show-more').toggleClass('show-less');
$content.animate({'height': '60px'});
}
});
</script>
% if _session['user_group'] == 'admin':
<script>