2011-07-15 22:30:55 -07:00
|
|
|
/**
|
|
|
|
|
* @provides phabricator-prefab
|
|
|
|
|
* @requires javelin-install
|
|
|
|
|
* javelin-util
|
|
|
|
|
* javelin-dom
|
Use Javelin placeholders and new sorting rules broadly; consolidate tokenizer construction code
Summary:
- We have three nearly-identical blocks of Tokenizer construction code; consolidate them into Prefab.
- Add placeholder support.
- Augment server-side stuff to specify placeholder text.
Test Plan: Verified behavior of Differential edit tokenizers, Differential comment tokenizers, Maniphest edit tokenizers, Maniphest comment tokenizers, Maniphest filter tokenizers, Differential filter tokenizers, Owners filter tokenizers, Owners edit tokenizers, Herald edit tokenizers, Audit filter tokenizers.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T772, T946
Differential Revision: https://secure.phabricator.com/D1844
2012-03-09 15:46:39 -08:00
|
|
|
* javelin-typeahead
|
|
|
|
|
* javelin-tokenizer
|
|
|
|
|
* javelin-typeahead-preloaded-source
|
|
|
|
|
* javelin-typeahead-ondemand-source
|
|
|
|
|
* javelin-dom
|
|
|
|
|
* javelin-stratcom
|
|
|
|
|
* javelin-util
|
2011-07-15 22:30:55 -07:00
|
|
|
* @javelin
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Utilities for client-side rendering (the greatest thing in the world).
|
|
|
|
|
*/
|
|
|
|
|
JX.install('Prefab', {
|
|
|
|
|
|
|
|
|
|
statics : {
|
2015-12-04 14:37:27 -08:00
|
|
|
renderSelect : function(map, selected, attrs, order) {
|
2011-07-15 22:30:55 -07:00
|
|
|
var select = JX.$N('select', attrs || {});
|
2015-12-04 14:37:27 -08:00
|
|
|
|
|
|
|
|
// Callers may optionally pass "order" to force options into a specific
|
|
|
|
|
// order. Although most browsers do retain order, maps in Javascript
|
|
|
|
|
// aren't technically ordered. Safari, at least, will reorder maps with
|
|
|
|
|
// numeric keys.
|
|
|
|
|
|
|
|
|
|
order = order || JX.keys(map);
|
|
|
|
|
|
|
|
|
|
var k;
|
|
|
|
|
for (var ii = 0; ii < order.length; ii++) {
|
|
|
|
|
k = order[ii];
|
2011-07-15 22:30:55 -07:00
|
|
|
select.options[select.options.length] = new Option(map[k], k);
|
|
|
|
|
if (k == selected) {
|
|
|
|
|
select.value = k;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-12-04 14:37:27 -08:00
|
|
|
|
|
|
|
|
select.value = select.value || order[0];
|
|
|
|
|
|
2011-07-15 22:30:55 -07:00
|
|
|
return select;
|
Use Javelin placeholders and new sorting rules broadly; consolidate tokenizer construction code
Summary:
- We have three nearly-identical blocks of Tokenizer construction code; consolidate them into Prefab.
- Add placeholder support.
- Augment server-side stuff to specify placeholder text.
Test Plan: Verified behavior of Differential edit tokenizers, Differential comment tokenizers, Maniphest edit tokenizers, Maniphest comment tokenizers, Maniphest filter tokenizers, Differential filter tokenizers, Owners filter tokenizers, Owners edit tokenizers, Herald edit tokenizers, Audit filter tokenizers.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T772, T946
Differential Revision: https://secure.phabricator.com/D1844
2012-03-09 15:46:39 -08:00
|
|
|
},
|
|
|
|
|
|
2015-04-16 14:46:10 -07:00
|
|
|
newTokenizerFromTemplate: function(markup, config) {
|
|
|
|
|
var template = JX.$H(markup).getFragment().firstChild;
|
|
|
|
|
var container = JX.DOM.find(template, 'div', 'tokenizer-container');
|
|
|
|
|
|
|
|
|
|
container.id = '';
|
|
|
|
|
config.root = container;
|
|
|
|
|
|
|
|
|
|
var build = JX.Prefab.buildTokenizer(config);
|
|
|
|
|
build.node = template;
|
|
|
|
|
return build;
|
|
|
|
|
},
|
2014-07-17 15:52:58 -07:00
|
|
|
|
Use Javelin placeholders and new sorting rules broadly; consolidate tokenizer construction code
Summary:
- We have three nearly-identical blocks of Tokenizer construction code; consolidate them into Prefab.
- Add placeholder support.
- Augment server-side stuff to specify placeholder text.
Test Plan: Verified behavior of Differential edit tokenizers, Differential comment tokenizers, Maniphest edit tokenizers, Maniphest comment tokenizers, Maniphest filter tokenizers, Differential filter tokenizers, Owners filter tokenizers, Owners edit tokenizers, Herald edit tokenizers, Audit filter tokenizers.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T772, T946
Differential Revision: https://secure.phabricator.com/D1844
2012-03-09 15:46:39 -08:00
|
|
|
/**
|
|
|
|
|
* Build a Phabricator tokenizer out of a configuration with application
|
|
|
|
|
* sorting, datasource and placeholder rules.
|
|
|
|
|
*
|
2012-03-21 14:01:04 -07:00
|
|
|
* - `id` Root tokenizer ID (alternatively, pass `root`).
|
|
|
|
|
* - `root` Root tokenizer node (replaces `id`).
|
Use Javelin placeholders and new sorting rules broadly; consolidate tokenizer construction code
Summary:
- We have three nearly-identical blocks of Tokenizer construction code; consolidate them into Prefab.
- Add placeholder support.
- Augment server-side stuff to specify placeholder text.
Test Plan: Verified behavior of Differential edit tokenizers, Differential comment tokenizers, Maniphest edit tokenizers, Maniphest comment tokenizers, Maniphest filter tokenizers, Differential filter tokenizers, Owners filter tokenizers, Owners edit tokenizers, Herald edit tokenizers, Audit filter tokenizers.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T772, T946
Differential Revision: https://secure.phabricator.com/D1844
2012-03-09 15:46:39 -08:00
|
|
|
* - `src` Datasource URI.
|
|
|
|
|
* - `ondemand` Optional, use an ondemand source.
|
|
|
|
|
* - `value` Optional, initial value.
|
|
|
|
|
* - `limit` Optional, token limit.
|
|
|
|
|
* - `placeholder` Optional, placeholder text.
|
|
|
|
|
* - `username` Optional, username to sort first (i.e., viewer).
|
2014-02-16 16:13:40 -08:00
|
|
|
* - `icons` Optional, map of icons.
|
Use Javelin placeholders and new sorting rules broadly; consolidate tokenizer construction code
Summary:
- We have three nearly-identical blocks of Tokenizer construction code; consolidate them into Prefab.
- Add placeholder support.
- Augment server-side stuff to specify placeholder text.
Test Plan: Verified behavior of Differential edit tokenizers, Differential comment tokenizers, Maniphest edit tokenizers, Maniphest comment tokenizers, Maniphest filter tokenizers, Differential filter tokenizers, Owners filter tokenizers, Owners edit tokenizers, Herald edit tokenizers, Audit filter tokenizers.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T772, T946
Differential Revision: https://secure.phabricator.com/D1844
2012-03-09 15:46:39 -08:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
buildTokenizer : function(config) {
|
2014-02-16 16:13:40 -08:00
|
|
|
config.icons = config.icons || {};
|
|
|
|
|
|
2013-05-18 17:04:22 -07:00
|
|
|
var root;
|
|
|
|
|
|
2013-04-08 13:42:45 -07:00
|
|
|
try {
|
2013-05-18 17:04:22 -07:00
|
|
|
root = config.root || JX.$(config.id);
|
2013-04-08 13:42:45 -07:00
|
|
|
} catch (ex) {
|
|
|
|
|
// If the root element does not exist, just return without building
|
|
|
|
|
// anything. This happens in some cases -- like Conpherence -- where we
|
|
|
|
|
// may load a tokenizer but not put it in the document.
|
|
|
|
|
return;
|
|
|
|
|
}
|
Use Javelin placeholders and new sorting rules broadly; consolidate tokenizer construction code
Summary:
- We have three nearly-identical blocks of Tokenizer construction code; consolidate them into Prefab.
- Add placeholder support.
- Augment server-side stuff to specify placeholder text.
Test Plan: Verified behavior of Differential edit tokenizers, Differential comment tokenizers, Maniphest edit tokenizers, Maniphest comment tokenizers, Maniphest filter tokenizers, Differential filter tokenizers, Owners filter tokenizers, Owners edit tokenizers, Herald edit tokenizers, Audit filter tokenizers.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T772, T946
Differential Revision: https://secure.phabricator.com/D1844
2012-03-09 15:46:39 -08:00
|
|
|
|
|
|
|
|
var datasource;
|
Remove `tokenizer.ondemand`, and always load on demand
Summary:
Ref T4420. Tokenizers currently operate in "preload" or "ondemand" modes. In the former mode, which is default, they'll try to load the entire result list when a page loads.
The theory here was that this would slightly improve the experience for small installs, and once they got big enough they could switch to "ondemand". In practice, several issues have arisen:
- We generally don't have a good mechanism for telling installs that they should tweak perf config -- `metamta.send-immediately` is the canonical example here. Some large installs are probably affected negatively by not knowing to change this setting, and having settings like this is generally annoying.
- We have way way too much config now.
- With the advent of ApplicationSearch, pages like Maniphest make many redundant loads to prefill sources like projects. Most of the time, this data is not used. It's far simpler to switch everything to ondemand than try to deal with this, and dealing with this would mean creating two very complex divergent pathways in the codebase for a mostly theoretical performance benefit which only impacts tiny installs.
- We've been using `tokenizer.ondemand` forever on `secure.phabricator.com` since we have many thousands of user accounts, and it doesn't seem sluggish and works properly.
Removing this config is an easy fix which makes the codebase simpler.
I've retained the ability to use preloaded sources, since they may make sense in some cases (in at least one case -- task priorities -- adding a static source pathway might make sense), and they're part of Javelin itself. However, the code will no longer ever go down that pathway.
Test Plan: Used `secure.phabricator.com` for years with this setting enabled.
Reviewers: btrahan, chad
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T4420
Differential Revision: https://secure.phabricator.com/D8232
2014-02-14 10:24:40 -08:00
|
|
|
|
|
|
|
|
// Default to an ondemand source if no alternate configuration is
|
|
|
|
|
// provided.
|
|
|
|
|
var ondemand = true;
|
|
|
|
|
if ('ondemand' in config) {
|
|
|
|
|
ondemand = config.ondemand;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ondemand) {
|
Use Javelin placeholders and new sorting rules broadly; consolidate tokenizer construction code
Summary:
- We have three nearly-identical blocks of Tokenizer construction code; consolidate them into Prefab.
- Add placeholder support.
- Augment server-side stuff to specify placeholder text.
Test Plan: Verified behavior of Differential edit tokenizers, Differential comment tokenizers, Maniphest edit tokenizers, Maniphest comment tokenizers, Maniphest filter tokenizers, Differential filter tokenizers, Owners filter tokenizers, Owners edit tokenizers, Herald edit tokenizers, Audit filter tokenizers.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T772, T946
Differential Revision: https://secure.phabricator.com/D1844
2012-03-09 15:46:39 -08:00
|
|
|
datasource = new JX.TypeaheadOnDemandSource(config.src);
|
|
|
|
|
} else {
|
|
|
|
|
datasource = new JX.TypeaheadPreloadedSource(config.src);
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-15 09:30:29 -08:00
|
|
|
datasource.setSortHandler(
|
|
|
|
|
JX.bind(datasource, JX.Prefab.sortHandler, config));
|
2014-07-17 15:52:58 -07:00
|
|
|
datasource.setTransformer(JX.Prefab.transformDatasourceResults);
|
Use Javelin placeholders and new sorting rules broadly; consolidate tokenizer construction code
Summary:
- We have three nearly-identical blocks of Tokenizer construction code; consolidate them into Prefab.
- Add placeholder support.
- Augment server-side stuff to specify placeholder text.
Test Plan: Verified behavior of Differential edit tokenizers, Differential comment tokenizers, Maniphest edit tokenizers, Maniphest comment tokenizers, Maniphest filter tokenizers, Differential filter tokenizers, Owners filter tokenizers, Owners edit tokenizers, Herald edit tokenizers, Audit filter tokenizers.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T772, T946
Differential Revision: https://secure.phabricator.com/D1844
2012-03-09 15:46:39 -08:00
|
|
|
|
|
|
|
|
var typeahead = new JX.Typeahead(
|
|
|
|
|
root,
|
|
|
|
|
JX.DOM.find(root, 'input', 'tokenizer-input'));
|
|
|
|
|
typeahead.setDatasource(datasource);
|
|
|
|
|
|
|
|
|
|
var tokenizer = new JX.Tokenizer(root);
|
|
|
|
|
tokenizer.setTypeahead(typeahead);
|
2015-04-17 07:00:43 -07:00
|
|
|
tokenizer.setRenderTokenCallback(function(value, key, container) {
|
2015-12-04 09:30:53 -08:00
|
|
|
var result;
|
|
|
|
|
if (value && (typeof value == 'object') && ('id' in value)) {
|
|
|
|
|
// TODO: In this case, we've been passed the decoded wire format
|
|
|
|
|
// dictionary directly. Token rendering is kind of a huge mess that
|
|
|
|
|
// should be cleaned up and made more consistent. Just force our
|
|
|
|
|
// way through for now.
|
|
|
|
|
result = value;
|
|
|
|
|
} else {
|
|
|
|
|
result = datasource.getResult(key);
|
|
|
|
|
}
|
2014-07-21 06:44:27 -07:00
|
|
|
|
|
|
|
|
var icon;
|
2015-04-17 07:00:43 -07:00
|
|
|
var type;
|
2015-04-19 07:17:54 -07:00
|
|
|
var color;
|
2014-07-21 06:44:27 -07:00
|
|
|
if (result) {
|
|
|
|
|
icon = result.icon;
|
|
|
|
|
value = result.displayName;
|
2015-04-17 07:00:43 -07:00
|
|
|
type = result.tokenType;
|
2015-04-19 07:17:54 -07:00
|
|
|
color = result.color;
|
2014-02-14 10:23:56 -08:00
|
|
|
} else {
|
2015-04-20 08:16:28 -07:00
|
|
|
icon = (config.icons || {})[key];
|
|
|
|
|
type = (config.types || {})[key];
|
|
|
|
|
color = (config.colors || {})[key];
|
2014-02-14 10:23:56 -08:00
|
|
|
}
|
|
|
|
|
|
2014-07-21 06:44:27 -07:00
|
|
|
if (icon) {
|
|
|
|
|
icon = JX.Prefab._renderIcon(icon);
|
2014-02-14 10:23:56 -08:00
|
|
|
}
|
|
|
|
|
|
2015-04-19 07:17:54 -07:00
|
|
|
type = type || 'object';
|
|
|
|
|
JX.DOM.alterClass(container, 'jx-tokenizer-token-' + type, true);
|
|
|
|
|
|
|
|
|
|
if (color) {
|
|
|
|
|
JX.DOM.alterClass(container, color, true);
|
2015-04-17 07:00:43 -07:00
|
|
|
}
|
2014-02-14 10:23:56 -08:00
|
|
|
|
|
|
|
|
return [icon, value];
|
|
|
|
|
});
|
Use Javelin placeholders and new sorting rules broadly; consolidate tokenizer construction code
Summary:
- We have three nearly-identical blocks of Tokenizer construction code; consolidate them into Prefab.
- Add placeholder support.
- Augment server-side stuff to specify placeholder text.
Test Plan: Verified behavior of Differential edit tokenizers, Differential comment tokenizers, Maniphest edit tokenizers, Maniphest comment tokenizers, Maniphest filter tokenizers, Differential filter tokenizers, Owners filter tokenizers, Owners edit tokenizers, Herald edit tokenizers, Audit filter tokenizers.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T772, T946
Differential Revision: https://secure.phabricator.com/D1844
2012-03-09 15:46:39 -08:00
|
|
|
|
|
|
|
|
if (config.placeholder) {
|
|
|
|
|
tokenizer.setPlaceholder(config.placeholder);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (config.limit) {
|
|
|
|
|
tokenizer.setLimit(config.limit);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (config.value) {
|
|
|
|
|
tokenizer.setInitialValue(config.value);
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-16 13:37:12 -07:00
|
|
|
if (config.browseURI) {
|
|
|
|
|
tokenizer.setBrowseURI(config.browseURI);
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-17 13:27:36 -08:00
|
|
|
if (config.disabled) {
|
|
|
|
|
tokenizer.setDisabled(true);
|
|
|
|
|
}
|
|
|
|
|
|
Use Javelin placeholders and new sorting rules broadly; consolidate tokenizer construction code
Summary:
- We have three nearly-identical blocks of Tokenizer construction code; consolidate them into Prefab.
- Add placeholder support.
- Augment server-side stuff to specify placeholder text.
Test Plan: Verified behavior of Differential edit tokenizers, Differential comment tokenizers, Maniphest edit tokenizers, Maniphest comment tokenizers, Maniphest filter tokenizers, Differential filter tokenizers, Owners filter tokenizers, Owners edit tokenizers, Herald edit tokenizers, Audit filter tokenizers.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T772, T946
Differential Revision: https://secure.phabricator.com/D1844
2012-03-09 15:46:39 -08:00
|
|
|
JX.Stratcom.addData(root, {'tokenizer' : tokenizer});
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
tokenizer: tokenizer
|
|
|
|
|
};
|
2014-07-17 15:52:58 -07:00
|
|
|
},
|
|
|
|
|
|
2016-01-15 09:30:29 -08:00
|
|
|
sortHandler: function(config, value, list, cmp) {
|
|
|
|
|
// Sort results so that the viewing user always comes up first; after
|
|
|
|
|
// that, prefer unixname matches to realname matches.
|
|
|
|
|
var priority_hits = {};
|
|
|
|
|
var self_hits = {};
|
|
|
|
|
|
2016-06-09 13:13:11 -07:00
|
|
|
// We'll put matches where the user's input is a prefix of the name
|
2017-10-09 10:48:01 -07:00
|
|
|
// above matches where that isn't true.
|
2016-06-09 13:13:11 -07:00
|
|
|
var prefix_hits = {};
|
|
|
|
|
|
2016-01-15 09:30:29 -08:00
|
|
|
var tokens = this.tokenize(value);
|
2016-06-09 13:13:11 -07:00
|
|
|
var normal = this.normalize(value);
|
2016-01-15 09:30:29 -08:00
|
|
|
|
|
|
|
|
for (var ii = 0; ii < list.length; ii++) {
|
|
|
|
|
var item = list[ii];
|
|
|
|
|
|
2016-06-09 13:13:11 -07:00
|
|
|
if (this.normalize(item.name).indexOf(normal) === 0) {
|
|
|
|
|
prefix_hits[item.id] = true;
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-15 09:30:29 -08:00
|
|
|
if (!item.priority) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (config.username && item.priority == config.username) {
|
|
|
|
|
self_hits[item.id] = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
list.sort(function(u, v) {
|
|
|
|
|
if (self_hits[u.id] != self_hits[v.id]) {
|
|
|
|
|
return self_hits[v.id] ? 1 : -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If one result is open and one is closed, show the open result
|
2017-10-09 10:48:01 -07:00
|
|
|
// first. The "!" tricks here are because closed values are display
|
2016-01-15 09:30:29 -08:00
|
|
|
// strings, so the value is either `null` or some truthy string. If
|
|
|
|
|
// we compare the values directly, we'll apply this rule to two
|
|
|
|
|
// objects which are both closed but for different reasons, like
|
|
|
|
|
// "Archived" and "Disabled".
|
|
|
|
|
|
|
|
|
|
var u_open = !u.closed;
|
|
|
|
|
var v_open = !v.closed;
|
|
|
|
|
|
|
|
|
|
if (u_open != v_open) {
|
|
|
|
|
if (u_open) {
|
|
|
|
|
return -1;
|
|
|
|
|
} else {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-09 13:13:11 -07:00
|
|
|
if (prefix_hits[u.id] != prefix_hits[v.id]) {
|
|
|
|
|
return prefix_hits[v.id] ? 1 : -1;
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-15 09:30:29 -08:00
|
|
|
// Sort users ahead of other result types.
|
|
|
|
|
if (u.priorityType != v.priorityType) {
|
|
|
|
|
if (u.priorityType == 'user') {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (v.priorityType == 'user') {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-09 13:13:11 -07:00
|
|
|
// Sort functions after other result types.
|
|
|
|
|
var uf = (u.tokenType == 'function');
|
|
|
|
|
var vf = (v.tokenType == 'function');
|
|
|
|
|
if (uf != vf) {
|
|
|
|
|
return uf ? 1 : -1;
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-15 09:30:29 -08:00
|
|
|
return cmp(u, v);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
2014-07-17 15:52:58 -07:00
|
|
|
/**
|
|
|
|
|
* Transform results from a wire format into a usable format in a standard
|
|
|
|
|
* way.
|
|
|
|
|
*/
|
|
|
|
|
transformDatasourceResults: function(fields) {
|
|
|
|
|
var closed = fields[9];
|
|
|
|
|
var closed_ui;
|
|
|
|
|
if (closed) {
|
|
|
|
|
closed_ui = JX.$N(
|
|
|
|
|
'div',
|
|
|
|
|
{className: 'tokenizer-closed'},
|
|
|
|
|
closed);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var icon = fields[8];
|
|
|
|
|
var icon_ui;
|
|
|
|
|
if (icon) {
|
|
|
|
|
icon_ui = JX.Prefab._renderIcon(icon);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var display = JX.$N(
|
|
|
|
|
'div',
|
|
|
|
|
{className: 'tokenizer-result'},
|
|
|
|
|
[icon_ui, fields[4] || fields[0], closed_ui]);
|
|
|
|
|
if (closed) {
|
|
|
|
|
JX.DOM.alterClass(display, 'tokenizer-result-closed', true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
name: fields[0],
|
|
|
|
|
displayName: fields[4] || fields[0],
|
|
|
|
|
display: display,
|
|
|
|
|
uri: fields[1],
|
|
|
|
|
id: fields[2],
|
|
|
|
|
priority: fields[3],
|
|
|
|
|
priorityType: fields[7],
|
|
|
|
|
imageURI: fields[6],
|
|
|
|
|
icon: icon,
|
|
|
|
|
closed: closed,
|
|
|
|
|
type: fields[5],
|
2015-04-16 15:30:41 -07:00
|
|
|
sprite: fields[10],
|
2015-04-19 07:17:54 -07:00
|
|
|
color: fields[11],
|
|
|
|
|
tokenType: fields[12],
|
2016-01-15 04:25:22 -08:00
|
|
|
unique: fields[13] || false,
|
2016-11-08 11:31:06 -08:00
|
|
|
autocomplete: fields[14],
|
|
|
|
|
sort: JX.TypeaheadNormalizer.normalize(fields[0])
|
2014-07-17 15:52:58 -07:00
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_renderIcon: function(icon) {
|
|
|
|
|
return JX.$N(
|
|
|
|
|
'span',
|
|
|
|
|
{className: 'phui-icon-view phui-font-fa ' + icon});
|
2011-07-15 22:30:55 -07:00
|
|
|
}
|
2014-07-17 15:52:58 -07:00
|
|
|
|
2011-07-15 22:30:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|