Skip to content

Commit fab9a13

Browse files
committedMay 21, 2013
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
1 parent 470999c commit fab9a13

File tree

6 files changed

+54
-26
lines changed

6 files changed

+54
-26
lines changed
 

‎src/__celerity_resource_map__.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@
818818
),
819819
'aphront-multi-column-view-css' =>
820820
array(
821-
'uri' => '/res/972551b3/rsrc/css/aphront/multi-column.css',
821+
'uri' => '/res/e01f5f0e/rsrc/css/aphront/multi-column.css',
822822
'type' => 'css',
823823
'requires' =>
824824
array(
@@ -3592,7 +3592,7 @@
35923592
),
35933593
'phame-css' =>
35943594
array(
3595-
'uri' => '/res/8e3edb71/rsrc/css/application/phame/phame.css',
3595+
'uri' => '/res/ba5a8cd8/rsrc/css/application/phame/phame.css',
35963596
'type' => 'css',
35973597
'requires' =>
35983598
array(
@@ -3669,7 +3669,7 @@
36693669
),
36703670
'phui-feed-story-css' =>
36713671
array(
3672-
'uri' => '/res/2fb3c729/rsrc/css/phui/phui-feed-story.css',
3672+
'uri' => '/res/4dbcec0e/rsrc/css/phui/phui-feed-story.css',
36733673
'type' => 'css',
36743674
'requires' =>
36753675
array(

‎src/applications/phame/controller/PhameController.php

+30-17
Original file line numberDiff line numberDiff line change
@@ -36,44 +36,57 @@ protected function renderPostList(
3636
$nodata) {
3737
assert_instances_of($posts, 'PhamePost');
3838

39-
$list = id(new PhabricatorObjectItemListView())
40-
->setUser($user)
41-
->setNoDataString($nodata);
39+
$stories = array();
4240

4341
foreach ($posts as $post) {
4442
$blogger = $this->getHandle($post->getBloggerPHID())->renderLink();
43+
$bloggerURI = $this->getHandle($post->getBloggerPHID())->getURI();
44+
$bloggerImage = $this->getHandle($post->getBloggerPHID())->getImageURI();
4545

4646
$blog = null;
4747
if ($post->getBlog()) {
4848
$blog = $this->getHandle($post->getBlog()->getPHID())->renderLink();
4949
}
5050

51-
$published = null;
52-
if ($post->getDatePublished()) {
53-
$published = phabricator_date($post->getDatePublished(), $user);
51+
$phame_post = '';
52+
if ($post->getBody()) {
53+
$phame_post = PhabricatorMarkupEngine::summarize($post->getBody());
5454
}
5555

56-
$draft = $post->isDraft();
56+
$blog_view = $post->getViewURI();
57+
$phame_title = phutil_tag('a', array('href' => $blog_view),
58+
$post->getTitle());
59+
60+
$blogger = phutil_tag('strong', array(), $blogger);
61+
if ($post->isDraft()) {
62+
$title = pht('%s drafted a blog post on %s.',
63+
$blogger, $blog);
64+
$title = phutil_tag('em', array(), $title);
65+
} else {
66+
$title = pht('%s wrote a blog post on %s.',
67+
$blogger, $blog);
68+
}
5769

5870
$item = id(new PhabricatorObjectItemView())
5971
->setObject($post)
6072
->setHeader($post->getTitle())
6173
->setHref($this->getApplicationURI('post/view/'.$post->getID().'/'));
6274

63-
if ($blog) {
64-
$item->addAttribute($blog);
65-
}
75+
$story = id(new PHUIFeedStoryView())
76+
->setTitle($title)
77+
->setImage($bloggerImage)
78+
->setImageHref($bloggerURI)
79+
->setAppIcon('phame-dark')
80+
->setUser($user)
81+
->setPontification($phame_post, $phame_title);
6682

67-
if ($draft) {
68-
$desc = pht('Draft by %s', $blogger);
69-
} else {
70-
$desc = pht('Published on %s by %s', $published, $blogger);
83+
if ($post->getDatePublished()) {
84+
$story->setEpoch($post->getDatePublished());
7185
}
72-
$item->addAttribute($desc);
73-
$list->addItem($item);
86+
$stories[] = $story;
7487
}
7588

76-
return $list;
89+
return $stories;
7790
}
7891

7992
public function buildApplicationMenu() {

‎src/applications/phame/controller/blog/PhameBlogViewController.php

+7
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ public function processRequest() {
4848
$user,
4949
pht('This blog has no visible posts.'));
5050

51+
require_celerity_resource('phame-css');
52+
$post_list = id(new PHUIBoxView())
53+
->addPadding(PHUI::PADDING_LARGE)
54+
->addClass('phame-post-list')
55+
->appendChild($post_list);
56+
57+
5158
$crumbs = $this->buildApplicationCrumbs();
5259
$crumbs->addCrumb(
5360
id(new PhabricatorCrumbView())

‎src/applications/phame/controller/post/PhamePostListController.php

+5
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,12 @@ public function processRequest() {
7070
mpull($posts, 'getBlogPHID'));
7171
$this->loadHandles($handle_phids);
7272

73+
require_celerity_resource('phame-css');
7374
$post_list = $this->renderPostList($posts, $user, $nodata);
75+
$post_list = id(new PHUIBoxView())
76+
->addPadding(PHUI::PADDING_LARGE)
77+
->addClass('phame-post-list')
78+
->appendChild($post_list);
7479

7580
$crumbs = $this->buildApplicationCrumbs();
7681
$crumbs->addCrumb(

‎webroot/rsrc/css/application/phame/phame.css

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
margin: 0px 0px 16px 0px;
2222
}
2323

24+
.device-desktop .phame-post-list {
25+
max-width: 600px;
26+
}
27+
2428
.blog-post-list {
2529
clear: left;
2630
float: left;

‎webroot/rsrc/css/phui/phui-feed-story.css

+5-6
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
font-size: 11px;
3333
background: #f7f7f7;
3434
padding: 10px;
35+
line-height: 14px;
3536
}
3637

3738
.phui-feed-story-foot .phui-icon-view {
@@ -41,18 +42,16 @@
4142
}
4243

4344
.phui-feed-story-bigtext-post {
44-
font-size: 15px;
45-
font-weight: 200;
4645
line-height: 18px;
4746
color: #444;
4847
}
4948

5049
.phui-feed-story-bigtext-post h3 {
51-
font-size: 24px;
52-
font-weight: 100;
50+
font-size: 18px;
51+
font-weight: 200;
5352
line-height: 18px;
54-
color: #444;
55-
margin: 10px 0;
53+
color: #39444f;
54+
margin: 0 0 5px 0;
5655
}
5756

5857
.phui-feed-token-bar {

0 commit comments

Comments
 (0)
Failed to load comments.