mirror of
https://github.com/discourse/discourse.git
synced 2025-09-12 21:10:47 +08:00
FEATURE: show header search results on search log term details page
This commit is contained in:
parent
3c0296c625
commit
79eb9d7086
9 changed files with 70 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
|||
import { ajax } from 'discourse/lib/ajax';
|
||||
import { fillMissingDates } from 'discourse/lib/utilities';
|
||||
import { translateResults } from "discourse/lib/search";
|
||||
|
||||
export default Discourse.Route.extend({
|
||||
queryParams: {
|
||||
|
@ -22,6 +23,9 @@ export default Discourse.Route.extend({
|
|||
const endDate = moment(json.term.end_date).format('YYYY-MM-DD');
|
||||
json.term.data = fillMissingDates(json.term.data, startDate, endDate);
|
||||
}
|
||||
if (json.term.search_result) {
|
||||
json.term.search_result = translateResults(json.term.search_result)
|
||||
}
|
||||
|
||||
const model = Ember.Object.create({ type: "search_log_term" });
|
||||
model.setProperties(json.term);
|
||||
|
|
|
@ -10,4 +10,53 @@
|
|||
|
||||
{{#conditional-loading-spinner condition=refreshing}}
|
||||
{{admin-graph model=model}}
|
||||
|
||||
<br><br>
|
||||
<h2> {{i18n "admin.logs.search_logs.header_search_results"}} </h2>
|
||||
<br>
|
||||
|
||||
<div class='header-search-results'>
|
||||
{{#each model.search_result.posts as |result|}}
|
||||
<div class='fps-result'>
|
||||
<div class='author'>
|
||||
<a href={{result.userPath}} data-user-card="{{unbound result.username}}">
|
||||
{{avatar result imageSize="large"}}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class='fps-topic'>
|
||||
<div class='topic'>
|
||||
<a class='search-link' href='{{unbound result.url}}'>
|
||||
{{topic-status topic=result.topic disableActions=true}}<span class='topic-title'>{{#highlight-text highlight=term}}{{{unbound result.topic.fancyTitle}}}{{/highlight-text}}</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}}
|
||||
{{#each result.topic.tags as |tag|}}
|
||||
{{discourse-tag tag}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='blurb container'>
|
||||
<span class='date'>
|
||||
{{format-age result.created_at}}
|
||||
{{#if result.blurb}}
|
||||
-
|
||||
{{/if}}
|
||||
</span>
|
||||
|
||||
{{#if result.blurb}}
|
||||
{{#highlight-text highlight=term}}
|
||||
{{{unbound result.blurb}}}
|
||||
{{/highlight-text}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/conditional-loading-spinner}}
|
||||
|
|
|
@ -237,6 +237,10 @@ $mobile-breakpoint: 700px;
|
|||
width: 200px;
|
||||
float: right;
|
||||
}
|
||||
.header-search-results {
|
||||
clear: both;
|
||||
padding: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.admin-container .controls {
|
||||
|
@ -368,7 +372,7 @@ $mobile-breakpoint: 700px;
|
|||
}
|
||||
|
||||
.d-editor-textarea-wrapper {
|
||||
max-width: 60%;
|
||||
max-width: 60%;
|
||||
.d-editor-button-bar {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue