UX: better title on search page

This commit is contained in:
Arpit Jalan 2017-10-27 08:11:10 +05:30
parent 401fbdbfe7
commit 33f0d80ed5
6 changed files with 7 additions and 7 deletions

View File

@ -2,12 +2,13 @@ import { ajax } from 'discourse/lib/ajax';
import { translateResults, getSearchKey, isValidSearchTerm } from "discourse/lib/search";
import PreloadStore from 'preload-store';
import { getTransient, setTransient } from 'discourse/lib/page-tracker';
import { escapeExpression } from 'discourse/lib/utilities';
export default Discourse.Route.extend({
queryParams: { q: {}, expanded: false, context_id: {}, context: {}, skip_context: {} },
titleToken() {
return I18n.t('search.results_page');
return I18n.t('search.results_page', { term: escapeExpression(this.controllerFor("full-page-search").get('searchTerm')) });
},
model(params) {

View File

@ -31,8 +31,6 @@ function createSearchResult({ type, linkField, builder }) {
href: r.get(linkField),
contents: () => builder.call(this, r, attrs.term),
className: 'search-link',
title: 'search.link_title',
titleOptions: { term: escapeExpression(attrs.term) },
searchResultId,
searchResultType: type,
searchContextEnabled: attrs.searchContextEnabled,

View File

@ -29,7 +29,8 @@ class SearchController < ApplicationController
search_args[:ip_address] = request.remote_ip
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.find_user_data(guardian) if result

View File

@ -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 %>

View File

@ -1349,12 +1349,11 @@ en:
one: "1 result for <span class='term'>{{term}}</span>"
other: "{{count}} results for <span class='term'>{{term}}</span>"
title: "search topics, posts, users, or categories"
link_title: "search result for '{{term}}'"
no_results: "No results found."
no_more_results: "No more results found."
searching: "Searching ..."
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."
cant_find: "Cant find what youre looking for?"
start_new_topic: "Perhaps start a new topic?"

View File

@ -1618,6 +1618,7 @@ en:
category: 'Categories'
topic: 'Results'
user: 'Users'
results_page: "Search results for '%{term}'"
sso:
login_error: "Login Error"