mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
REFACTOR: break search results in multiple sub components
This change will introduce: - search-result-entries - search-result-entry making the full-page-search template easier and less risky to override.
This commit is contained in:
parent
fb0b4e26a9
commit
4dcdbd7801
@ -0,0 +1,5 @@
|
||||
import Component from "@ember/component";
|
||||
|
||||
export default Component.extend({
|
||||
tagName: "",
|
||||
});
|
@ -0,0 +1,5 @@
|
||||
import Component from "@ember/component";
|
||||
|
||||
export default Component.extend({
|
||||
tagName: "",
|
||||
});
|
@ -0,0 +1,5 @@
|
||||
<div class="fps-result-entries">
|
||||
{{#each posts as |post|}}
|
||||
{{search-result-entry post=post}}
|
||||
{{/each}}
|
||||
</div>
|
@ -0,0 +1,66 @@
|
||||
<div class="fps-result">
|
||||
<div class="author">
|
||||
<a href={{post.userPath}} data-user-card={{post.username}}>
|
||||
{{avatar post imageSize="large"}}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="fps-topic">
|
||||
<div class="topic">
|
||||
{{#if bulkSelectEnabled}}
|
||||
{{track-selected selectedList=selected selectedId=post.topic class="bulk-select"}}
|
||||
{{/if}}
|
||||
|
||||
<a href={{post.url}} {{action "logClick" post.topic_id}} class="search-link">
|
||||
{{raw "topic-status" topic=post.topic showPrivateMessageIcon=true}}
|
||||
<span class="topic-title">
|
||||
{{#if post.useTopicTitleHeadline}}
|
||||
{{html-safe post.topicTitleHeadline}}
|
||||
{{else}}
|
||||
{{#highlight-search highlight=q}}
|
||||
{{html-safe post.topic.fancyTitle}}
|
||||
{{/highlight-search}}
|
||||
{{/if}}
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<div class="search-category">
|
||||
{{#if post.topic.category.parentCategory}}
|
||||
{{category-link post.topic.category.parentCategory}}
|
||||
{{/if}}
|
||||
{{category-link post.topic.category hideParent=true}}
|
||||
{{#if post.topic}}
|
||||
{{discourse-tags post.topic}}
|
||||
{{/if}}
|
||||
{{plugin-outlet name="full-page-search-category" args=(hash post=post)}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="blurb container">
|
||||
<span class="date">
|
||||
{{format-date post.created_at format="tiny"}}
|
||||
{{#if post.blurb}}
|
||||
<span class="separator">-</span>
|
||||
{{/if}}
|
||||
</span>
|
||||
|
||||
{{#if post.blurb}}
|
||||
{{#if siteSettings.use_pg_headlines_for_excerpt}}
|
||||
{{html-safe post.blurb}}
|
||||
{{else}}
|
||||
{{#highlight-search highlight=highlightQuery}}
|
||||
{{html-safe post.blurb}}
|
||||
{{/highlight-search}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
{{#if showLikeCount}}
|
||||
{{#if post.like_count}}
|
||||
<span class="like-count">
|
||||
<span class="value">{{post.like_count}}</span> {{d-icon "heart"}}
|
||||
</span>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
@ -79,74 +79,7 @@
|
||||
{{else}}
|
||||
<div class="search-results">
|
||||
{{#load-more selector=".fps-result" action=(action "loadMore")}}
|
||||
{{#each model.posts as |result|}}
|
||||
<div class="fps-result">
|
||||
<div class="author">
|
||||
<a href={{result.userPath}} data-user-card={{result.username}}>
|
||||
{{avatar result imageSize="large"}}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="fps-topic">
|
||||
<div class="topic">
|
||||
{{#if bulkSelectEnabled}}
|
||||
{{track-selected selectedList=selected selectedId=result.topic class="bulk-select"}}
|
||||
{{/if}}
|
||||
|
||||
<a href={{result.url}} {{action "logClick" result.topic_id}} class="search-link">
|
||||
{{raw "topic-status" topic=result.topic showPrivateMessageIcon=true}}
|
||||
<span class="topic-title">
|
||||
{{#if result.useTopicTitleHeadline}}
|
||||
{{html-safe result.topicTitleHeadline}}
|
||||
{{else}}
|
||||
{{#highlight-search highlight=q}}
|
||||
{{html-safe result.topic.fancyTitle}}
|
||||
{{/highlight-search}}
|
||||
{{/if}}
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<div class="search-category">
|
||||
{{#if result.topic.category.parentCategory}}
|
||||
{{category-link result.topic.category.parentCategory}}
|
||||
{{/if}}
|
||||
{{category-link result.topic.category hideParent=true}}
|
||||
{{#if result.topic}}
|
||||
{{discourse-tags result.topic}}
|
||||
{{/if}}
|
||||
{{plugin-outlet name="full-page-search-category" args=(hash result=result)}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="blurb container">
|
||||
<span class="date">
|
||||
{{format-date result.created_at format="tiny"}}
|
||||
{{#if result.blurb}}
|
||||
-
|
||||
{{/if}}
|
||||
</span>
|
||||
|
||||
{{#if result.blurb}}
|
||||
{{#if siteSettings.use_pg_headlines_for_excerpt}}
|
||||
{{html-safe result.blurb}}
|
||||
{{else}}
|
||||
{{#highlight-search highlight=highlightQuery}}
|
||||
{{html-safe result.blurb}}
|
||||
{{/highlight-search}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
{{#if showLikeCount}}
|
||||
{{#if result.like_count}}
|
||||
<span class="like-count">
|
||||
{{result.like_count}} {{d-icon "heart"}}
|
||||
</span>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
{{search-result-entries posts=model.posts}}
|
||||
|
||||
{{#conditional-loading-spinner condition=loading }}
|
||||
{{#unless hasResults}}
|
||||
|
Loading…
Reference in New Issue
Block a user