FEATURE: hide excerpt if 'solved_quote_length' is set to zero
This commit is contained in:
parent
6ab44835b8
commit
9104e2292c
|
@ -102,8 +102,9 @@ function initializeWithApi(api) {
|
||||||
if (postModel) {
|
if (postModel) {
|
||||||
const topic = postModel.get('topic');
|
const topic = postModel.get('topic');
|
||||||
if (topic.get('accepted_answer')) {
|
if (topic.get('accepted_answer')) {
|
||||||
|
const hasExcerpt = !!topic.get('accepted_answer').excerpt;
|
||||||
|
|
||||||
var rawhtml = `
|
const withExcerpt = `
|
||||||
<aside class='quote' data-post="${topic.get('accepted_answer').post_number}" data-topic="${topic.get('id')}">
|
<aside class='quote' data-post="${topic.get('accepted_answer').post_number}" data-topic="${topic.get('id')}">
|
||||||
<div class='title'>
|
<div class='title'>
|
||||||
${topic.get('acceptedAnswerHtml')} <div class="quote-controls"><\/div>
|
${topic.get('acceptedAnswerHtml')} <div class="quote-controls"><\/div>
|
||||||
|
@ -113,7 +114,14 @@ function initializeWithApi(api) {
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</aside>`;
|
</aside>`;
|
||||||
|
|
||||||
var cooked = new PostCooked({cooked:rawhtml});
|
const withoutExcerpt = `
|
||||||
|
<aside class='quote'>
|
||||||
|
<div class='title title-only'>
|
||||||
|
${topic.get('acceptedAnswerHtml')}
|
||||||
|
</div>
|
||||||
|
</aside>`;
|
||||||
|
|
||||||
|
var cooked = new PostCooked({ cooked: hasExcerpt ? withExcerpt : withoutExcerpt });
|
||||||
|
|
||||||
var html = cooked.init();
|
var html = cooked.init();
|
||||||
|
|
||||||
|
|
|
@ -38,3 +38,7 @@
|
||||||
//border-top: 1px solid #ddd;
|
//border-top: 1px solid #ddd;
|
||||||
//background-color: #E9FFE0;
|
//background-color: #E9FFE0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aside.quote .title.title-only {
|
||||||
|
padding: 12px;
|
||||||
|
}
|
||||||
|
|
|
@ -250,7 +250,11 @@ SQL
|
||||||
.first
|
.first
|
||||||
|
|
||||||
if postInfo
|
if postInfo
|
||||||
postInfo[2] = PrettyText.excerpt(postInfo[2], SiteSetting.solved_quote_length)
|
postInfo[2] = if SiteSetting.solved_quote_length > 0
|
||||||
|
PrettyText.excerpt(postInfo[2], SiteSetting.solved_quote_length)
|
||||||
|
else
|
||||||
|
nil
|
||||||
|
end
|
||||||
return postInfo
|
return postInfo
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue