1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 19:40:55 +01:00

Fix rendering of project slugs in tokenizer UI

Summary: Fixes T5659. When building a token after a user selection, we currently use the `value` as the token text, but sometimes that's an internal name which doesn't make much sense to users. For projects, it is now "sluga slugb Proper Display Name". If available, use `displayName` instead.

Test Plan: Typed some projects into a tokenizer, got display names only.

Reviewers: chad, joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Maniphest Tasks: T5659

Differential Revision: https://secure.phabricator.com/D9996
This commit is contained in:
epriestley 2014-07-21 06:44:27 -07:00
parent 63ce0e66c9
commit af214ecb65
3 changed files with 24 additions and 22 deletions

View file

@ -8,7 +8,7 @@
return array(
'names' => array(
'core.pkg.css' => 'c2c68e64',
'core.pkg.js' => 'dc4959a8',
'core.pkg.js' => 'ba6a742f',
'darkconsole.pkg.js' => 'df001cab',
'differential.pkg.css' => '4a93db37',
'differential.pkg.js' => '7528cfc9',
@ -450,7 +450,7 @@ return array(
'rsrc/js/core/KeyboardShortcutManager.js' => 'ad7a69ca',
'rsrc/js/core/MultirowRowManager.js' => '41e47dea',
'rsrc/js/core/Notification.js' => '0c6946e7',
'rsrc/js/core/Prefab.js' => 'c11bac49',
'rsrc/js/core/Prefab.js' => 'bbae734c',
'rsrc/js/core/ShapedRequest.js' => '7cbe244b',
'rsrc/js/core/TextAreaUtils.js' => 'b3ec3cfc',
'rsrc/js/core/ToolTip.js' => '3915d490',
@ -737,7 +737,7 @@ return array(
'phabricator-notification-menu-css' => '8ae4a008',
'phabricator-object-selector-css' => '029a133d',
'phabricator-phtize' => 'd254d646',
'phabricator-prefab' => 'c11bac49',
'phabricator-prefab' => 'bbae734c',
'phabricator-profile-css' => 'b459416e',
'phabricator-remarkup-css' => 'ad4c0676',
'phabricator-search-results-css' => 'f240504c',
@ -1626,6 +1626,18 @@ return array(
1 => 'javelin-stratcom',
2 => 'javelin-dom',
),
'bbae734c' => array(
0 => 'javelin-install',
1 => 'javelin-util',
2 => 'javelin-dom',
3 => 'javelin-typeahead',
4 => 'javelin-tokenizer',
5 => 'javelin-typeahead-preloaded-source',
6 => 'javelin-typeahead-ondemand-source',
7 => 'javelin-dom',
8 => 'javelin-stratcom',
9 => 'javelin-util',
),
'bd4c8dca' => array(
0 => 'javelin-install',
1 => 'javelin-util',
@ -1652,18 +1664,6 @@ return array(
2 => 'javelin-util',
3 => 'phabricator-shaped-request',
),
'c11bac49' => array(
0 => 'javelin-install',
1 => 'javelin-util',
2 => 'javelin-dom',
3 => 'javelin-typeahead',
4 => 'javelin-tokenizer',
5 => 'javelin-typeahead-preloaded-source',
6 => 'javelin-typeahead-ondemand-source',
7 => 'javelin-dom',
8 => 'javelin-stratcom',
9 => 'javelin-util',
),
'c4569c05' => array(
0 => 'javelin-magical-init',
1 => 'javelin-install',

View file

@ -4610,6 +4610,7 @@ phutil_register_library_map(array(
'PhabricatorMetaMTAMailingList' => array(
0 => 'PhabricatorMetaMTADAO',
1 => 'PhabricatorPolicyInterface',
2 => 'PhabricatorDestructableInterface',
),
'PhabricatorMetaMTAMemberQuery' => 'PhabricatorQuery',
'PhabricatorMetaMTAPermanentFailureException' => 'Exception',

View file

@ -155,19 +155,20 @@ JX.install('Prefab', {
var tokenizer = new JX.Tokenizer(root);
tokenizer.setTypeahead(typeahead);
tokenizer.setRenderTokenCallback(function(value, key) {
var icon = datasource.getResult(key);
if (icon) {
icon = icon.icon;
var result = datasource.getResult(key);
var icon;
if (result) {
icon = result.icon;
value = result.displayName;
} else {
icon = config.icons[key];
}
if (!icon) {
return value;
if (icon) {
icon = JX.Prefab._renderIcon(icon);
}
icon = JX.Prefab._renderIcon(icon);
// TODO: Maybe we should render these closed tags in grey? Figure out
// how we're going to use color.