FIX: correct template for search in post (regression)

This commit is contained in:
Sam 2014-09-03 16:50:46 +10:00
parent 870fd70525
commit d4f08f442c
5 changed files with 16 additions and 2 deletions

View File

@ -91,12 +91,15 @@ export default Em.Controller.extend(Discourse.Presence, {
if(results[name].length > 0) {
results.resultTypes.push({
results: results[name],
displayType: (context && Em.get(context, 'type') === 'topic' && type === 'topic') ? 'post' : type,
type: type,
more: r['more_' + name]
});
}
});
results.displayType = self.get('searchContext') === 'topic' ? 'post' : results.type;
var noResults = urls.length === 0;
self.setProperties({ noResults: noResults,
resultCount: urls.length,

View File

@ -22,7 +22,7 @@
{{/if}}
{{/if}}
</li>
{{view 'search-results-type' type=resultType.type content=resultType.results}}
{{view 'search-results-type' type=resultType.type displayType=resultType.displayType content=resultType.results}}
</ul>
{{/each}}
{{else}}

View File

@ -0,0 +1,10 @@
<a class='search-link' href='{{unbound url}}'>
<span class='topic'>
{{i18n search.post_format post_number=post_number username=username}}
</span>
{{#unless Discourse.Mobile.mobileView}}
<span class='blurb'>
{{{unbound blurb}}}
</span>
{{/unless}}
</a>

View File

@ -3,6 +3,6 @@ export default Ember.CollectionView.extend({
itemViewClass: Discourse.GroupedView.extend({
tagName: 'li',
classNameBindings: ['selected'],
templateName: Discourse.computed.fmt('parentView.type', "search/%@_result")
templateName: Discourse.computed.fmt('parentView.displayType', "search/%@_result")
})
});

View File

@ -732,6 +732,7 @@ en:
title: "search topics, posts, users, or categories"
no_results: "No results found."
searching: "Searching ..."
post_format: "#{{post_number}} by {{username}}"
context:
user: "Search posts by @{{username}}"