1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 06:20:56 +01:00

Search - making clicking the search button not submit placeholder text

Summary: Need to wire up the button to have a click handler that clears out the placeholder text. Fixes T4847.

Test Plan: Clicked the search button and got results for nothing as opposed to "Search." Typed a search and clicked button and got expected results.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T4847

Differential Revision: https://secure.phabricator.com/D8960
This commit is contained in:
Bob Trahan 2014-05-02 17:57:01 -07:00
parent 83dc10f6ac
commit bfa8803287
3 changed files with 25 additions and 15 deletions
resources/celerity
src/view/page/menu
webroot/rsrc/js/core

View file

@ -8,7 +8,7 @@ return array(
'names' =>
array(
'core.pkg.css' => 'afe6e16d',
'core.pkg.js' => '417722ff',
'core.pkg.js' => 'c415c382',
'darkconsole.pkg.js' => 'ca8671ce',
'differential.pkg.css' => '4b8686e3',
'differential.pkg.js' => '11a5b750',
@ -472,7 +472,7 @@ return array(
'rsrc/js/core/behavior-refresh-csrf.js' => 'c4b31646',
'rsrc/js/core/behavior-remarkup-preview.js' => 'f7379f45',
'rsrc/js/core/behavior-reveal-content.js' => '8f24abfc',
'rsrc/js/core/behavior-search-typeahead.js' => 'f6b56f7a',
'rsrc/js/core/behavior-search-typeahead.js' => 'd8469741',
'rsrc/js/core/behavior-select-on-click.js' => '0e34ca02',
'rsrc/js/core/behavior-toggle-class.js' => 'a82a7769',
'rsrc/js/core/behavior-tokenizer.js' => 'b3a4b884',
@ -605,7 +605,7 @@ return array(
'javelin-behavior-phabricator-oncopy' => 'c3e218fe',
'javelin-behavior-phabricator-remarkup-assist' => 'c021950a',
'javelin-behavior-phabricator-reveal-content' => '8f24abfc',
'javelin-behavior-phabricator-search-typeahead' => 'f6b56f7a',
'javelin-behavior-phabricator-search-typeahead' => 'd8469741',
'javelin-behavior-phabricator-show-all-transactions' => '7c273581',
'javelin-behavior-phabricator-tooltips' => '48db4145',
'javelin-behavior-phabricator-transaction-comment-form' => '9084a36f',
@ -1768,6 +1768,16 @@ return array(
3 => 'javelin-dom',
4 => 'phabricator-keyboard-shortcut',
),
'd8469741' =>
array(
0 => 'javelin-behavior',
1 => 'javelin-typeahead-ondemand-source',
2 => 'javelin-typeahead',
3 => 'javelin-dom',
4 => 'javelin-uri',
5 => 'javelin-util',
6 => 'javelin-stratcom',
),
'd8e135db' =>
array(
0 => 'javelin-behavior',
@ -1898,16 +1908,6 @@ return array(
2 => 'javelin-util',
3 => 'javelin-reactor',
),
'f6b56f7a' =>
array(
0 => 'javelin-behavior',
1 => 'javelin-typeahead-ondemand-source',
2 => 'javelin-typeahead',
3 => 'javelin-dom',
4 => 'javelin-uri',
5 => 'javelin-util',
6 => 'javelin-stratcom',
),
'f7379f45' =>
array(
0 => 'javelin-behavior',

View file

@ -14,8 +14,9 @@ final class PhabricatorMainMenuSearchView extends AphrontView {
public function render() {
$user = $this->user;
$target_id = celerity_generate_unique_node_id();
$target_id = celerity_generate_unique_node_id();
$search_id = $this->getID();
$button_id = celerity_generate_unique_node_id();
$input = phutil_tag(
'input',
@ -39,6 +40,7 @@ final class PhabricatorMainMenuSearchView extends AphrontView {
array(
'id' => $target_id,
'input' => $search_id,
'button' => $button_id,
'src' => '/typeahead/common/mainsearch/',
'limit' => 10,
'placeholder' => pht('Search'),
@ -60,7 +62,10 @@ final class PhabricatorMainMenuSearchView extends AphrontView {
),
phutil_tag_div('phabricator-main-menu-search-container', array(
$input,
phutil_tag('button', array(), pht('Search')),
phutil_tag(
'button',
array('id' => $button_id),
pht('Search')),
$primary_input,
$target,
)));

View file

@ -130,4 +130,9 @@ JX.behavior('phabricator-search-typeahead', function(config) {
});
typeahead.start();
JX.DOM.listen(JX.$(config.button), 'click', null, function (e) {
typeahead.setPlaceholder('');
typeahead.updatePlaceHolder();
});
});