Use truncate for search suggestions

This commit is contained in:
Toby Zerner 2015-06-18 17:41:47 +09:30
parent 822a216cc9
commit f2b500a6e5

View File

@ -1,4 +1,5 @@
import highlight from 'flarum/helpers/highlight';
import truncate from 'flarum/utils/truncate';
import ActionButton from 'flarum/components/action-button';
export default class DiscussionsSearchResults {
@ -27,7 +28,7 @@ export default class DiscussionsSearchResults {
return m('li.discussion-search-result', {'data-index': 'discussions'+discussion.id()},
m('a', { href: app.route.discussion(discussion, post.number()), config: m.route },
m('div.title', highlight(discussion.title(), string)),
m('div.excerpt', highlight(post.contentPlain().substring(0, 100), string))
m('div.excerpt', highlight(truncate(post.contentPlain(), 100), string))
)
);
}) : ''