1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-11 15:21:03 +01:00

Make D3123 more consistent

Summary:
Put the function in the base class so all the Diffusion views
can use it. Also use shinier tooltips.

Test Plan: Browse Diffusion.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3206
This commit is contained in:
Alan Huang 2012-08-08 18:26:23 -07:00
parent 330b0a3d4b
commit eeb359bae6
4 changed files with 24 additions and 17 deletions

View file

@ -34,19 +34,6 @@ final class DiffusionBrowseTableView extends DiffusionView {
return $this;
}
private static function renderName($name) {
$email = new PhutilEmailAddress($name);
if ($email->getDisplayName() || $email->getDomainName()) {
return phutil_render_tag(
'span',
array(
'title' => $email->getAddress(),
),
phutil_escape_html($email->getDisplayName()));
}
return phutil_escape_html($name);
}
public function setUser(PhabricatorUser $user) {
$this->user = $user;
return $this;

View file

@ -108,7 +108,7 @@ final class DiffusionHistoryTableView extends DiffusionView {
if ($author_phid && isset($handles[$author_phid])) {
$author = $handles[$author_phid]->renderLink();
} else {
$author = phutil_escape_html($history->getAuthorName());
$author = self::renderName($history->getAuthorName());
}
$different_committer = false;
@ -121,7 +121,7 @@ final class DiffusionHistoryTableView extends DiffusionView {
if ($committer_phid && isset($handles[$committer_phid])) {
$committer = $handles[$committer_phid]->renderLink();
} else {
$committer = phutil_escape_html($committer);
$committer = self::renderName($committer);
}
$author .= '/'.$committer;
}

View file

@ -84,9 +84,9 @@ final class DiffusionTagListView extends DiffusionView {
if ($commit && $commit->getAuthorPHID()) {
$author = $this->handles[$commit->getAuthorPHID()]->renderLink();
} else if ($commit && $commit->getCommitData()) {
$author = phutil_escape_html($commit->getCommitData()->getAuthorName());
$author = self::renderName($commit->getCommitData()->getAuthorName());
} else {
$author = phutil_escape_html($tag->getAuthor());
$author = self::renderName($tag->getAuthor());
}
$description = null;

View file

@ -147,4 +147,24 @@ abstract class DiffusionView extends AphrontView {
"D{$id}");
}
final protected static function renderName($name) {
$email = new PhutilEmailAddress($name);
if ($email->getDisplayName() || $email->getDomainName()) {
Javelin::initBehavior('phabricator-tooltips', array());
require_celerity_resource('aphront-tooltip-css');
return javelin_render_tag(
'span',
array(
'sigil' => 'has-tooltip',
'meta' => array(
'tip' => $email->getAddress(),
'align' => 'E',
'size' => 'auto',
),
),
phutil_escape_html($email->getDisplayName()));
}
return phutil_escape_html($name);
}
}