Merge pull request #49 from davidtaylorhq/quote_answer

Quote accepted answer at top
This commit is contained in:
Sam 2017-03-08 09:32:17 -05:00 committed by GitHub
commit 87126c4270
1 changed files with 15 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import TopicStatus from 'discourse/views/topic-status';
import { popupAjaxError } from 'discourse/lib/ajax-error';
import { withPluginApi } from 'discourse/lib/plugin-api';
import { ajax } from 'discourse/lib/ajax';
import PostCooked from 'discourse/widgets/post-cooked'
function clearAccepted(topic) {
const posts = topic.get('postStream.posts');
@ -153,7 +154,20 @@ function initializeWithApi(api) {
if (postModel) {
const topic = postModel.get('topic');
if (topic.get('accepted_answer')) {
return dec.rawHtml(`<p class="solved">${topic.get('acceptedAnswerHtml')}</p>`);
var rawhtml = `
<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></blockquote>
</aside>`
var cooked = new PostCooked({cooked:rawhtml});
var html = cooked.init();
return dec.rawHtml(html);
}
}
}