1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-15 09:11:07 +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:
Chad Little 2013-05-21 15:32:17 -07:00
parent 470999caf6
commit fab9a138f3
6 changed files with 54 additions and 26 deletions

View file

@ -818,7 +818,7 @@ celerity_register_resource_map(array(
), ),
'aphront-multi-column-view-css' => 'aphront-multi-column-view-css' =>
array( array(
'uri' => '/res/972551b3/rsrc/css/aphront/multi-column.css', 'uri' => '/res/e01f5f0e/rsrc/css/aphront/multi-column.css',
'type' => 'css', 'type' => 'css',
'requires' => 'requires' =>
array( array(
@ -3592,7 +3592,7 @@ celerity_register_resource_map(array(
), ),
'phame-css' => 'phame-css' =>
array( array(
'uri' => '/res/8e3edb71/rsrc/css/application/phame/phame.css', 'uri' => '/res/ba5a8cd8/rsrc/css/application/phame/phame.css',
'type' => 'css', 'type' => 'css',
'requires' => 'requires' =>
array( array(
@ -3669,7 +3669,7 @@ celerity_register_resource_map(array(
), ),
'phui-feed-story-css' => 'phui-feed-story-css' =>
array( array(
'uri' => '/res/2fb3c729/rsrc/css/phui/phui-feed-story.css', 'uri' => '/res/4dbcec0e/rsrc/css/phui/phui-feed-story.css',
'type' => 'css', 'type' => 'css',
'requires' => 'requires' =>
array( array(

View file

@ -36,44 +36,57 @@ abstract class PhameController extends PhabricatorController {
$nodata) { $nodata) {
assert_instances_of($posts, 'PhamePost'); assert_instances_of($posts, 'PhamePost');
$list = id(new PhabricatorObjectItemListView()) $stories = array();
->setUser($user)
->setNoDataString($nodata);
foreach ($posts as $post) { foreach ($posts as $post) {
$blogger = $this->getHandle($post->getBloggerPHID())->renderLink(); $blogger = $this->getHandle($post->getBloggerPHID())->renderLink();
$bloggerURI = $this->getHandle($post->getBloggerPHID())->getURI();
$bloggerImage = $this->getHandle($post->getBloggerPHID())->getImageURI();
$blog = null; $blog = null;
if ($post->getBlog()) { if ($post->getBlog()) {
$blog = $this->getHandle($post->getBlog()->getPHID())->renderLink(); $blog = $this->getHandle($post->getBlog()->getPHID())->renderLink();
} }
$published = null; $phame_post = '';
if ($post->getDatePublished()) { if ($post->getBody()) {
$published = phabricator_date($post->getDatePublished(), $user); $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()) $item = id(new PhabricatorObjectItemView())
->setObject($post) ->setObject($post)
->setHeader($post->getTitle()) ->setHeader($post->getTitle())
->setHref($this->getApplicationURI('post/view/'.$post->getID().'/')); ->setHref($this->getApplicationURI('post/view/'.$post->getID().'/'));
if ($blog) { $story = id(new PHUIFeedStoryView())
$item->addAttribute($blog); ->setTitle($title)
->setImage($bloggerImage)
->setImageHref($bloggerURI)
->setAppIcon('phame-dark')
->setUser($user)
->setPontification($phame_post, $phame_title);
if ($post->getDatePublished()) {
$story->setEpoch($post->getDatePublished());
}
$stories[] = $story;
} }
if ($draft) { return $stories;
$desc = pht('Draft by %s', $blogger);
} else {
$desc = pht('Published on %s by %s', $published, $blogger);
}
$item->addAttribute($desc);
$list->addItem($item);
}
return $list;
} }
public function buildApplicationMenu() { public function buildApplicationMenu() {

View file

@ -48,6 +48,13 @@ final class PhameBlogViewController extends PhameController {
$user, $user,
pht('This blog has no visible posts.')); 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 = $this->buildApplicationCrumbs();
$crumbs->addCrumb( $crumbs->addCrumb(
id(new PhabricatorCrumbView()) id(new PhabricatorCrumbView())

View file

@ -70,7 +70,12 @@ final class PhamePostListController extends PhameController {
mpull($posts, 'getBlogPHID')); mpull($posts, 'getBlogPHID'));
$this->loadHandles($handle_phids); $this->loadHandles($handle_phids);
require_celerity_resource('phame-css');
$post_list = $this->renderPostList($posts, $user, $nodata); $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 = $this->buildApplicationCrumbs();
$crumbs->addCrumb( $crumbs->addCrumb(

View file

@ -21,6 +21,10 @@
margin: 0px 0px 16px 0px; margin: 0px 0px 16px 0px;
} }
.device-desktop .phame-post-list {
max-width: 600px;
}
.blog-post-list { .blog-post-list {
clear: left; clear: left;
float: left; float: left;

View file

@ -32,6 +32,7 @@
font-size: 11px; font-size: 11px;
background: #f7f7f7; background: #f7f7f7;
padding: 10px; padding: 10px;
line-height: 14px;
} }
.phui-feed-story-foot .phui-icon-view { .phui-feed-story-foot .phui-icon-view {
@ -41,18 +42,16 @@
} }
.phui-feed-story-bigtext-post { .phui-feed-story-bigtext-post {
font-size: 15px;
font-weight: 200;
line-height: 18px; line-height: 18px;
color: #444; color: #444;
} }
.phui-feed-story-bigtext-post h3 { .phui-feed-story-bigtext-post h3 {
font-size: 24px; font-size: 18px;
font-weight: 100; font-weight: 200;
line-height: 18px; line-height: 18px;
color: #444; color: #39444f;
margin: 10px 0; margin: 0 0 5px 0;
} }
.phui-feed-token-bar { .phui-feed-token-bar {