diff --git a/resources/celerity/map.php b/resources/celerity/map.php --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -379,7 +379,7 @@ 'rsrc/js/application/files/behavior-icon-composer.js' => '8ef9ab58', 'rsrc/js/application/files/behavior-launch-icon-composer.js' => '48086888', 'rsrc/js/application/harbormaster/behavior-reorder-steps.js' => '957a7fde', - 'rsrc/js/application/herald/HeraldRuleEditor.js' => '4173dbd8', + 'rsrc/js/application/herald/HeraldRuleEditor.js' => '6291cf4a', 'rsrc/js/application/herald/PathTypeahead.js' => 'f7fc67ec', 'rsrc/js/application/herald/herald-rule-editor.js' => '7ebaeed3', 'rsrc/js/application/maniphest/behavior-batch-editor.js' => 'fe80fb6d', @@ -522,7 +522,7 @@ 'global-drag-and-drop-css' => '697324ad', 'harbormaster-css' => 'cec833b7', 'herald-css' => '59d48f01', - 'herald-rule-editor' => '4173dbd8', + 'herald-rule-editor' => '6291cf4a', 'herald-test-css' => '2b7d0f54', 'inline-comment-summary-css' => '14a91639', 'javelin-aphlict' => '493665ee', @@ -1054,19 +1054,6 @@ 0 => 'javelin-install', 1 => 'javelin-event', ), - '4173dbd8' => - array( - 0 => 'multirow-row-manager', - 1 => 'javelin-install', - 2 => 'javelin-typeahead', - 3 => 'javelin-util', - 4 => 'javelin-dom', - 5 => 'javelin-tokenizer', - 6 => 'javelin-typeahead-preloaded-source', - 7 => 'javelin-stratcom', - 8 => 'javelin-json', - 9 => 'phabricator-prefab', - ), '441f2137' => array( 0 => 'javelin-behavior', @@ -1202,12 +1189,15 @@ 2 => 'javelin-util', 3 => 'phabricator-shaped-request', ), - '62e18640' => + '6291cf4a' => array( - 0 => 'javelin-install', - 1 => 'javelin-util', - 2 => 'javelin-dom', - 3 => 'javelin-typeahead-normalizer', + 0 => 'multirow-row-manager', + 1 => 'javelin-install', + 2 => 'javelin-util', + 3 => 'javelin-dom', + 4 => 'javelin-stratcom', + 5 => 'javelin-json', + 6 => 'phabricator-prefab', ), '6453c869' => array( @@ -1242,6 +1232,13 @@ 0 => 'javelin-behavior', 1 => 'javelin-dom', ), + '62e18640' => + array( + 0 => 'javelin-install', + 1 => 'javelin-util', + 2 => 'javelin-dom', + 3 => 'javelin-typeahead-normalizer', + ), '75903ee1' => array( 0 => 'javelin-behavior', diff --git a/src/applications/herald/controller/HeraldRuleController.php b/src/applications/herald/controller/HeraldRuleController.php --- a/src/applications/herald/controller/HeraldRuleController.php +++ b/src/applications/herald/controller/HeraldRuleController.php @@ -496,7 +496,7 @@ 'default' => PhabricatorRepositoryPushLog::CHANGEFLAG_ADD, ), ), - 'template' => $this->buildTokenizerTemplates() + array( + 'template' => $this->buildTokenizerTemplates($handles) + array( 'rules' => $all_rules, ), 'author' => array($rule->getAuthorPHID() => @@ -581,7 +581,7 @@ } - protected function buildTokenizerTemplates() { + protected function buildTokenizerTemplates(array $handles) { $template = new AphrontTokenizerTemplateView(); $template = $template->render(); @@ -597,6 +597,8 @@ 'taskpriority' => '/typeahead/common/taskpriority/', 'arcanistprojects' => '/typeahead/common/arcanistprojects/', ), + 'username' => $this->getRequest()->getUser()->getUserName(), + 'icons' => mpull($handles, 'getTypeIcon', 'getPHID'), 'markup' => $template, ); } diff --git a/webroot/rsrc/js/application/herald/HeraldRuleEditor.js b/webroot/rsrc/js/application/herald/HeraldRuleEditor.js --- a/webroot/rsrc/js/application/herald/HeraldRuleEditor.js +++ b/webroot/rsrc/js/application/herald/HeraldRuleEditor.js @@ -1,11 +1,8 @@ /** * @requires multirow-row-manager * javelin-install - * javelin-typeahead * javelin-util * javelin-dom - * javelin-tokenizer - * javelin-typeahead-preloaded-source * javelin-stratcom * javelin-json * phabricator-prefab @@ -284,25 +281,24 @@ template = template.firstChild; template.id = ''; - var datasource = new JX.TypeaheadPreloadedSource( - this._config.template.source[type]); - - var typeahead = new JX.Typeahead(template); - typeahead.setDatasource(datasource); + var tokenizerConfig = { + root : template, + src : this._config.template.source[type], + icons : this._config.template.icons, + username : this._config.username + }; - var tokenizer = new JX.Tokenizer(template); - tokenizer.setLimit(limit); - tokenizer.setTypeahead(typeahead); - tokenizer.start(); + var build = JX.Prefab.buildTokenizer(tokenizerConfig); + build.tokenizer.start(); return [ template, function() { - return tokenizer.getTokens(); + return build.tokenizer.getTokens(); }, function(map) { for (var k in map) { - tokenizer.addToken(k, map[k]); + build.tokenizer.addToken(k, map[k]); } }]; },