1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 22:10:55 +01:00

Add hovercard on/off option to PhabricatorFeedStory

Summary: Defaults hovercards off everywhere feed stories are shown. I tried to find where to put this in so /feed/ could display them, but got horribly lost and confused in SearchQueryLandView

Test Plan: turn hovercards on and off, inspect elements.

Reviewers: epriestley, btrahan

Reviewed By: epriestley

CC: Korvin, aran

Differential Revision: https://secure.phabricator.com/D6757
This commit is contained in:
Chad Little 2013-08-14 13:20:25 -07:00
parent e3f3017b20
commit d02eb46ad6
5 changed files with 18 additions and 2 deletions

View file

@ -4,6 +4,7 @@ final class PhabricatorFeedBuilder {
private $stories;
private $framed;
private $hovercards = false;
public function __construct(array $stories) {
assert_instances_of($stories, 'PhabricatorFeedStory');
@ -20,6 +21,11 @@ final class PhabricatorFeedBuilder {
return $this;
}
public function setShowHovercards($hover) {
$this->hovercards = $hover;
return $this;
}
public function buildView() {
if (!$this->user) {
throw new Exception('Call setUser() before buildView()!');
@ -35,6 +41,7 @@ final class PhabricatorFeedBuilder {
$last_date = null;
foreach ($stories as $story) {
$story->setFramed($this->framed);
$story->setHovercard($this->hovercards);
$date = ucfirst(phabricator_relative_date($story->getEpoch(), $user));

View file

@ -28,6 +28,7 @@ final class PhabricatorFeedListController extends PhabricatorFeedController
PhabricatorSavedQuery $query) {
$builder = new PhabricatorFeedBuilder($feed);
$builder->setShowHovercards(true);
$builder->setUser($this->getRequest()->getUser());
$view = $builder->buildView();

View file

@ -13,6 +13,7 @@ abstract class PhabricatorFeedStory implements PhabricatorPolicyInterface {
private $data;
private $hasViewed;
private $framed;
private $hovercard = false;
private $handles = array();
private $objects = array();
@ -116,6 +117,11 @@ abstract class PhabricatorFeedStory implements PhabricatorPolicyInterface {
return $stories;
}
public function setHovercard($hover) {
$this->hovercard = $hover;
return $this;
}
public function setObjects(array $objects) {
$this->objects = $objects;
return $this;
@ -242,8 +248,8 @@ abstract class PhabricatorFeedStory implements PhabricatorPolicyInterface {
array(
'href' => $handle->getURI(),
'target' => $this->framed ? '_top' : null,
'sigil' => 'hovercard',
'meta' => array('hoverPHID' => $phid),
'sigil' => $this->hovercard ? 'hovercard' : null,
'meta' => $this->hovercard ? array('hoverPHID' => $phid) : null,
'class' => $class,
),
$handle->getLinkName());

View file

@ -119,6 +119,7 @@ final class PhabricatorPeopleProfileController
$builder = new PhabricatorFeedBuilder($stories);
$builder->setUser($viewer);
$builder->setShowHovercards(true);
$view = $builder->buildView();
return hsprintf(

View file

@ -137,6 +137,7 @@ final class PhabricatorProjectProfileController
$builder = new PhabricatorFeedBuilder($stories);
$builder->setUser($this->getRequest()->getUser());
$builder->setShowHovercards(true);
$view = $builder->buildView();
return hsprintf(