Add a "byline" element to ObjectItemListView

Summary: At least for non-workboard views, try plain text for author information instead of profile images. Some discussion in D5451.

Test Plan:
{F39411}
{F39412}
{F39413}
{F39414}
{F39415}
{F39416}

Reviewers: chad

Reviewed By: chad

CC: AnhNhan, aran

Differential Revision: https://secure.phabricator.com/D5605
This commit is contained in:
epriestley
2013-04-06 11:38:43 -07:00
parent c668988a26
commit 6587c1d5a5
6 changed files with 112 additions and 62 deletions

View File

@@ -12,6 +12,7 @@ final class PhabricatorObjectItemView extends AphrontTagView {
private $effect;
private $footIcons = array();
private $handleIcons = array();
private $bylines = array();
private $grippable;
public function setObjectName($name) {
@@ -64,6 +65,11 @@ final class PhabricatorObjectItemView extends AphrontTagView {
return $this->header;
}
public function addByline($byline) {
$this->bylines[] = $byline;
return $this;
}
public function addIcon($icon, $label = null, $href = null) {
$this->icons[] = array(
'icon' => $icon,
@@ -133,6 +139,10 @@ final class PhabricatorObjectItemView extends AphrontTagView {
$item_classes[] = 'phabricator-object-item-with-foot-icons';
}
if ($this->bylines) {
$item_classes[] = 'phabricator-object-item-with-bylines';
}
switch ($this->effect) {
case 'highlighted':
$item_classes[] = 'phabricator-object-item-highlighted';
@@ -256,6 +266,24 @@ final class PhabricatorObjectItemView extends AphrontTagView {
$handle_bar);
}
$bylines = array();
if ($this->bylines) {
foreach ($this->bylines as $byline) {
$bylines[] = phutil_tag(
'div',
array(
'class' => 'phabricator-object-item-byline',
),
$byline);
}
$bylines = phutil_tag(
'div',
array(
'class' => 'phabricator-object-item-bylines',
),
$bylines);
}
if ($icons) {
$icons = phutil_tag(
'div',
@@ -325,7 +353,6 @@ final class PhabricatorObjectItemView extends AphrontTagView {
'class' => implode(' ', $content_classes),
),
array(
$header,
$attrs,
$this->renderChildren(),
$foot,
@@ -338,7 +365,9 @@ final class PhabricatorObjectItemView extends AphrontTagView {
),
array(
$grippable,
$header,
$icons,
$bylines,
$content,
));
}