1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 16:52:41 +01:00

Mostly modernize the policy control typeahead

Summary:
Ref T4420. This doesn't share all the code it really should, and renders a little odd. Make it more standard.

(Icons aren't handled totally correctly but there's no usability impact and all that code should just get cleaned up.)

Test Plan: Used custom policy typeahead, had a more standard experience.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4420

Differential Revision: https://secure.phabricator.com/D9902
This commit is contained in:
epriestley 2014-07-17 15:56:20 -07:00
parent 0e6756775c
commit 4135ba48b0
2 changed files with 17 additions and 24 deletions

View file

@ -414,7 +414,7 @@ return array(
'rsrc/js/application/phortune/behavior-test-payment-form.js' => 'ab8d2723',
'rsrc/js/application/phortune/phortune-credit-card-form.js' => '2290aeef',
'rsrc/js/application/policy/behavior-policy-control.js' => 'f3fef818',
'rsrc/js/application/policy/behavior-policy-rule-editor.js' => '0ea85aa3',
'rsrc/js/application/policy/behavior-policy-rule-editor.js' => 'fe9a552f',
'rsrc/js/application/ponder/behavior-votebox.js' => '4e9b766b',
'rsrc/js/application/projects/behavior-boards-dropdown.js' => '0ec56e1d',
'rsrc/js/application/projects/behavior-project-boards.js' => 'c6b95cbd',
@ -641,7 +641,7 @@ return array(
'javelin-behavior-phui-object-box-tabs' => 'a3e2244e',
'javelin-behavior-phui-timeline-dropdown-menu' => '4d94d9c3',
'javelin-behavior-policy-control' => 'f3fef818',
'javelin-behavior-policy-rule-editor' => '0ea85aa3',
'javelin-behavior-policy-rule-editor' => 'fe9a552f',
'javelin-behavior-ponder-votebox' => '4e9b766b',
'javelin-behavior-project-boards' => 'c6b95cbd',
'javelin-behavior-project-create' => '065227cc',
@ -899,17 +899,6 @@ return array(
3 => 'javelin-util',
4 => 'phabricator-notification-css',
),
'0ea85aa3' => array(
0 => 'javelin-behavior',
1 => 'multirow-row-manager',
2 => 'javelin-dom',
3 => 'javelin-util',
4 => 'phabricator-prefab',
5 => 'javelin-tokenizer',
6 => 'javelin-typeahead',
7 => 'javelin-typeahead-ondemand-source',
8 => 'javelin-json',
),
'0ec56e1d' => array(
0 => 'javelin-behavior',
1 => 'javelin-dom',
@ -1956,6 +1945,14 @@ return array(
2 => 'javelin-dom',
3 => 'javelin-typeahead-normalizer',
),
'fe9a552f' => array(
0 => 'javelin-behavior',
1 => 'multirow-row-manager',
2 => 'javelin-dom',
3 => 'javelin-util',
4 => 'phabricator-prefab',
5 => 'javelin-json',
),
42126667 => array(
0 => 'javelin-behavior',
1 => 'javelin-dom',

View file

@ -5,9 +5,6 @@
* javelin-dom
* javelin-util
* phabricator-prefab
* javelin-tokenizer
* javelin-typeahead
* javelin-typeahead-ondemand-source
* javelin-json
*/
JX.behavior('policy-rule-editor', function(config) {
@ -124,15 +121,14 @@ JX.behavior('policy-rule-editor', function(config) {
node = JX.$H(template.markup).getNode();
node.id = '';
var datasource = new JX.TypeaheadOnDemandSource(template.uri);
var options = {
root: node,
src: template.uri,
placeholder: template.placeholder,
limit: template.limit
};
var typeahead = new JX.Typeahead(node);
typeahead.setDatasource(datasource);
var tokenizer = new JX.Tokenizer(node);
tokenizer.setLimit(template.limit);
tokenizer.setTypeahead(typeahead);
tokenizer.setPlaceholder(template.placeholder);
var tokenizer = JX.Prefab.buildTokenizer(options).tokenizer;
tokenizer.start();
get_fn = function() { return JX.keys(tokenizer.getTokens()); };