mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-20 13:52:40 +01:00
Forgot some things in hover card view
Summary: Refs T1048 - Add IDs to hovercard view - Fixed title - Added fatal for no handle Test Plan: Used in future diff. Verified fatal for no handle. Correct display of title and id Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1048 Differential Revision: https://secure.phabricator.com/D5543
This commit is contained in:
parent
3ed75109e6
commit
8270b0e92d
1 changed files with 16 additions and 1 deletions
|
@ -11,6 +11,8 @@ final class PhabricatorHovercardView extends AphrontView {
|
|||
*/
|
||||
private $handle;
|
||||
|
||||
private $id;
|
||||
|
||||
private $title = array();
|
||||
private $detail;
|
||||
private $tags = array();
|
||||
|
@ -24,6 +26,11 @@ final class PhabricatorHovercardView extends AphrontView {
|
|||
|
||||
private $color = 'grey';
|
||||
|
||||
public function setId($id) {
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setObjectHandle(PhabricatorObjectHandle $handle) {
|
||||
$this->handle = $handle;
|
||||
return $this;
|
||||
|
@ -67,6 +74,10 @@ final class PhabricatorHovercardView extends AphrontView {
|
|||
}
|
||||
|
||||
public function render() {
|
||||
if (!$this->handle) {
|
||||
throw new Exception("Call setObjectHandle() before calling render()!");
|
||||
}
|
||||
|
||||
$handle = $this->handle;
|
||||
$user = $this->getUser();
|
||||
|
||||
|
@ -85,7 +96,10 @@ final class PhabricatorHovercardView extends AphrontView {
|
|||
),
|
||||
array_interleave(' ', $this->tags));
|
||||
}
|
||||
$title[] = pht("%s: %s", $handle->getTypeName(), substr($type, 0, 1) . $id);
|
||||
|
||||
$title[] = pht("%s: %s",
|
||||
$handle->getTypeName(),
|
||||
$this->title ? $this->title : substr($type, 0, 1) . $id);
|
||||
|
||||
$body = array();
|
||||
if ($this->detail) {
|
||||
|
@ -163,6 +177,7 @@ final class PhabricatorHovercardView extends AphrontView {
|
|||
return phutil_tag('div',
|
||||
array(
|
||||
'class' => 'phabricator-hovercard-wrapper',
|
||||
'id' => $this->id,
|
||||
),
|
||||
$hovercard);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue