@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+54 -26
+3 -3
src/__celerity_resource_map__.php
··· 818 818 ), 819 819 'aphront-multi-column-view-css' => 820 820 array( 821 - 'uri' => '/res/972551b3/rsrc/css/aphront/multi-column.css', 821 + 'uri' => '/res/e01f5f0e/rsrc/css/aphront/multi-column.css', 822 822 'type' => 'css', 823 823 'requires' => 824 824 array( ··· 3592 3592 ), 3593 3593 'phame-css' => 3594 3594 array( 3595 - 'uri' => '/res/8e3edb71/rsrc/css/application/phame/phame.css', 3595 + 'uri' => '/res/ba5a8cd8/rsrc/css/application/phame/phame.css', 3596 3596 'type' => 'css', 3597 3597 'requires' => 3598 3598 array( ··· 3669 3669 ), 3670 3670 'phui-feed-story-css' => 3671 3671 array( 3672 - 'uri' => '/res/2fb3c729/rsrc/css/phui/phui-feed-story.css', 3672 + 'uri' => '/res/4dbcec0e/rsrc/css/phui/phui-feed-story.css', 3673 3673 'type' => 'css', 3674 3674 'requires' => 3675 3675 array(
+30 -17
src/applications/phame/controller/PhameController.php
··· 36 36 $nodata) { 37 37 assert_instances_of($posts, 'PhamePost'); 38 38 39 - $list = id(new PhabricatorObjectItemListView()) 40 - ->setUser($user) 41 - ->setNoDataString($nodata); 39 + $stories = array(); 42 40 43 41 foreach ($posts as $post) { 44 42 $blogger = $this->getHandle($post->getBloggerPHID())->renderLink(); 43 + $bloggerURI = $this->getHandle($post->getBloggerPHID())->getURI(); 44 + $bloggerImage = $this->getHandle($post->getBloggerPHID())->getImageURI(); 45 45 46 46 $blog = null; 47 47 if ($post->getBlog()) { 48 48 $blog = $this->getHandle($post->getBlog()->getPHID())->renderLink(); 49 49 } 50 50 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()); 54 54 } 55 55 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 + } 57 69 58 70 $item = id(new PhabricatorObjectItemView()) 59 71 ->setObject($post) 60 72 ->setHeader($post->getTitle()) 61 73 ->setHref($this->getApplicationURI('post/view/'.$post->getID().'/')); 62 74 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); 66 82 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()); 71 85 } 72 - $item->addAttribute($desc); 73 - $list->addItem($item); 86 + $stories[] = $story; 74 87 } 75 88 76 - return $list; 89 + return $stories; 77 90 } 78 91 79 92 public function buildApplicationMenu() {
+7
src/applications/phame/controller/blog/PhameBlogViewController.php
··· 48 48 $user, 49 49 pht('This blog has no visible posts.')); 50 50 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 + 51 58 $crumbs = $this->buildApplicationCrumbs(); 52 59 $crumbs->addCrumb( 53 60 id(new PhabricatorCrumbView())
+5
src/applications/phame/controller/post/PhamePostListController.php
··· 70 70 mpull($posts, 'getBlogPHID')); 71 71 $this->loadHandles($handle_phids); 72 72 73 + require_celerity_resource('phame-css'); 73 74 $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); 74 79 75 80 $crumbs = $this->buildApplicationCrumbs(); 76 81 $crumbs->addCrumb(
+4
webroot/rsrc/css/application/phame/phame.css
··· 21 21 margin: 0px 0px 16px 0px; 22 22 } 23 23 24 + .device-desktop .phame-post-list { 25 + max-width: 600px; 26 + } 27 + 24 28 .blog-post-list { 25 29 clear: left; 26 30 float: left;
+5 -6
webroot/rsrc/css/phui/phui-feed-story.css
··· 32 32 font-size: 11px; 33 33 background: #f7f7f7; 34 34 padding: 10px; 35 + line-height: 14px; 35 36 } 36 37 37 38 .phui-feed-story-foot .phui-icon-view { ··· 41 42 } 42 43 43 44 .phui-feed-story-bigtext-post { 44 - font-size: 15px; 45 - font-weight: 200; 46 45 line-height: 18px; 47 46 color: #444; 48 47 } 49 48 50 49 .phui-feed-story-bigtext-post h3 { 51 - font-size: 24px; 52 - font-weight: 100; 50 + font-size: 18px; 51 + font-weight: 200; 53 52 line-height: 18px; 54 - color: #444; 55 - margin: 10px 0; 53 + color: #39444f; 54 + margin: 0 0 5px 0; 56 55 } 57 56 58 57 .phui-feed-token-bar {