mirror of
https://github.com/flarum/core.git
synced 2025-05-02 13:43:39 +02:00
Only show search suggestion excerpt if we have it
We won’t have it if we didn’t do a fulltext search
This commit is contained in:
parent
35c05862a4
commit
9e6ad1f244
@ -24,11 +24,12 @@ export default class DiscussionsSearchResults {
|
||||
config: m.route
|
||||
})),
|
||||
(this.results[string] && this.results[string].length) ? this.results[string].map(discussion => {
|
||||
var post = discussion.relevantPosts()[0];
|
||||
var relevantPosts = discussion.relevantPosts();
|
||||
var post = relevantPosts && relevantPosts[0];
|
||||
return m('li.discussion-search-result', {'data-index': 'discussions'+discussion.id()},
|
||||
m('a', { href: app.route.discussion(discussion, post.number()), config: m.route },
|
||||
m('a', { href: app.route.discussion(discussion, post && post.number()), config: m.route },
|
||||
m('div.title', highlight(discussion.title(), string)),
|
||||
m('div.excerpt', highlight(truncate(post.contentPlain(), 100), string))
|
||||
post ? m('div.excerpt', highlight(truncate(post.contentPlain(), 100), string)) : ''
|
||||
)
|
||||
);
|
||||
}) : ''
|
||||
|
@ -68,10 +68,8 @@
|
||||
}
|
||||
|
||||
.discussion-search-result {
|
||||
& .title {
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
& .excerpt {
|
||||
margin-top: 3px;
|
||||
color: @fl-body-muted-color;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user