From 6cefbde8202c314bdbf361324dbd0c48e5113d81 Mon Sep 17 00:00:00 2001 From: Waseem Daher Date: Thu, 31 Jan 2013 10:54:13 -0500 Subject: [PATCH] Make "Find" option read "Find x in page". (imported from commit 5d95b996f4d944c285ca6f5bc0f75ea359cb4df2) --- zephyr/static/js/search.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/zephyr/static/js/search.js b/zephyr/static/js/search.js index 9aeab47c62..35febd78ff 100644 --- a/zephyr/static/js/search.js +++ b/zephyr/static/js/search.js @@ -15,28 +15,31 @@ function render_object_in_parts(obj) { // N.B. action is *not* escaped by the caller switch (obj.action) { case 'search': - return {action: 'Find', search: obj.query}; + return {prefix: 'Find', query: obj.query, suffix: 'in page'}; case 'stream': - return {action: 'Narrow to stream', search: obj.query}; + return {prefix: 'Narrow to stream', query: obj.query, suffix: ''}; case 'private_message': - return {action: 'Narrow to person', - search: typeahead_helper.render_pm_object(obj.query)}; + return {prefix: 'Narrow to person', + query: typeahead_helper.render_pm_object(obj.query), + suffix: ''}; case 'operators': // HACK: This label needs to be distinct from the above, because of the // way we identify action objects by their labels. Using two spaces // after 'Narrow to' ensures this, and is invisible with standard HTML // whitespace handling. - return {action: 'Narrow to ', search: narrow.describe(obj.operators)}; + return {prefix: 'Narrow to ', + query: narrow.describe(obj.operators), + suffix: ''}; } - return {action: 'Error', search: 'Error'}; + return {prefix: 'Error', query: 'Error', suffix: 'Error'}; } function render_object(obj) { var parts = render_object_in_parts(obj); - return parts.action + " " + parts.search; + return parts.prefix + " " + parts.query + " " + parts.suffix; } exports.update_typeahead = function () { @@ -194,8 +197,9 @@ exports.initialize = function () { var parts = render_object_in_parts(mapped[item]); // We provide action, not the user, so this should // be fine from a not-needing-escaping perspective. - return parts.action + " " + - typeahead_helper.highlight_with_escaping(query, parts.search); + return parts.prefix + " " + + typeahead_helper.highlight_with_escaping(query, parts.query) + + " " + parts.suffix; }, matcher: function (item) { var obj = mapped[item];