Merge pull request #56 from zhaospei/master

fix pre-expand-blog
This commit is contained in:
Phuoc Dinh Le 2023-02-06 11:44:15 -06:00 committed by GitHub
commit 1e79a53575
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 17 deletions

View file

@ -228,6 +228,7 @@
} }
.show-more { .show-more {
display: flex;
color: black; color: black;
font-style: italic; font-style: italic;
font-size: 16px; font-size: 16px;
@ -237,7 +238,6 @@
position: absolute; position: absolute;
inset: 50% 0px 0px; inset: 50% 0px 0px;
background: linear-gradient(transparent, white); background: linear-gradient(transparent, white);
display: flex;
-webkit-box-pack: end; -webkit-box-pack: end;
justify-content: flex-end; justify-content: flex-end;
align-items: flex-end; align-items: flex-end;

View file

@ -5,15 +5,15 @@
</a> </a>
</h3> </h3>
{% with author=comment.author %} {% with author=comment.author %}
{% if author %} {% if author %}
<div class="problem-feed-info-entry"> <div class="problem-feed-info-entry">
<i class="fa fa-pencil-square-o fa-fw"></i> <i class="fa fa-pencil-square-o fa-fw"></i>
<span class="pi-value">{{ link_user(author) }}</span> <span class="pi-value">{{ link_user(author) }}</span>
</div> </div>
{% endif %} {% endif %}
{% endwith %} {% endwith %}
<div class='blog-description content-description'> <div class='blog-description content-description'>
{{ comment.body|markdown(lazy_load=True)|reference|str|safe }} {{ comment.body|markdown(lazy_load=True)|reference|str|safe }}
<div class="show-more"></div> <div class="show-more"> {{_("...More")}} </div>
</div> </div>
</div> </div>

View file

@ -42,10 +42,18 @@
$blogbox.removeClass('pre-expand-blog'); $blogbox.removeClass('pre-expand-blog');
$(this).hide(); $(this).hide();
} }
}) });
$('.blog-box').each(function () { $('.blog-box').each(function () {
if ($(this).prop('scrollHeight') > $(this).height()) { var $precontent = $(this).children('.blog-description').height();
var $content = $(this).children().children('.content-description').height();
if ($content == undefined) {
$content = $(this).children().children('.md-typeset').height()
}
if ($content > $precontent - 30) {
$(this).addClass('pre-expand-blog'); $(this).addClass('pre-expand-blog');
} else {
$(this).children().children('.show-more').hide();
} }
}); });
} }

View file

@ -8,12 +8,12 @@
</a> </a>
</h3> </h3>
{% with author=ticket.user %} {% with author=ticket.user %}
{% if author %} {% if author %}
<div class="problem-feed-info-entry"> <div class="problem-feed-info-entry">
<i class="fa fa-pencil-square-o fa-fw"></i> <i class="fa fa-pencil-square-o fa-fw"></i>
<span class="pi-value">{{ link_user(author) }}</span> <span class="pi-value">{{ link_user(author) }}</span>
</div> </div>
{% endif %} {% endif %}
{% endwith %} {% endwith %}
<div class="problem-feed-types"> <div class="problem-feed-types">
<i class="fa fa-tag"></i> <i class="fa fa-tag"></i>
@ -21,6 +21,6 @@
</div> </div>
<div class='blog-description content-description'> <div class='blog-description content-description'>
{{ ticket.messages.last().body|markdown(lazy_load=True)|reference|str|safe }} {{ ticket.messages.last().body|markdown(lazy_load=True)|reference|str|safe }}
<div class="show-more"></div> <div class="show-more"> {{_("...More")}} </div>
</div> </div>
</div> </div>