UX: show title in search results
This commit is contained in:
parent
2fe2c1bfb9
commit
dbfd43c854
|
@ -33,7 +33,7 @@ export default createWidget('link', {
|
||||||
buildAttributes(attrs) {
|
buildAttributes(attrs) {
|
||||||
return {
|
return {
|
||||||
href: this.href(attrs),
|
href: this.href(attrs),
|
||||||
title: attrs.title ? I18n.t(attrs.title) : this.label(attrs)
|
title: attrs.title ? I18n.t(attrs.title, attrs.titleOptions) : this.label(attrs)
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { createWidget } from 'discourse/widgets/widget';
|
||||||
import { h } from 'virtual-dom';
|
import { h } from 'virtual-dom';
|
||||||
import { iconNode } from 'discourse-common/lib/icon-library';
|
import { iconNode } from 'discourse-common/lib/icon-library';
|
||||||
import highlightText from 'discourse/lib/highlight-text';
|
import highlightText from 'discourse/lib/highlight-text';
|
||||||
|
import { escapeExpression } from 'discourse/lib/utilities';
|
||||||
|
|
||||||
class Highlighted extends RawHtml {
|
class Highlighted extends RawHtml {
|
||||||
constructor(html, term) {
|
constructor(html, term) {
|
||||||
|
@ -30,6 +31,8 @@ function createSearchResult({ type, linkField, builder }) {
|
||||||
href: r.get(linkField),
|
href: r.get(linkField),
|
||||||
contents: () => builder.call(this, r, attrs.term),
|
contents: () => builder.call(this, r, attrs.term),
|
||||||
className: 'search-link',
|
className: 'search-link',
|
||||||
|
title: 'search.link_title',
|
||||||
|
titleOptions: { term: escapeExpression(attrs.term) },
|
||||||
searchResultId,
|
searchResultId,
|
||||||
searchResultType: type,
|
searchResultType: type,
|
||||||
searchContextEnabled: attrs.searchContextEnabled,
|
searchContextEnabled: attrs.searchContextEnabled,
|
||||||
|
@ -95,7 +98,7 @@ createSearchResult({
|
||||||
type: 'tag',
|
type: 'tag',
|
||||||
linkField: 'url',
|
linkField: 'url',
|
||||||
builder(t) {
|
builder(t) {
|
||||||
const tag = Handlebars.Utils.escapeExpression(t.get('id'));
|
const tag = escapeExpression(t.get('id'));
|
||||||
return h('a', { attributes: { href: t.get('url') }, className: `tag-${tag} discourse-tag ${Discourse.SiteSettings.tag_style}`}, tag);
|
return h('a', { attributes: { href: t.get('url') }, className: `tag-${tag} discourse-tag ${Discourse.SiteSettings.tag_style}`}, tag);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1349,6 +1349,7 @@ en:
|
||||||
one: "1 result for <span class='term'>{{term}}</span>"
|
one: "1 result for <span class='term'>{{term}}</span>"
|
||||||
other: "{{count}} results for <span class='term'>{{term}}</span>"
|
other: "{{count}} results for <span class='term'>{{term}}</span>"
|
||||||
title: "search topics, posts, users, or categories"
|
title: "search topics, posts, users, or categories"
|
||||||
|
link_title: "search result for '{{term}}'"
|
||||||
no_results: "No results found."
|
no_results: "No results found."
|
||||||
no_more_results: "No more results found."
|
no_more_results: "No more results found."
|
||||||
searching: "Searching ..."
|
searching: "Searching ..."
|
||||||
|
|
Loading…
Reference in New Issue