mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 16:52:41 +01:00
Fancier tooltips for revision lists
Summary: Put flag note in a Javelin tooltip on the flag, and extra reviewers in a Javelin tooltip on the (+N). This is a bit more expensive because we have to fetch all of their usernames but I'm hoping that's okay? Test Plan: Load a bunch of revision lists. Mouse on. Mouse off. Mouse on. Mouse off. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3187
This commit is contained in:
parent
f9fcaa1f84
commit
3fcb94a45c
2 changed files with 29 additions and 9 deletions
|
@ -145,7 +145,21 @@ final class DifferentialReviewersFieldSpecification
|
||||||
$other_reviewers = array_flip($revision->getReviewers());
|
$other_reviewers = array_flip($revision->getReviewers());
|
||||||
unset($other_reviewers[$primary_reviewer]);
|
unset($other_reviewers[$primary_reviewer]);
|
||||||
if ($other_reviewers) {
|
if ($other_reviewers) {
|
||||||
$suffix = ' (+'.(count($other_reviewers)).')';
|
$names = array();
|
||||||
|
foreach ($other_reviewers as $reviewer => $_) {
|
||||||
|
$names[] = phutil_escape_html(
|
||||||
|
$this->getHandle($reviewer)->getLinkName());
|
||||||
|
}
|
||||||
|
$suffix = ' '.javelin_render_tag(
|
||||||
|
'abbr',
|
||||||
|
array(
|
||||||
|
'sigil' => 'has-tooltip',
|
||||||
|
'meta' => array(
|
||||||
|
'tip' => implode(', ', $names),
|
||||||
|
'align' => 'E',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'(+'.(count($names)).')');
|
||||||
} else {
|
} else {
|
||||||
$suffix = null;
|
$suffix = null;
|
||||||
}
|
}
|
||||||
|
@ -157,11 +171,7 @@ final class DifferentialReviewersFieldSpecification
|
||||||
|
|
||||||
public function getRequiredHandlePHIDsForRevisionList(
|
public function getRequiredHandlePHIDsForRevisionList(
|
||||||
DifferentialRevision $revision) {
|
DifferentialRevision $revision) {
|
||||||
$primary_reviewer = $revision->getPrimaryReviewer();
|
return $revision->getReviewers();
|
||||||
if ($primary_reviewer) {
|
|
||||||
return array($primary_reviewer);
|
|
||||||
}
|
|
||||||
return array();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderValueForMail($phase) {
|
public function renderValueForMail($phase) {
|
||||||
|
|
|
@ -67,6 +67,9 @@ final class DifferentialRevisionListView extends AphrontView {
|
||||||
throw new Exception("Call setUser() before render()!");
|
throw new Exception("Call setUser() before render()!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Javelin::initBehavior('phabricator-tooltips', array());
|
||||||
|
require_celerity_resource('aphront-tooltip-css');
|
||||||
|
|
||||||
$flags = id(new PhabricatorFlagQuery())
|
$flags = id(new PhabricatorFlagQuery())
|
||||||
->withOwnerPHIDs(array($user->getPHID()))
|
->withOwnerPHIDs(array($user->getPHID()))
|
||||||
->withObjectPHIDs(mpull($this->revisions, 'getPHID'))
|
->withObjectPHIDs(mpull($this->revisions, 'getPHID'))
|
||||||
|
@ -85,11 +88,18 @@ final class DifferentialRevisionListView extends AphrontView {
|
||||||
if (isset($flagged[$phid])) {
|
if (isset($flagged[$phid])) {
|
||||||
$class = PhabricatorFlagColor::getCSSClass($flagged[$phid]->getColor());
|
$class = PhabricatorFlagColor::getCSSClass($flagged[$phid]->getColor());
|
||||||
$note = $flagged[$phid]->getNote();
|
$note = $flagged[$phid]->getNote();
|
||||||
$flag = phutil_render_tag(
|
$flag = javelin_render_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
$note ? array(
|
||||||
|
'class' => 'phabricator-flag-icon '.$class,
|
||||||
|
'sigil' => 'has-tooltip',
|
||||||
|
'meta' => array(
|
||||||
|
'tip' => $note,
|
||||||
|
'align' => 'N',
|
||||||
|
'size' => 240,
|
||||||
|
),
|
||||||
|
) : array(
|
||||||
'class' => 'phabricator-flag-icon '.$class,
|
'class' => 'phabricator-flag-icon '.$class,
|
||||||
'title' => $note,
|
|
||||||
),
|
),
|
||||||
'');
|
'');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue