Herald - make tokenizers have the purdy icons
Summary: ...use the prefab stuff as it does fancier things than we were doing. Only trick then really is to pass username and the map of handle phids => icons to the client so prefab can work nicely. Fixes T4775. Test Plan: made a herald rule with projects and users. Saw nice icons. Reloaded page and still saw nice icons. Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T4775 Differential Revision: https://secure.phabricator.com/D8749
This commit is contained in:
@@ -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 @@ JX.install('HeraldRuleEditor', {
|
||||
template = template.firstChild;
|
||||
template.id = '';
|
||||
|
||||
var datasource = new JX.TypeaheadPreloadedSource(
|
||||
this._config.template.source[type]);
|
||||
var tokenizerConfig = {
|
||||
root : template,
|
||||
src : this._config.template.source[type],
|
||||
icons : this._config.template.icons,
|
||||
username : this._config.username
|
||||
};
|
||||
|
||||
var typeahead = new JX.Typeahead(template);
|
||||
typeahead.setDatasource(datasource);
|
||||
|
||||
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]);
|
||||
}
|
||||
}];
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user