From 576804f67f53ac60fde87d9a9743aa7d8c5eb085 Mon Sep 17 00:00:00 2001 From: Anh Nhan Nguyen Date: Fri, 5 Apr 2013 08:11:16 -0700 Subject: [PATCH] Changing default fallback behaviour of hovercard view Summary: Refs T1048; Depends on D5571 - Use names instead of `substr($handle->getType(), 0, 1).$handle->getAlternateID()`, which did not work for 70% of the handles This, of course, breaks UI Examples, which was pretty off before anyway. Unbreak UIExamples. Test Plan: UIExamples, Hovercard Controller in human test mode Reviewers: epriestley, btrahan Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1048 Differential Revision: https://secure.phabricator.com/D5572 --- .../examples/PhabricatorHovercardExample.php | 10 ++++++---- .../hovercard/PhabricatorHovercardView.php | 19 +------------------ 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/src/applications/uiexample/examples/PhabricatorHovercardExample.php b/src/applications/uiexample/examples/PhabricatorHovercardExample.php index 6ceb8083f7..7963bd29c5 100644 --- a/src/applications/uiexample/examples/PhabricatorHovercardExample.php +++ b/src/applications/uiexample/examples/PhabricatorHovercardExample.php @@ -18,8 +18,9 @@ final class PhabricatorHovercardExample extends PhabricatorUIExample { $elements = array(); $diff_handle = $this->createBasicDummyHandle( - "Introduce cooler Differential Revisions", - PhabricatorPHIDConstants::PHID_TYPE_DREV); + "D123", + PhabricatorPHIDConstants::PHID_TYPE_DREV, + "Introduce cooler Differential Revisions"); $panel = $this->createPanel("Differential Hovercard"); $panel->appendChild(id(new PhabricatorHovercardView()) @@ -31,8 +32,9 @@ final class PhabricatorHovercardExample extends PhabricatorUIExample { $elements[] = $panel; $task_handle = $this->createBasicDummyHandle( - "Improve Mobile Experience for Phabricator", - PhabricatorPHIDConstants::PHID_TYPE_TASK); + "T123", + PhabricatorPHIDConstants::PHID_TYPE_TASK, + "Improve Mobile Experience for Phabricator"); $tag = id(new PhabricatorTagView()) ->setType(PhabricatorTagView::TYPE_STATE) diff --git a/src/view/widget/hovercard/PhabricatorHovercardView.php b/src/view/widget/hovercard/PhabricatorHovercardView.php index aaa9988b4d..dbb9ef69c3 100644 --- a/src/view/widget/hovercard/PhabricatorHovercardView.php +++ b/src/view/widget/hovercard/PhabricatorHovercardView.php @@ -11,26 +11,14 @@ final class PhabricatorHovercardView extends AphrontView { */ private $handle; - private $id; - private $title = array(); private $detail; private $tags = array(); private $fields = array(); private $actions = array(); - /** - * For overriding in case of Countdown, Paste, Pholio - */ - private $body; - private $color = 'grey'; - public function setId($id) { - $this->id = $id; - return $this; - } - public function setObjectHandle(PhabricatorObjectHandle $handle) { $this->handle = $handle; return $this; @@ -79,10 +67,6 @@ final class PhabricatorHovercardView extends AphrontView { } $handle = $this->handle; - $user = $this->getUser(); - - $id = $handle->getAlternateID(); - $type = $handle->getType(); require_celerity_resource("phabricator-hovercard-view-css"); @@ -99,7 +83,7 @@ final class PhabricatorHovercardView extends AphrontView { $title[] = pht("%s: %s", $handle->getTypeName(), - $this->title ? $this->title : substr($type, 0, 1) . $id); + $this->title ? $this->title : $handle->getName()); $body = array(); if ($this->detail) { @@ -177,7 +161,6 @@ final class PhabricatorHovercardView extends AphrontView { return phutil_tag('div', array( 'class' => 'phabricator-hovercard-wrapper', - 'id' => $this->id, ), $hovercard); }