@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.

Update PhameBlogView UI

Summary: Creates a new PhameBlogView which is more of a blog landing page with the latest posts. Management has moved to PhameManageController with a new timeline.

Test Plan:
Edit Blog, Publish, Subscribe, view posts.

{F1008400}

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T9360

Differential Revision: https://secure.phabricator.com/D14608

+465 -208
+4 -2
resources/celerity/map.php
··· 82 82 'rsrc/css/application/owners/owners-path-editor.css' => '2f00933b', 83 83 'rsrc/css/application/paste/paste.css' => 'b2f5a543', 84 84 'rsrc/css/application/people/people-profile.css' => '25970776', 85 - 'rsrc/css/application/phame/phame.css' => 'bb147387', 85 + 'rsrc/css/application/phame/phame.css' => 'd5528237', 86 86 'rsrc/css/application/pholio/pholio-edit.css' => '3ad9d1ee', 87 87 'rsrc/css/application/pholio/pholio-inline-comments.css' => '8e545e49', 88 88 'rsrc/css/application/pholio/pholio.css' => '95174bdd', ··· 127 127 'rsrc/css/phui/phui-button.css' => '16020a60', 128 128 'rsrc/css/phui/phui-crumbs-view.css' => '414406b5', 129 129 'rsrc/css/phui/phui-document-pro.css' => 'e0fad431', 130 + 'rsrc/css/phui/phui-document-summary.css' => 'bca1ed88', 130 131 'rsrc/css/phui/phui-document.css' => 'a4a1c3b9', 131 132 'rsrc/css/phui/phui-feed-story.css' => 'b7b26d23', 132 133 'rsrc/css/phui/phui-fontkit.css' => '9cda225e', ··· 771 772 'phabricator-uiexample-reactor-sendclass' => '1def2711', 772 773 'phabricator-uiexample-reactor-sendproperties' => 'b1f0ccee', 773 774 'phabricator-zindex-css' => '57ddcaa2', 774 - 'phame-css' => 'bb147387', 775 + 'phame-css' => 'd5528237', 775 776 'pholio-css' => '95174bdd', 776 777 'pholio-edit-css' => '3ad9d1ee', 777 778 'pholio-inline-comments-css' => '8e545e49', ··· 789 790 'phui-calendar-list-css' => 'c1c7f338', 790 791 'phui-calendar-month-css' => '476be7e0', 791 792 'phui-crumbs-view-css' => '414406b5', 793 + 'phui-document-summary-view-css' => 'bca1ed88', 792 794 'phui-document-view-css' => 'a4a1c3b9', 793 795 'phui-document-view-pro-css' => 'e0fad431', 794 796 'phui-feed-story-css' => 'b7b26d23',
+4
src/__phutil_library_map__.php
··· 1441 1441 'PHUIDiffTableOfContentsListView' => 'infrastructure/diff/view/PHUIDiffTableOfContentsListView.php', 1442 1442 'PHUIDiffTwoUpInlineCommentRowScaffold' => 'infrastructure/diff/view/PHUIDiffTwoUpInlineCommentRowScaffold.php', 1443 1443 'PHUIDocumentExample' => 'applications/uiexample/examples/PHUIDocumentExample.php', 1444 + 'PHUIDocumentSummaryView' => 'view/phui/PHUIDocumentSummaryView.php', 1444 1445 'PHUIDocumentView' => 'view/phui/PHUIDocumentView.php', 1445 1446 'PHUIDocumentViewPro' => 'view/phui/PHUIDocumentViewPro.php', 1446 1447 'PHUIFeedStoryExample' => 'applications/uiexample/examples/PHUIFeedStoryExample.php', ··· 3287 3288 'PhameBlogFeedController' => 'applications/phame/controller/blog/PhameBlogFeedController.php', 3288 3289 'PhameBlogListController' => 'applications/phame/controller/blog/PhameBlogListController.php', 3289 3290 'PhameBlogLiveController' => 'applications/phame/controller/blog/PhameBlogLiveController.php', 3291 + 'PhameBlogManageController' => 'applications/phame/controller/blog/PhameBlogManageController.php', 3290 3292 'PhameBlogProfilePictureController' => 'applications/phame/controller/blog/PhameBlogProfilePictureController.php', 3291 3293 'PhameBlogQuery' => 'applications/phame/query/PhameBlogQuery.php', 3292 3294 'PhameBlogReplyHandler' => 'applications/phame/mail/PhameBlogReplyHandler.php', ··· 5424 5426 'PHUIDiffTableOfContentsListView' => 'AphrontView', 5425 5427 'PHUIDiffTwoUpInlineCommentRowScaffold' => 'PHUIDiffInlineCommentRowScaffold', 5426 5428 'PHUIDocumentExample' => 'PhabricatorUIExample', 5429 + 'PHUIDocumentSummaryView' => 'AphrontTagView', 5427 5430 'PHUIDocumentView' => 'AphrontTagView', 5428 5431 'PHUIDocumentViewPro' => 'AphrontTagView', 5429 5432 'PHUIFeedStoryExample' => 'PhabricatorUIExample', ··· 7597 7600 'PhameBlogFeedController' => 'PhameBlogController', 7598 7601 'PhameBlogListController' => 'PhameBlogController', 7599 7602 'PhameBlogLiveController' => 'PhameBlogController', 7603 + 'PhameBlogManageController' => 'PhameBlogController', 7600 7604 'PhameBlogProfilePictureController' => 'PhameBlogController', 7601 7605 'PhameBlogQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 7602 7606 'PhameBlogReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
+1
src/applications/phame/application/PhabricatorPhameApplication.php
··· 61 61 'archive/(?P<id>[^/]+)/' => 'PhameBlogArchiveController', 62 62 'edit/(?P<id>[^/]+)/' => 'PhameBlogEditController', 63 63 'view/(?P<id>[^/]+)/' => 'PhameBlogViewController', 64 + 'manage/(?P<id>[^/]+)/' => 'PhameBlogManageController', 64 65 'feed/(?P<id>[^/]+)/' => 'PhameBlogFeedController', 65 66 'new/' => 'PhameBlogEditController', 66 67 'picture/(?P<id>[1-9]\d*)/' => 'PhameBlogProfilePictureController',
-109
src/applications/phame/controller/PhameController.php
··· 2 2 3 3 abstract class PhameController extends PhabricatorController { 4 4 5 - protected function renderPostList( 6 - array $posts, 7 - PhabricatorUser $viewer, 8 - $nodata) { 9 - assert_instances_of($posts, 'PhamePost'); 10 - 11 - $handle_phids = array(); 12 - foreach ($posts as $post) { 13 - $handle_phids[] = $post->getBloggerPHID(); 14 - if ($post->getBlog()) { 15 - $handle_phids[] = $post->getBlog()->getPHID(); 16 - } 17 - } 18 - $handles = $viewer->loadHandles($handle_phids); 19 - 20 - $stories = array(); 21 - foreach ($posts as $post) { 22 - $blogger = $handles[$post->getBloggerPHID()]->renderLink(); 23 - $blogger_uri = $handles[$post->getBloggerPHID()]->getURI(); 24 - $blogger_image = $handles[$post->getBloggerPHID()]->getImageURI(); 25 - 26 - $blog = null; 27 - if ($post->getBlog()) { 28 - $blog = $handles[$post->getBlog()->getPHID()]->renderLink(); 29 - } 30 - 31 - $phame_post = ''; 32 - if ($post->getBody()) { 33 - $phame_post = PhabricatorMarkupEngine::summarize($post->getBody()); 34 - } 35 - 36 - $blog_view = $post->getViewURI(); 37 - $phame_title = phutil_tag('a', array('href' => $blog_view), 38 - $post->getTitle()); 39 - 40 - $blogger = phutil_tag('strong', array(), $blogger); 41 - if ($post->isDraft()) { 42 - $title = pht( 43 - '%s drafted a blog post on %s.', 44 - $blogger, 45 - $blog); 46 - $title = phutil_tag('em', array(), $title); 47 - } else { 48 - $title = pht( 49 - '%s wrote a blog post on %s.', 50 - $blogger, 51 - $blog); 52 - } 53 - 54 - $item = id(new PHUIObjectItemView()) 55 - ->setObject($post) 56 - ->setHeader($post->getTitle()) 57 - ->setHref($this->getApplicationURI('post/view/'.$post->getID().'/')); 58 - 59 - $story = id(new PHUIFeedStoryView()) 60 - ->setTitle($title) 61 - ->setImage($blogger_image) 62 - ->setImageHref($blogger_uri) 63 - ->setAppIcon('fa-star') 64 - ->setUser($viewer) 65 - ->setPontification($phame_post, $phame_title); 66 - 67 - if (PhabricatorPolicyFilter::hasCapability( 68 - $viewer, 69 - $post, 70 - PhabricatorPolicyCapability::CAN_EDIT)) { 71 - 72 - $story->addAction(id(new PHUIIconView()) 73 - ->setHref($this->getApplicationURI('post/edit/'.$post->getID().'/')) 74 - ->setIconFont('fa-pencil')); 75 - } 76 - 77 - if ($post->getDatePublished()) { 78 - $story->setEpoch($post->getDatePublished()); 79 - } 80 - 81 - $stories[] = $story; 82 - } 83 - 84 - if (empty($stories)) { 85 - return id(new PHUIBoxView()) 86 - ->appendChild($nodata) 87 - ->addClass('mlt mlb msr msl'); 88 - } 89 - 90 - return $stories; 91 - } 92 - 93 - protected function buildApplicationCrumbs() { 94 - $crumbs = parent::buildApplicationCrumbs(); 95 - 96 - $can_create = $this->hasApplicationCapability( 97 - PhameBlogCreateCapability::CAPABILITY); 98 - 99 - $crumbs->addAction( 100 - id(new PHUIListItemView()) 101 - ->setName(pht('New Blog')) 102 - ->setHref($this->getApplicationURI('/blog/new/')) 103 - ->setIcon('fa-plus-square') 104 - ->setDisabled(!$can_create) 105 - ->setWorkflow(!$can_create)); 106 - 107 - $crumbs->addAction( 108 - id(new PHUIListItemView()) 109 - ->setName(pht('New Post')) 110 - ->setHref($this->getApplicationURI('/post/new/')) 111 - ->setIcon('fa-pencil')); 112 - return $crumbs; 113 - } 114 5 }
+17
src/applications/phame/controller/blog/PhameBlogListController.php
··· 31 31 return $nav; 32 32 } 33 33 34 + protected function buildApplicationCrumbs() { 35 + $crumbs = parent::buildApplicationCrumbs(); 36 + 37 + $can_create = $this->hasApplicationCapability( 38 + PhameBlogCreateCapability::CAPABILITY); 39 + 40 + $crumbs->addAction( 41 + id(new PHUIListItemView()) 42 + ->setName(pht('New Blog')) 43 + ->setHref($this->getApplicationURI('/blog/new/')) 44 + ->setIcon('fa-plus-square') 45 + ->setDisabled(!$can_create) 46 + ->setWorkflow(!$can_create)); 47 + 48 + return $crumbs; 49 + } 50 + 34 51 }
+196
src/applications/phame/controller/blog/PhameBlogManageController.php
··· 1 + <?php 2 + 3 + final class PhameBlogManageController extends PhameBlogController { 4 + 5 + public function handleRequest(AphrontRequest $request) { 6 + $viewer = $request->getViewer(); 7 + $id = $request->getURIData('id'); 8 + 9 + $blog = id(new PhameBlogQuery()) 10 + ->setViewer($viewer) 11 + ->withIDs(array($id)) 12 + ->needProfileImage(true) 13 + ->executeOne(); 14 + if (!$blog) { 15 + return new Aphront404Response(); 16 + } 17 + 18 + if ($blog->isArchived()) { 19 + $header_icon = 'fa-ban'; 20 + $header_name = pht('Archived'); 21 + $header_color = 'dark'; 22 + } else { 23 + $header_icon = 'fa-check'; 24 + $header_name = pht('Active'); 25 + $header_color = 'bluegrey'; 26 + } 27 + 28 + $picture = $blog->getProfileImageURI(); 29 + 30 + $header = id(new PHUIHeaderView()) 31 + ->setHeader($blog->getName()) 32 + ->setUser($viewer) 33 + ->setPolicyObject($blog) 34 + ->setImage($picture) 35 + ->setStatus($header_icon, $header_color, $header_name); 36 + 37 + $actions = $this->renderActions($blog, $viewer); 38 + $properties = $this->renderProperties($blog, $viewer, $actions); 39 + 40 + $crumbs = $this->buildApplicationCrumbs(); 41 + $crumbs->addTextCrumb( 42 + pht('Blogs'), 43 + $this->getApplicationURI('blog/')); 44 + $crumbs->addTextCrumb( 45 + $blog->getName()); 46 + 47 + $object_box = id(new PHUIObjectBoxView()) 48 + ->setHeader($header) 49 + ->addPropertyList($properties); 50 + 51 + $timeline = $this->buildTransactionTimeline( 52 + $blog, 53 + new PhameBlogTransactionQuery()); 54 + $timeline->setShouldTerminate(true); 55 + 56 + return $this->newPage() 57 + ->setTitle($blog->getName()) 58 + ->setCrumbs($crumbs) 59 + ->appendChild( 60 + array( 61 + $object_box, 62 + $timeline, 63 + )); 64 + } 65 + 66 + private function renderProperties( 67 + PhameBlog $blog, 68 + PhabricatorUser $viewer, 69 + PhabricatorActionListView $actions) { 70 + 71 + require_celerity_resource('aphront-tooltip-css'); 72 + Javelin::initBehavior('phabricator-tooltips'); 73 + 74 + $properties = id(new PHUIPropertyListView()) 75 + ->setUser($viewer) 76 + ->setObject($blog) 77 + ->setActionList($actions); 78 + 79 + $properties->addProperty( 80 + pht('Skin'), 81 + $blog->getSkin()); 82 + 83 + $properties->addProperty( 84 + pht('Domain'), 85 + $blog->getDomain()); 86 + 87 + $feed_uri = PhabricatorEnv::getProductionURI( 88 + $this->getApplicationURI('blog/feed/'.$blog->getID().'/')); 89 + $properties->addProperty( 90 + pht('Atom URI'), 91 + javelin_tag('a', 92 + array( 93 + 'href' => $feed_uri, 94 + 'sigil' => 'has-tooltip', 95 + 'meta' => array( 96 + 'tip' => pht('Atom URI does not support custom domains.'), 97 + 'size' => 320, 98 + ), 99 + ), 100 + $feed_uri)); 101 + 102 + $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions( 103 + $viewer, 104 + $blog); 105 + 106 + $properties->addProperty( 107 + pht('Editable By'), 108 + $descriptions[PhabricatorPolicyCapability::CAN_EDIT]); 109 + 110 + $engine = id(new PhabricatorMarkupEngine()) 111 + ->setViewer($viewer) 112 + ->addObject($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION) 113 + ->process(); 114 + 115 + $properties->invokeWillRenderEvent(); 116 + 117 + if (strlen($blog->getDescription())) { 118 + $description = PhabricatorMarkupEngine::renderOneObject( 119 + id(new PhabricatorMarkupOneOff())->setContent($blog->getDescription()), 120 + 'default', 121 + $viewer); 122 + $properties->addSectionHeader( 123 + pht('Description'), 124 + PHUIPropertyListView::ICON_SUMMARY); 125 + $properties->addTextContent($description); 126 + } 127 + 128 + return $properties; 129 + } 130 + 131 + private function renderActions(PhameBlog $blog, PhabricatorUser $viewer) { 132 + $actions = id(new PhabricatorActionListView()) 133 + ->setObject($blog) 134 + ->setObjectURI($this->getRequest()->getRequestURI()) 135 + ->setUser($viewer); 136 + 137 + $can_edit = PhabricatorPolicyFilter::hasCapability( 138 + $viewer, 139 + $blog, 140 + PhabricatorPolicyCapability::CAN_EDIT); 141 + 142 + $actions->addAction( 143 + id(new PhabricatorActionView()) 144 + ->setIcon('fa-plus') 145 + ->setHref($this->getApplicationURI('post/edit/?blog='.$blog->getID())) 146 + ->setName(pht('Write Post')) 147 + ->setDisabled(!$can_edit) 148 + ->setWorkflow(!$can_edit)); 149 + 150 + $actions->addAction( 151 + id(new PhabricatorActionView()) 152 + ->setUser($viewer) 153 + ->setIcon('fa-globe') 154 + ->setHref($blog->getLiveURI()) 155 + ->setName(pht('View Live'))); 156 + 157 + $actions->addAction( 158 + id(new PhabricatorActionView()) 159 + ->setIcon('fa-pencil') 160 + ->setHref($this->getApplicationURI('blog/edit/'.$blog->getID().'/')) 161 + ->setName(pht('Edit Blog')) 162 + ->setDisabled(!$can_edit) 163 + ->setWorkflow(!$can_edit)); 164 + 165 + $actions->addAction( 166 + id(new PhabricatorActionView()) 167 + ->setIcon('fa-picture-o') 168 + ->setHref($this->getApplicationURI('blog/picture/'.$blog->getID().'/')) 169 + ->setName(pht('Edit Blog Picture')) 170 + ->setDisabled(!$can_edit) 171 + ->setWorkflow(!$can_edit)); 172 + 173 + if ($blog->isArchived()) { 174 + $actions->addAction( 175 + id(new PhabricatorActionView()) 176 + ->setName(pht('Activate Blog')) 177 + ->setIcon('fa-check') 178 + ->setHref( 179 + $this->getApplicationURI('blog/archive/'.$blog->getID().'/')) 180 + ->setDisabled(!$can_edit) 181 + ->setWorkflow(true)); 182 + } else { 183 + $actions->addAction( 184 + id(new PhabricatorActionView()) 185 + ->setName(pht('Archive Blog')) 186 + ->setIcon('fa-ban') 187 + ->setHref( 188 + $this->getApplicationURI('blog/archive/'.$blog->getID().'/')) 189 + ->setDisabled(!$can_edit) 190 + ->setWorkflow(true)); 191 + } 192 + 193 + return $actions; 194 + } 195 + 196 + }
+106 -93
src/applications/phame/controller/blog/PhameBlogViewController.php
··· 2 2 3 3 final class PhameBlogViewController extends PhameBlogController { 4 4 5 + private $blog; 6 + 5 7 public function handleRequest(AphrontRequest $request) { 6 8 $viewer = $request->getViewer(); 7 9 $id = $request->getURIData('id'); ··· 14 16 if (!$blog) { 15 17 return new Aphront404Response(); 16 18 } 19 + $this->blog = $blog; 17 20 18 21 $pager = id(new AphrontCursorPagerView()) 19 22 ->readFromRequest($request); ··· 33 36 $header_color = 'bluegrey'; 34 37 } 35 38 36 - $picture = $blog->getProfileImageURI(); 39 + $actions = $this->renderActions($blog, $viewer); 40 + $action_button = id(new PHUIButtonView()) 41 + ->setTag('a') 42 + ->setText(pht('Actions')) 43 + ->setHref('#') 44 + ->setIconFont('fa-bars') 45 + ->addClass('phui-mobile-menu') 46 + ->setDropdownMenu($actions); 37 47 38 48 $header = id(new PHUIHeaderView()) 39 49 ->setHeader($blog->getName()) 40 50 ->setUser($viewer) 41 51 ->setPolicyObject($blog) 42 - ->setImage($picture) 43 - ->setStatus($header_icon, $header_color, $header_name); 52 + ->setStatus($header_icon, $header_color, $header_name) 53 + ->addActionLink($action_button); 44 54 45 - $actions = $this->renderActions($blog, $viewer); 46 - $properties = $this->renderProperties($blog, $viewer, $actions); 47 55 $post_list = $this->renderPostList( 48 56 $posts, 49 57 $viewer, 50 58 pht('This blog has no visible posts.')); 51 59 52 - $post_list = id(new PHUIObjectBoxView()) 53 - ->setHeaderText(pht('Latest Posts')) 54 - ->appendChild($post_list); 55 - 56 60 $crumbs = $this->buildApplicationCrumbs(); 61 + $crumbs->setBorder(true); 57 62 $crumbs->addTextCrumb( 58 63 pht('Blogs'), 59 64 $this->getApplicationURI('blog/')); 60 65 $crumbs->addTextCrumb( 61 66 $blog->getName()); 62 67 63 - $object_box = id(new PHUIObjectBoxView()) 68 + $page = id(new PHUIDocumentViewPro()) 64 69 ->setHeader($header) 65 - ->addPropertyList($properties); 70 + ->appendChild($post_list); 71 + 72 + $description = $this->renderDescription($blog, $viewer); 66 73 67 74 return $this->newPage() 68 75 ->setTitle($blog->getName()) 69 76 ->setCrumbs($crumbs) 70 77 ->appendChild( 71 78 array( 72 - $object_box, 73 - $post_list, 79 + $page, 80 + $description, 74 81 )); 75 82 } 76 83 77 - private function renderProperties( 84 + private function renderDescription( 78 85 PhameBlog $blog, 79 - PhabricatorUser $viewer, 80 - PhabricatorActionListView $actions) { 86 + PhabricatorUser $viewer) { 81 87 82 - require_celerity_resource('aphront-tooltip-css'); 83 - Javelin::initBehavior('phabricator-tooltips'); 88 + require_celerity_resource('phame-css'); 84 89 85 - $properties = id(new PHUIPropertyListView()) 86 - ->setUser($viewer) 87 - ->setObject($blog) 88 - ->setActionList($actions); 90 + if (strlen($blog->getDescription())) { 91 + $description = PhabricatorMarkupEngine::renderOneObject( 92 + id(new PhabricatorMarkupOneOff())->setContent($blog->getDescription()), 93 + 'default', 94 + $viewer); 95 + } else { 96 + $description = phutil_tag('em', array(), pht('No description.')); 97 + } 89 98 90 - $properties->addProperty( 91 - pht('Skin'), 92 - $blog->getSkin()); 99 + $picture = $blog->getProfileImageURI(); 100 + $description = phutil_tag_div( 101 + 'phame-blog-description-content', $description); 102 + 103 + $image = phutil_tag( 104 + 'div', 105 + array( 106 + 'class' => 'phame-blog-description-image', 107 + 'style' => 'background-image: url('.$picture.');', 108 + )); 93 109 94 - $properties->addProperty( 95 - pht('Domain'), 96 - $blog->getDomain()); 110 + $header = phutil_tag( 111 + 'div', 112 + array( 113 + 'class' => 'phame-blog-description-name', 114 + ), 115 + pht('About %s', $blog->getName())); 116 + 117 + $view = phutil_tag( 118 + 'div', 119 + array( 120 + 'class' => 'phame-blog-description', 121 + ), 122 + array( 123 + $image, 124 + $header, 125 + $description, 126 + )); 127 + 128 + return $view; 129 + } 130 + 131 + protected function renderPostList( 132 + array $posts, 133 + PhabricatorUser $viewer, 134 + $nodata) { 135 + assert_instances_of($posts, 'PhamePost'); 136 + 137 + $handle_phids = array(); 138 + foreach ($posts as $post) { 139 + $handle_phids[] = $post->getBloggerPHID(); 140 + if ($post->getBlog()) { 141 + $handle_phids[] = $post->getBlog()->getPHID(); 142 + } 143 + } 144 + $handles = $viewer->loadHandles($handle_phids); 97 145 98 - $feed_uri = PhabricatorEnv::getProductionURI( 99 - $this->getApplicationURI('blog/feed/'.$blog->getID().'/')); 100 - $properties->addProperty( 101 - pht('Atom URI'), 102 - javelin_tag('a', 103 - array( 104 - 'href' => $feed_uri, 105 - 'sigil' => 'has-tooltip', 106 - 'meta' => array( 107 - 'tip' => pht('Atom URI does not support custom domains.'), 108 - 'size' => 320, 109 - ), 110 - ), 111 - $feed_uri)); 146 + $list = array(); 147 + foreach ($posts as $post) { 148 + $blogger = $handles[$post->getBloggerPHID()]->renderLink(); 149 + $blogger_uri = $handles[$post->getBloggerPHID()]->getURI(); 150 + $blogger_image = $handles[$post->getBloggerPHID()]->getImageURI(); 112 151 113 - $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions( 114 - $viewer, 115 - $blog); 152 + $phame_post = null; 153 + if ($post->getBody()) { 154 + $phame_post = PhabricatorMarkupEngine::summarize($post->getBody()); 155 + $phame_post = new PHUIRemarkupView($viewer, $phame_post); 156 + } else { 157 + $phame_post = phutil_tag('em', array(), pht('Empty Post')); 158 + } 116 159 117 - $properties->addProperty( 118 - pht('Editable By'), 119 - $descriptions[PhabricatorPolicyCapability::CAN_EDIT]); 160 + $blogger = phutil_tag('strong', array(), $blogger); 161 + $date = phabricator_datetime($post->getDatePublished(), $viewer); 162 + $subtitle = pht('Written by %s on %s.', $blogger, $date); 120 163 121 - $engine = id(new PhabricatorMarkupEngine()) 122 - ->setViewer($viewer) 123 - ->addObject($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION) 124 - ->process(); 164 + $item = id(new PHUIDocumentSummaryView()) 165 + ->setTitle($post->getTitle()) 166 + ->setHref($this->getApplicationURI('/post/view/'.$post->getID().'/')) 167 + ->setSubtitle($subtitle) 168 + ->setImage($blogger_image) 169 + ->setImageHref($blogger_uri) 170 + ->setSummary($phame_post); 125 171 126 - $properties->invokeWillRenderEvent(); 172 + $list[] = $item; 173 + } 127 174 128 - if (strlen($blog->getDescription())) { 129 - $description = PhabricatorMarkupEngine::renderOneObject( 130 - id(new PhabricatorMarkupOneOff())->setContent($blog->getDescription()), 131 - 'default', 132 - $viewer); 133 - $properties->addSectionHeader( 134 - pht('Description'), 135 - PHUIPropertyListView::ICON_SUMMARY); 136 - $properties->addTextContent($description); 175 + if (empty($list)) { 176 + $list = id(new PHUIInfoView()) 177 + ->appendChild($nodata); 137 178 } 138 179 139 - return $properties; 180 + return $list; 140 181 } 141 182 142 183 private function renderActions(PhameBlog $blog, PhabricatorUser $viewer) { ··· 168 209 $actions->addAction( 169 210 id(new PhabricatorActionView()) 170 211 ->setIcon('fa-pencil') 171 - ->setHref($this->getApplicationURI('blog/edit/'.$blog->getID().'/')) 172 - ->setName(pht('Edit Blog')) 212 + ->setHref($this->getApplicationURI('blog/manage/'.$blog->getID().'/')) 213 + ->setName(pht('Manage Blog')) 173 214 ->setDisabled(!$can_edit) 174 215 ->setWorkflow(!$can_edit)); 175 - 176 - $actions->addAction( 177 - id(new PhabricatorActionView()) 178 - ->setIcon('fa-picture-o') 179 - ->setHref($this->getApplicationURI('blog/picture/'.$blog->getID().'/')) 180 - ->setName(pht('Edit Blog Picture')) 181 - ->setDisabled(!$can_edit) 182 - ->setWorkflow(!$can_edit)); 183 - 184 - if ($blog->isArchived()) { 185 - $actions->addAction( 186 - id(new PhabricatorActionView()) 187 - ->setName(pht('Activate Blog')) 188 - ->setIcon('fa-check') 189 - ->setHref( 190 - $this->getApplicationURI('blog/archive/'.$blog->getID().'/')) 191 - ->setDisabled(!$can_edit) 192 - ->setWorkflow(true)); 193 - } else { 194 - $actions->addAction( 195 - id(new PhabricatorActionView()) 196 - ->setName(pht('Archive Blog')) 197 - ->setIcon('fa-ban') 198 - ->setHref( 199 - $this->getApplicationURI('blog/archive/'.$blog->getID().'/')) 200 - ->setDisabled(!$can_edit) 201 - ->setWorkflow(true)); 202 - } 203 216 204 217 return $actions; 205 218 }
+86
src/view/phui/PHUIDocumentSummaryView.php
··· 1 + <?php 2 + 3 + final class PHUIDocumentSummaryView extends AphrontTagView { 4 + 5 + private $title; 6 + private $image; 7 + private $imageHref; 8 + private $subtitle; 9 + private $href; 10 + private $summary; 11 + 12 + public function setTitle($title) { 13 + $this->title = $title; 14 + return $this; 15 + } 16 + 17 + public function setSubtitle($subtitle) { 18 + $this->subtitle = $subtitle; 19 + return $this; 20 + } 21 + 22 + public function setImage($image) { 23 + $this->image = $image; 24 + return $this; 25 + } 26 + 27 + public function setImageHref($image_href) { 28 + $this->imageHref = $image_href; 29 + return $this; 30 + } 31 + 32 + public function setHref($href) { 33 + $this->href = $href; 34 + return $this; 35 + } 36 + 37 + public function setSummary($summary) { 38 + $this->summary = $summary; 39 + return $this; 40 + } 41 + 42 + protected function getTagAttributes() { 43 + $classes = array(); 44 + $classes[] = 'phui-document-summary-view'; 45 + $classes[] = 'phabricator-remarkup'; 46 + 47 + return array( 48 + 'class' => implode(' ', $classes), 49 + ); 50 + } 51 + 52 + protected function getTagContent() { 53 + require_celerity_resource('phui-document-summary-view-css'); 54 + 55 + $title = phutil_tag( 56 + 'a', 57 + array( 58 + 'href' => $this->href, 59 + ), 60 + $this->title); 61 + 62 + $header = phutil_tag( 63 + 'h2', 64 + array( 65 + 'class' => 'remarkup-header', 66 + ), 67 + $title); 68 + 69 + $subtitle = phutil_tag( 70 + 'div', 71 + array( 72 + 'class' => 'phui-document-summary-subtitle', 73 + ), 74 + $this->subtitle); 75 + 76 + $body = phutil_tag( 77 + 'div', 78 + array( 79 + 'class' => 'phui-document-summary-body', 80 + ), 81 + $this->summary); 82 + 83 + return array($header, $subtitle, $body); 84 + } 85 + 86 + }
+25 -4
webroot/rsrc/css/application/phame/phame.css
··· 2 2 * @provides phame-css 3 3 */ 4 4 5 - .fb-comments, 6 - .fb-comments span, 7 - .fb-comments iframe[style] { 8 - width: 100% !important; 5 + .phame-blog-description { 6 + max-width: 800px; 7 + margin: 32px auto; 8 + position: relative; 9 + } 10 + 11 + .phame-blog-description-name { 12 + font-weight: bold; 13 + font-size: {$biggerfontsize}; 14 + margin: 0 0 4px 50px; 15 + } 16 + 17 + .phame-blog-description-content { 18 + margin-left: 50px; 19 + } 20 + 21 + .phame-blog-description-image { 22 + display: inline-block; 23 + background-repeat: no-repeat; 24 + background-size: 100%; 25 + box-shadow: inset 0 0 0 1px rgba(55,55,55,.15); 26 + width: 40px; 27 + height: 40px; 28 + border-radius: 3px; 29 + position: absolute; 9 30 }
+26
webroot/rsrc/css/phui/phui-document-summary.css
··· 1 + /** 2 + * @provides phui-document-summary-view-css 3 + */ 4 + 5 + .phui-document-summary-view { 6 + 7 + } 8 + 9 + body .phui-document-view .phui-document-summary-view h2.remarkup-header { 10 + margin: 0; 11 + padding: 0; 12 + } 13 + 14 + .phui-document-summary-view h2.remarkup-header a { 15 + color: {$darkbluetext}; 16 + } 17 + 18 + .phui-document-summary-subtitle { 19 + color: {$lightbluetext}; 20 + font-size: {$normalfontsize}; 21 + margin-bottom: 8px; 22 + } 23 + 24 + .phui-document-summary-subtitle a { 25 + color: {$darkbluetext}; 26 + }