mirror of
https://github.com/discourse/discourse.git
synced 2025-03-09 14:34:35 +00:00
UX: better title on search page
This commit is contained in:
parent
401fbdbfe7
commit
33f0d80ed5
app
assets/javascripts/discourse
controllers
views/search
config/locales
@ -2,12 +2,13 @@ import { ajax } from 'discourse/lib/ajax';
|
|||||||
import { translateResults, getSearchKey, isValidSearchTerm } from "discourse/lib/search";
|
import { translateResults, getSearchKey, isValidSearchTerm } from "discourse/lib/search";
|
||||||
import PreloadStore from 'preload-store';
|
import PreloadStore from 'preload-store';
|
||||||
import { getTransient, setTransient } from 'discourse/lib/page-tracker';
|
import { getTransient, setTransient } from 'discourse/lib/page-tracker';
|
||||||
|
import { escapeExpression } from 'discourse/lib/utilities';
|
||||||
|
|
||||||
export default Discourse.Route.extend({
|
export default Discourse.Route.extend({
|
||||||
queryParams: { q: {}, expanded: false, context_id: {}, context: {}, skip_context: {} },
|
queryParams: { q: {}, expanded: false, context_id: {}, context: {}, skip_context: {} },
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t('search.results_page');
|
return I18n.t('search.results_page', { term: escapeExpression(this.controllerFor("full-page-search").get('searchTerm')) });
|
||||||
},
|
},
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
|
@ -31,8 +31,6 @@ 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,
|
||||||
|
@ -29,7 +29,8 @@ class SearchController < ApplicationController
|
|||||||
search_args[:ip_address] = request.remote_ip
|
search_args[:ip_address] = request.remote_ip
|
||||||
search_args[:user_id] = current_user.id if current_user.present?
|
search_args[:user_id] = current_user.id if current_user.present?
|
||||||
|
|
||||||
search = Search.new(params[:q], search_args)
|
@search_term = params[:q]
|
||||||
|
search = Search.new(@search_term, search_args)
|
||||||
result = search.execute
|
result = search.execute
|
||||||
|
|
||||||
result.find_user_data(guardian) if result
|
result.find_user_data(guardian) if result
|
||||||
|
@ -1 +1 @@
|
|||||||
<% content_for :title do %><%= t 'js.search.results_page' %> - <%= SiteSetting.title %><% end %>
|
<% content_for :title do %><%= I18n.t('search.results_page', term: @search_term) %> - <%= SiteSetting.title %><% end %>
|
||||||
|
@ -1349,12 +1349,11 @@ 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 ..."
|
||||||
post_format: "#{{post_number}} by {{username}}"
|
post_format: "#{{post_number}} by {{username}}"
|
||||||
results_page: "Search Results"
|
results_page: "Search results for '{{term}}'"
|
||||||
more_results: "There are more results. Please narrow your search criteria."
|
more_results: "There are more results. Please narrow your search criteria."
|
||||||
cant_find: "Can’t find what you’re looking for?"
|
cant_find: "Can’t find what you’re looking for?"
|
||||||
start_new_topic: "Perhaps start a new topic?"
|
start_new_topic: "Perhaps start a new topic?"
|
||||||
|
@ -1618,6 +1618,7 @@ en:
|
|||||||
category: 'Categories'
|
category: 'Categories'
|
||||||
topic: 'Results'
|
topic: 'Results'
|
||||||
user: 'Users'
|
user: 'Users'
|
||||||
|
results_page: "Search results for '%{term}'"
|
||||||
|
|
||||||
sso:
|
sso:
|
||||||
login_error: "Login Error"
|
login_error: "Login Error"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user