Add one-line feed story.
Summary: It turns out not everything is interesting. This adds a oneline story with less vertical space. Test Plan: UIExamples Reviewers: epriestley, btrahan Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D6640
This commit is contained in:
parent
fd2593e8ab
commit
78f73e7d45
|
@ -3830,7 +3830,7 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'phui-feed-story-css' =>
|
'phui-feed-story-css' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/6afac7dd/rsrc/css/phui/phui-feed-story.css',
|
'uri' => '/res/e5d6825b/rsrc/css/phui/phui-feed-story.css',
|
||||||
'type' => 'css',
|
'type' => 'css',
|
||||||
'requires' =>
|
'requires' =>
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -15,8 +15,9 @@ final class PHUIFeedStoryExample extends PhabricatorUIExample {
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$user = $request->getUser();
|
$user = $request->getUser();
|
||||||
|
|
||||||
/* Basic "One Line" Story */
|
/* Basic Story */
|
||||||
$text = hsprintf('<strong><a>harding (Tom Harding)</a></strong> closed <a>'.
|
$text = hsprintf(
|
||||||
|
'<strong><a>harding (Tom Harding)</a></strong> closed <a>'.
|
||||||
'D12: New spacer classes for blog views</a>.');
|
'D12: New spacer classes for blog views</a>.');
|
||||||
$story1 = id(new PHUIFeedStoryView())
|
$story1 = id(new PHUIFeedStoryView())
|
||||||
->setTitle($text)
|
->setTitle($text)
|
||||||
|
@ -118,11 +119,22 @@ final class PHUIFeedStoryExample extends PhabricatorUIExample {
|
||||||
->setPontification('If we ever create a lightweight status app '.
|
->setPontification('If we ever create a lightweight status app '.
|
||||||
'this story would be how that would be displayed.');
|
'this story would be how that would be displayed.');
|
||||||
|
|
||||||
|
/* Basic "One Line" Story */
|
||||||
|
$text = hsprintf(
|
||||||
|
'<strong><a>harding (Tom Harding)</a></strong> updated <a>'.
|
||||||
|
'D12: New spacer classes for blog views</a>.');
|
||||||
|
$story6 = id(new PHUIFeedStoryView())
|
||||||
|
->setTitle($text)
|
||||||
|
->setImage(celerity_get_resource_uri('/rsrc/image/people/harding.png'))
|
||||||
|
->setImageHref('http://en.wikipedia.org/wiki/Warren_G._Harding')
|
||||||
|
->setEpoch(1)
|
||||||
|
->setOneLine(true)
|
||||||
|
->setAppIcon('differential-dark')
|
||||||
|
->setUser($user);
|
||||||
|
|
||||||
|
|
||||||
$head1 = id(new PhabricatorHeaderView())
|
$head1 = id(new PhabricatorHeaderView())
|
||||||
->setHeader(pht('Basic "one-line" Story'));
|
->setHeader(pht('Basic Story'));
|
||||||
|
|
||||||
$head2 = id(new PhabricatorHeaderView())
|
$head2 = id(new PhabricatorHeaderView())
|
||||||
->setHeader(pht('Title / Text Story'));
|
->setHeader(pht('Title / Text Story'));
|
||||||
|
@ -136,6 +148,9 @@ final class PHUIFeedStoryExample extends PhabricatorUIExample {
|
||||||
$head5 = id(new PhabricatorHeaderView())
|
$head5 = id(new PhabricatorHeaderView())
|
||||||
->setHeader(pht('Status Story'));
|
->setHeader(pht('Status Story'));
|
||||||
|
|
||||||
|
$head6 = id(new PhabricatorHeaderView())
|
||||||
|
->setHeader(pht('One Line Story'));
|
||||||
|
|
||||||
$wrap1 =
|
$wrap1 =
|
||||||
array(
|
array(
|
||||||
id(new PHUIBoxView())
|
id(new PHUIBoxView())
|
||||||
|
@ -171,6 +186,13 @@ final class PHUIFeedStoryExample extends PhabricatorUIExample {
|
||||||
->addMargin(PHUI::MARGIN_MEDIUM)
|
->addMargin(PHUI::MARGIN_MEDIUM)
|
||||||
->addPadding(PHUI::PADDING_SMALL));
|
->addPadding(PHUI::PADDING_SMALL));
|
||||||
|
|
||||||
|
$wrap6 =
|
||||||
|
array(
|
||||||
|
id(new PHUIBoxView())
|
||||||
|
->appendChild($story6)
|
||||||
|
->addMargin(PHUI::MARGIN_MEDIUM)
|
||||||
|
->addPadding(PHUI::PADDING_SMALL));
|
||||||
|
|
||||||
return phutil_tag(
|
return phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
array(),
|
array(),
|
||||||
|
@ -184,7 +206,9 @@ final class PHUIFeedStoryExample extends PhabricatorUIExample {
|
||||||
$head4,
|
$head4,
|
||||||
$wrap4,
|
$wrap4,
|
||||||
$head5,
|
$head5,
|
||||||
$wrap5
|
$wrap5,
|
||||||
|
$head6,
|
||||||
|
$wrap6
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ final class PHUIFeedStoryView extends AphrontView {
|
||||||
private $epoch;
|
private $epoch;
|
||||||
private $viewed;
|
private $viewed;
|
||||||
private $href;
|
private $href;
|
||||||
|
private $oneline = false;
|
||||||
private $pontification = null;
|
private $pontification = null;
|
||||||
private $tokenBar = array();
|
private $tokenBar = array();
|
||||||
private $projects = array();
|
private $projects = array();
|
||||||
|
@ -35,6 +36,11 @@ final class PHUIFeedStoryView extends AphrontView {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setOneLine($oneline) {
|
||||||
|
$this->oneline = $oneline;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function setImage($image) {
|
public function setImage($image) {
|
||||||
$this->image = $image;
|
$this->image = $image;
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -80,6 +86,7 @@ final class PHUIFeedStoryView extends AphrontView {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setPontification($text, $title = null) {
|
public function setPontification($text, $title = null) {
|
||||||
|
$this->setOneLine(false);
|
||||||
if ($title) {
|
if ($title) {
|
||||||
$title = phutil_tag('h3', array(), $title);
|
$title = phutil_tag('h3', array(), $title);
|
||||||
}
|
}
|
||||||
|
@ -124,7 +131,11 @@ final class PHUIFeedStoryView extends AphrontView {
|
||||||
|
|
||||||
require_celerity_resource('phui-feed-story-css');
|
require_celerity_resource('phui-feed-story-css');
|
||||||
|
|
||||||
|
$body = null;
|
||||||
|
$foot = null;
|
||||||
|
$image_style = null;
|
||||||
$actor = '';
|
$actor = '';
|
||||||
|
|
||||||
if ($this->image) {
|
if ($this->image) {
|
||||||
$actor = new PHUIIconView();
|
$actor = new PHUIIconView();
|
||||||
$actor->setImage($this->image);
|
$actor->setImage($this->image);
|
||||||
|
@ -134,60 +145,6 @@ final class PHUIFeedStoryView extends AphrontView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$action_list = array();
|
|
||||||
$icons = null;
|
|
||||||
foreach ($this->actions as $action) {
|
|
||||||
$action_list[] = phutil_tag(
|
|
||||||
'li',
|
|
||||||
array(
|
|
||||||
'class' => 'phui-feed-story-action-item'
|
|
||||||
),
|
|
||||||
$action);
|
|
||||||
}
|
|
||||||
if (!empty($action_list)) {
|
|
||||||
$icons = phutil_tag(
|
|
||||||
'ul',
|
|
||||||
array(
|
|
||||||
'class' => 'phui-feed-story-action-list'
|
|
||||||
),
|
|
||||||
$action_list);
|
|
||||||
}
|
|
||||||
|
|
||||||
$head = phutil_tag(
|
|
||||||
'div',
|
|
||||||
array(
|
|
||||||
'class' => 'phui-feed-story-head',
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
$actor,
|
|
||||||
nonempty($this->title, pht('Untitled Story')),
|
|
||||||
$icons
|
|
||||||
));
|
|
||||||
|
|
||||||
$body = null;
|
|
||||||
$foot = null;
|
|
||||||
$image_style = null;
|
|
||||||
|
|
||||||
if (!empty($this->tokenBar)) {
|
|
||||||
$tokenview = phutil_tag(
|
|
||||||
'div',
|
|
||||||
array(
|
|
||||||
'class' => 'phui-feed-token-bar'
|
|
||||||
),
|
|
||||||
$this->tokenBar);
|
|
||||||
$this->appendChild($tokenview);
|
|
||||||
}
|
|
||||||
|
|
||||||
$body_content = $this->renderChildren();
|
|
||||||
if ($body_content) {
|
|
||||||
$body = phutil_tag(
|
|
||||||
'div',
|
|
||||||
array(
|
|
||||||
'class' => 'phui-feed-story-body',
|
|
||||||
),
|
|
||||||
$body_content);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->epoch) {
|
if ($this->epoch) {
|
||||||
// TODO: This is really bad; when rendering through Conduit and via
|
// TODO: This is really bad; when rendering through Conduit and via
|
||||||
// renderText() we don't have a user.
|
// renderText() we don't have a user.
|
||||||
|
@ -216,6 +173,72 @@ final class PHUIFeedStoryView extends AphrontView {
|
||||||
$icon->setSpriteSheet(PHUIIconView::SPRITE_APPS);
|
$icon->setSpriteSheet(PHUIIconView::SPRITE_APPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$ol_foot = null;
|
||||||
|
if ($this->oneline) {
|
||||||
|
$ol_foot = phutil_tag(
|
||||||
|
'div',
|
||||||
|
array(
|
||||||
|
'class' => 'phui-feed-story-oneline-foot'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
$icon,
|
||||||
|
$foot));
|
||||||
|
}
|
||||||
|
|
||||||
|
$action_list = array();
|
||||||
|
$icons = null;
|
||||||
|
foreach ($this->actions as $action) {
|
||||||
|
$action_list[] = phutil_tag(
|
||||||
|
'li',
|
||||||
|
array(
|
||||||
|
'class' => 'phui-feed-story-action-item'
|
||||||
|
),
|
||||||
|
$action);
|
||||||
|
}
|
||||||
|
if (!empty($action_list)) {
|
||||||
|
$icons = phutil_tag(
|
||||||
|
'ul',
|
||||||
|
array(
|
||||||
|
'class' => 'phui-feed-story-action-list'
|
||||||
|
),
|
||||||
|
$action_list);
|
||||||
|
}
|
||||||
|
|
||||||
|
$head = phutil_tag(
|
||||||
|
'div',
|
||||||
|
array(
|
||||||
|
'class' => 'phui-feed-story-head',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
$actor,
|
||||||
|
nonempty($this->title, pht('Untitled Story')),
|
||||||
|
$icons,
|
||||||
|
$ol_foot
|
||||||
|
));
|
||||||
|
|
||||||
|
if (!empty($this->tokenBar)) {
|
||||||
|
$tokenview = phutil_tag(
|
||||||
|
'div',
|
||||||
|
array(
|
||||||
|
'class' => 'phui-feed-token-bar'
|
||||||
|
),
|
||||||
|
$this->tokenBar);
|
||||||
|
$this->appendChild($tokenview);
|
||||||
|
}
|
||||||
|
|
||||||
|
$body_content = $this->renderChildren();
|
||||||
|
if ($body_content) {
|
||||||
|
$body = phutil_tag(
|
||||||
|
'div',
|
||||||
|
array(
|
||||||
|
'class' => 'phui-feed-story-body',
|
||||||
|
),
|
||||||
|
$body_content);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->oneline) {
|
||||||
|
$foot = null;
|
||||||
|
} else {
|
||||||
$foot = phutil_tag(
|
$foot = phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(
|
||||||
|
@ -224,9 +247,15 @@ final class PHUIFeedStoryView extends AphrontView {
|
||||||
array(
|
array(
|
||||||
$icon,
|
$icon,
|
||||||
$foot));
|
$foot));
|
||||||
|
}
|
||||||
|
|
||||||
|
$classes = array('phui-feed-story');
|
||||||
|
if ($this->oneline) {
|
||||||
|
$classes[] = 'phui-feed-story-oneline';
|
||||||
|
}
|
||||||
|
|
||||||
return id(new PHUIBoxView())
|
return id(new PHUIBoxView())
|
||||||
->addClass('phui-feed-story')
|
->addClass(implode(' ', $classes))
|
||||||
->setShadow(true)
|
->setShadow(true)
|
||||||
->addMargin(PHUI::MARGIN_MEDIUM_BOTTOM)
|
->addMargin(PHUI::MARGIN_MEDIUM_BOTTOM)
|
||||||
->appendChild(array($head, $body, $foot));
|
->appendChild(array($head, $body, $foot));
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
.phui-feed-story {
|
.phui-feed-story {
|
||||||
background: 5px 2px no-repeat;
|
background: 5px 2px no-repeat;
|
||||||
min-height: 50px;
|
min-height: 44px;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,17 +13,17 @@
|
||||||
height: 35px;
|
height: 35px;
|
||||||
background-size: 35px;
|
background-size: 35px;
|
||||||
float: left;
|
float: left;
|
||||||
margin-right: 10px;
|
margin-right: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.phui-feed-story-head {
|
.phui-feed-story-head {
|
||||||
padding: 10px;
|
padding: 8px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.phui-feed-story-body {
|
.phui-feed-story-body {
|
||||||
padding: 0 10px 10px;
|
padding: 0 8px 8px;
|
||||||
color: #444444;
|
color: #444444;
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
.phui-feed-story-foot {
|
.phui-feed-story-foot {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
background: #f7f7f7;
|
background: #f7f7f7;
|
||||||
padding: 10px;
|
padding: 8px;
|
||||||
line-height: 14px;
|
line-height: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,8 @@
|
||||||
color: #777;
|
color: #777;
|
||||||
}
|
}
|
||||||
|
|
||||||
.phui-feed-story-foot .phui-icon-view {
|
.phui-feed-story-foot .phui-icon-view,
|
||||||
|
.phui-feed-story-oneline-foot .phui-icon-view {
|
||||||
float: left;
|
float: left;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
|
@ -60,9 +61,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.phui-feed-token-bar {
|
.phui-feed-token-bar {
|
||||||
margin-top: 10px;
|
margin-top: 8px;
|
||||||
border-top: 1px solid #e7e7e7;
|
border-top: 1px solid #e7e7e7;
|
||||||
padding-top: 10px;
|
padding-top: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.phui-feed-token-bar .phui-icon-view {
|
.phui-feed-token-bar .phui-icon-view {
|
||||||
|
@ -83,3 +84,20 @@
|
||||||
.phui-feed-story-action-list .phui-icon-view {
|
.phui-feed-story-action-list .phui-icon-view {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.phui-feed-story-oneline .phui-feed-story-head {
|
||||||
|
padding: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phui-feed-story-oneline .phui-feed-story-body {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phui-feed-story-oneline-foot,
|
||||||
|
.phui-feed-story-oneline-foot a {
|
||||||
|
font-size: 11px;
|
||||||
|
color: #777;
|
||||||
|
margin-top: 2px;
|
||||||
|
line-height: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue