mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-14 16:51:08 +01:00
Use PHUIFeedStory in Phame
Summary: This swaps out ObjectItemListView for PHUIFeedStory when viewing posts in a Phame blog. Test Plan: Write blog posts, published or not, and test in Phame. Web and iOS tested. Reviewers: epriestley, btrahan Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D5989
This commit is contained in:
parent
470999caf6
commit
fab9a138f3
6 changed files with 54 additions and 26 deletions
|
@ -818,7 +818,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'aphront-multi-column-view-css' =>
|
||||
array(
|
||||
'uri' => '/res/972551b3/rsrc/css/aphront/multi-column.css',
|
||||
'uri' => '/res/e01f5f0e/rsrc/css/aphront/multi-column.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -3592,7 +3592,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'phame-css' =>
|
||||
array(
|
||||
'uri' => '/res/8e3edb71/rsrc/css/application/phame/phame.css',
|
||||
'uri' => '/res/ba5a8cd8/rsrc/css/application/phame/phame.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -3669,7 +3669,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'phui-feed-story-css' =>
|
||||
array(
|
||||
'uri' => '/res/2fb3c729/rsrc/css/phui/phui-feed-story.css',
|
||||
'uri' => '/res/4dbcec0e/rsrc/css/phui/phui-feed-story.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
|
|
|
@ -36,44 +36,57 @@ abstract class PhameController extends PhabricatorController {
|
|||
$nodata) {
|
||||
assert_instances_of($posts, 'PhamePost');
|
||||
|
||||
$list = id(new PhabricatorObjectItemListView())
|
||||
->setUser($user)
|
||||
->setNoDataString($nodata);
|
||||
$stories = array();
|
||||
|
||||
foreach ($posts as $post) {
|
||||
$blogger = $this->getHandle($post->getBloggerPHID())->renderLink();
|
||||
$bloggerURI = $this->getHandle($post->getBloggerPHID())->getURI();
|
||||
$bloggerImage = $this->getHandle($post->getBloggerPHID())->getImageURI();
|
||||
|
||||
$blog = null;
|
||||
if ($post->getBlog()) {
|
||||
$blog = $this->getHandle($post->getBlog()->getPHID())->renderLink();
|
||||
}
|
||||
|
||||
$published = null;
|
||||
if ($post->getDatePublished()) {
|
||||
$published = phabricator_date($post->getDatePublished(), $user);
|
||||
$phame_post = '';
|
||||
if ($post->getBody()) {
|
||||
$phame_post = PhabricatorMarkupEngine::summarize($post->getBody());
|
||||
}
|
||||
|
||||
$draft = $post->isDraft();
|
||||
$blog_view = $post->getViewURI();
|
||||
$phame_title = phutil_tag('a', array('href' => $blog_view),
|
||||
$post->getTitle());
|
||||
|
||||
$blogger = phutil_tag('strong', array(), $blogger);
|
||||
if ($post->isDraft()) {
|
||||
$title = pht('%s drafted a blog post on %s.',
|
||||
$blogger, $blog);
|
||||
$title = phutil_tag('em', array(), $title);
|
||||
} else {
|
||||
$title = pht('%s wrote a blog post on %s.',
|
||||
$blogger, $blog);
|
||||
}
|
||||
|
||||
$item = id(new PhabricatorObjectItemView())
|
||||
->setObject($post)
|
||||
->setHeader($post->getTitle())
|
||||
->setHref($this->getApplicationURI('post/view/'.$post->getID().'/'));
|
||||
|
||||
if ($blog) {
|
||||
$item->addAttribute($blog);
|
||||
}
|
||||
$story = id(new PHUIFeedStoryView())
|
||||
->setTitle($title)
|
||||
->setImage($bloggerImage)
|
||||
->setImageHref($bloggerURI)
|
||||
->setAppIcon('phame-dark')
|
||||
->setUser($user)
|
||||
->setPontification($phame_post, $phame_title);
|
||||
|
||||
if ($draft) {
|
||||
$desc = pht('Draft by %s', $blogger);
|
||||
} else {
|
||||
$desc = pht('Published on %s by %s', $published, $blogger);
|
||||
if ($post->getDatePublished()) {
|
||||
$story->setEpoch($post->getDatePublished());
|
||||
}
|
||||
$item->addAttribute($desc);
|
||||
$list->addItem($item);
|
||||
$stories[] = $story;
|
||||
}
|
||||
|
||||
return $list;
|
||||
return $stories;
|
||||
}
|
||||
|
||||
public function buildApplicationMenu() {
|
||||
|
|
|
@ -48,6 +48,13 @@ final class PhameBlogViewController extends PhameController {
|
|||
$user,
|
||||
pht('This blog has no visible posts.'));
|
||||
|
||||
require_celerity_resource('phame-css');
|
||||
$post_list = id(new PHUIBoxView())
|
||||
->addPadding(PHUI::PADDING_LARGE)
|
||||
->addClass('phame-post-list')
|
||||
->appendChild($post_list);
|
||||
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->addCrumb(
|
||||
id(new PhabricatorCrumbView())
|
||||
|
|
|
@ -70,7 +70,12 @@ final class PhamePostListController extends PhameController {
|
|||
mpull($posts, 'getBlogPHID'));
|
||||
$this->loadHandles($handle_phids);
|
||||
|
||||
require_celerity_resource('phame-css');
|
||||
$post_list = $this->renderPostList($posts, $user, $nodata);
|
||||
$post_list = id(new PHUIBoxView())
|
||||
->addPadding(PHUI::PADDING_LARGE)
|
||||
->addClass('phame-post-list')
|
||||
->appendChild($post_list);
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->addCrumb(
|
||||
|
|
|
@ -21,6 +21,10 @@
|
|||
margin: 0px 0px 16px 0px;
|
||||
}
|
||||
|
||||
.device-desktop .phame-post-list {
|
||||
max-width: 600px;
|
||||
}
|
||||
|
||||
.blog-post-list {
|
||||
clear: left;
|
||||
float: left;
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
font-size: 11px;
|
||||
background: #f7f7f7;
|
||||
padding: 10px;
|
||||
line-height: 14px;
|
||||
}
|
||||
|
||||
.phui-feed-story-foot .phui-icon-view {
|
||||
|
@ -41,18 +42,16 @@
|
|||
}
|
||||
|
||||
.phui-feed-story-bigtext-post {
|
||||
font-size: 15px;
|
||||
font-weight: 200;
|
||||
line-height: 18px;
|
||||
color: #444;
|
||||
}
|
||||
|
||||
.phui-feed-story-bigtext-post h3 {
|
||||
font-size: 24px;
|
||||
font-weight: 100;
|
||||
font-size: 18px;
|
||||
font-weight: 200;
|
||||
line-height: 18px;
|
||||
color: #444;
|
||||
margin: 10px 0;
|
||||
color: #39444f;
|
||||
margin: 0 0 5px 0;
|
||||
}
|
||||
|
||||
.phui-feed-token-bar {
|
||||
|
|
Loading…
Reference in a new issue