diff --git a/app/assets/javascripts/discourse/controllers/search.js.es6 b/app/assets/javascripts/discourse/controllers/search.js.es6 index f171a112d43..65805bde960 100644 --- a/app/assets/javascripts/discourse/controllers/search.js.es6 +++ b/app/assets/javascripts/discourse/controllers/search.js.es6 @@ -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, diff --git a/app/assets/javascripts/discourse/templates/search.js.handlebars b/app/assets/javascripts/discourse/templates/search.js.handlebars index aec7c6b53f2..d0ce0aae97c 100644 --- a/app/assets/javascripts/discourse/templates/search.js.handlebars +++ b/app/assets/javascripts/discourse/templates/search.js.handlebars @@ -22,7 +22,7 @@ {{/if}} {{/if}} - {{view 'search-results-type' type=resultType.type content=resultType.results}} + {{view 'search-results-type' type=resultType.type displayType=resultType.displayType content=resultType.results}} {{/each}} {{else}} diff --git a/app/assets/javascripts/discourse/templates/search/post_result.js.handlebars b/app/assets/javascripts/discourse/templates/search/post_result.js.handlebars new file mode 100644 index 00000000000..cda20bdc630 --- /dev/null +++ b/app/assets/javascripts/discourse/templates/search/post_result.js.handlebars @@ -0,0 +1,10 @@ + + + {{i18n search.post_format post_number=post_number username=username}} + + {{#unless Discourse.Mobile.mobileView}} + + {{{unbound blurb}}} + + {{/unless}} + diff --git a/app/assets/javascripts/discourse/views/search-results-type.js.es6 b/app/assets/javascripts/discourse/views/search-results-type.js.es6 index 9f88257d829..1ed3d355e2c 100644 --- a/app/assets/javascripts/discourse/views/search-results-type.js.es6 +++ b/app/assets/javascripts/discourse/views/search-results-type.js.es6 @@ -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") }) }); diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 4ce0084a30e..0aba63ccc45 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -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}}"