Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15456695
D16153.id38861.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D16153.id38861.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -28,7 +28,7 @@
'rsrc/css/aphront/table-view.css' => '9258e19f',
'rsrc/css/aphront/tokenizer.css' => '056da01b',
'rsrc/css/aphront/tooltip.css' => '1a07aea8',
- 'rsrc/css/aphront/typeahead-browse.css' => 'd8581d2c',
+ 'rsrc/css/aphront/typeahead-browse.css' => '845273d9',
'rsrc/css/aphront/typeahead.css' => 'd4f16145',
'rsrc/css/application/almanac/almanac.css' => 'dbb9b3af',
'rsrc/css/application/auth/auth.css' => '0877ed6e',
@@ -889,7 +889,7 @@
'syntax-default-css' => '9923583c',
'syntax-highlighting-css' => '9fc496d5',
'tokens-css' => '3d0f239e',
- 'typeahead-browse-css' => 'd8581d2c',
+ 'typeahead-browse-css' => '845273d9',
'unhandled-exception-css' => '4c96257a',
),
'requires' => array(
diff --git a/src/applications/people/typeahead/PhabricatorPeopleDatasource.php b/src/applications/people/typeahead/PhabricatorPeopleDatasource.php
--- a/src/applications/people/typeahead/PhabricatorPeopleDatasource.php
+++ b/src/applications/people/typeahead/PhabricatorPeopleDatasource.php
@@ -32,6 +32,7 @@
$tokens = $this->getTokens();
$query = id(new PhabricatorPeopleQuery())
+ ->needProfile(true)
->setOrderVector(array('username'));
if ($tokens) {
@@ -83,6 +84,21 @@
$result->setImageURI($handles[$user->getPHID()]->getImageURI());
}
+ if ($user->getIsAdmin()) {
+ $result->addAttribute(
+ array(
+ id(new PHUIIconView())->setIcon('fa-star'),
+ ' ',
+ pht('Administrator'),
+ ));
+ }
+
+ $profile = $user->getUserProfile();
+ $user_title = $profile->getTitle();
+ if (strlen($user_title)) {
+ $result->addAttribute($user_title);
+ }
+
$results[] = $result;
}
diff --git a/src/applications/project/typeahead/PhabricatorProjectDatasource.php b/src/applications/project/typeahead/PhabricatorProjectDatasource.php
--- a/src/applications/project/typeahead/PhabricatorProjectDatasource.php
+++ b/src/applications/project/typeahead/PhabricatorProjectDatasource.php
@@ -55,9 +55,24 @@
$has_cols = array_fill_keys(array_keys($projs), true);
}
+ if ($projs) {
+ // TODO: This is a little ad-hoc, but we don't currently have
+ // infrastructure for bulk querying custom fields efficiently.
+ $table = new PhabricatorProjectCustomFieldStorage();
+ $descriptions = $table->loadAllWhere(
+ 'objectPHID IN (%Ls) AND fieldIndex = %s',
+ array_keys($projs),
+ PhabricatorHash::digestForIndex('std:project:internal:description'));
+ $descriptions = mpull($descriptions, 'getFieldValue', 'getObjectPHID');
+ } else {
+ $descriptions = array();
+ }
+
$results = array();
foreach ($projs as $proj) {
- if (!isset($has_cols[$proj->getPHID()])) {
+ $phid = $proj->getPHID();
+
+ if (!isset($has_cols[$phid])) {
continue;
}
@@ -99,7 +114,7 @@
->setDisplayName($proj->getDisplayName())
->setDisplayType($proj->getDisplayIconName())
->setURI($proj->getURI())
- ->setPHID($proj->getPHID())
+ ->setPHID($phid)
->setIcon($proj->getDisplayIconIcon())
->setColor($proj->getColor())
->setPriorityType('proj')
@@ -111,6 +126,13 @@
$proj_result->setImageURI($proj->getProfileImageURI());
+
+ $description = idx($descriptions, $phid);
+ if (strlen($description)) {
+ $description = PhabricatorMarkupEngine::summarize($description);
+ $proj_result->addAttribute($description);
+ }
+
$results[] = $proj_result;
}
diff --git a/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php b/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php
--- a/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php
+++ b/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php
@@ -161,6 +161,18 @@
),
pht('Select'));
+ $attributes = $result->getAttributes();
+ if ($attributes) {
+ $subtitle = phutil_tag(
+ 'div',
+ array(
+ 'class' => 'typeahead-browse-info',
+ ),
+ phutil_implode_html(" \xC2\xB7 ", $attributes));
+ } else {
+ $subtitle = null;
+ }
+
$items[] = phutil_tag(
'div',
array(
@@ -169,6 +181,7 @@
array(
$token,
$button,
+ $subtitle,
));
}
diff --git a/src/applications/typeahead/storage/PhabricatorTypeaheadResult.php b/src/applications/typeahead/storage/PhabricatorTypeaheadResult.php
--- a/src/applications/typeahead/storage/PhabricatorTypeaheadResult.php
+++ b/src/applications/typeahead/storage/PhabricatorTypeaheadResult.php
@@ -17,6 +17,7 @@
private $tokenType;
private $unique;
private $autocomplete;
+ private $attributes;
public function setIcon($icon) {
$this->icon = $icon;
@@ -188,4 +189,13 @@
return null;
}
+ public function getAttributes() {
+ return $this->attributes;
+ }
+
+ public function addAttribute($attribute) {
+ $this->attributes[] = $attribute;
+ return $this;
+ }
+
}
diff --git a/webroot/rsrc/css/aphront/typeahead-browse.css b/webroot/rsrc/css/aphront/typeahead-browse.css
--- a/webroot/rsrc/css/aphront/typeahead-browse.css
+++ b/webroot/rsrc/css/aphront/typeahead-browse.css
@@ -64,3 +64,12 @@
margin-top: 1px;
margin-left: 6px;
}
+
+.typeahead-browse-info {
+ clear: both;
+ color: {$greytext};
+ padding-top: 4px;
+ margin: 0 8px 2px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 31, 11:28 AM (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7458894
Default Alt Text
D16153.id38861.diff (5 KB)
Attached To
Mode
D16153: Add more context to tokenizer browse results for people and projects
Attached
Detach File
Event Timeline
Log In to Comment