1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-23 15:22:41 +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 $stories;
private $framed; private $framed;
private $hovercards = false;
public function __construct(array $stories) { public function __construct(array $stories) {
assert_instances_of($stories, 'PhabricatorFeedStory'); assert_instances_of($stories, 'PhabricatorFeedStory');
@ -20,6 +21,11 @@ final class PhabricatorFeedBuilder {
return $this; return $this;
} }
public function setShowHovercards($hover) {
$this->hovercards = $hover;
return $this;
}
public function buildView() { public function buildView() {
if (!$this->user) { if (!$this->user) {
throw new Exception('Call setUser() before buildView()!'); throw new Exception('Call setUser() before buildView()!');
@ -35,6 +41,7 @@ final class PhabricatorFeedBuilder {
$last_date = null; $last_date = null;
foreach ($stories as $story) { foreach ($stories as $story) {
$story->setFramed($this->framed); $story->setFramed($this->framed);
$story->setHovercard($this->hovercards);
$date = ucfirst(phabricator_relative_date($story->getEpoch(), $user)); $date = ucfirst(phabricator_relative_date($story->getEpoch(), $user));

View file

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

View file

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

View file

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

View file

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