Remove excerpt stuff, only show quote once clicked
This commit is contained in:
parent
f38c7a3991
commit
4aaeee8aec
|
@ -47,8 +47,7 @@ function acceptPost(post) {
|
|||
|
||||
topic.set('accepted_answer', {
|
||||
username: post.get('username'),
|
||||
post_number: post.get('post_number'),
|
||||
excerpt: post.get('cooked')
|
||||
post_number: post.get('post_number')
|
||||
});
|
||||
|
||||
ajax("/solution/accept", {
|
||||
|
@ -155,24 +154,20 @@ function initializeWithApi(api) {
|
|||
if (postModel) {
|
||||
const topic = postModel.get('topic');
|
||||
if (topic.get('accepted_answer')) {
|
||||
|
||||
var rawhtml = `
|
||||
<aside class='quote' data-post="${topic.get('accepted_answer').post_number}" data-topic="${topic.id}"><div class='title'>
|
||||
<aside class='quote' data-post="${topic.get('accepted_answer').post_number}" data-topic="${topic.get('id')}">
|
||||
<div class='title'>
|
||||
${topic.get('acceptedAnswerHtml')} <div class="quote-controls"><\/div>
|
||||
</div>
|
||||
<blockquote>
|
||||
${topic.get('accepted_answer').excerpt}
|
||||
</blockquote>
|
||||
<blockquote></blockquote>
|
||||
</aside>`
|
||||
|
||||
console.log(topic.id);
|
||||
var cooked = new PostCooked({cooked:rawhtml, topicId: topic.id});
|
||||
var cooked = new PostCooked({cooked:rawhtml});
|
||||
|
||||
var html = cooked.init();
|
||||
|
||||
return dec.rawHtml(html);
|
||||
|
||||
// html = postModel._insertQuoteControls(html);
|
||||
// return html;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
10
plugin.rb
10
plugin.rb
|
@ -224,19 +224,17 @@ SQL
|
|||
{
|
||||
post_number: info[0],
|
||||
username: info[1],
|
||||
excerpt: info[2]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def accepted_answer_post_info
|
||||
# TODO: we may already have it in the stream ... so bypass query here
|
||||
post = Post.where(id: accepted_answer_post_id, topic_id: object.topic.id).joins(:user).first
|
||||
excerpt = post.excerpt
|
||||
|
||||
return [post.post_number, post.username, post.excerpt(100)]
|
||||
|
||||
|
||||
Post.where(id: accepted_answer_post_id, topic_id: object.topic.id)
|
||||
.joins(:user)
|
||||
.pluck('post_number, username')
|
||||
.first
|
||||
end
|
||||
|
||||
def accepted_answer_post_id
|
||||
|
|
Loading…
Reference in New Issue