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

Add "Blogs" section to PhameHome

Summary: Ref T9927. Adds a "Blogs" section to PhameHome. Removes "New Post" Controller. Adds flipped layout for PHUITwoColumnView

Test Plan:
Test PhameHome, Ponder, New Post, etc. Mobile and Desktop states.

{F1022080}

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: johnny-bit, Korvin

Maniphest Tasks: T9927

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

authored by

Chad Little and committed by
chad
efb6bb3d 7b997359

+245 -89
+2 -2
resources/celerity/map.php
··· 82 82 'rsrc/css/application/owners/owners-path-editor.css' => '2f00933b', 83 83 'rsrc/css/application/paste/paste.css' => 'a5157c48', 84 84 'rsrc/css/application/people/people-profile.css' => '25970776', 85 - 'rsrc/css/application/phame/phame.css' => 'cea3c9e1', 85 + 'rsrc/css/application/phame/phame.css' => '0b018205', 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', ··· 782 782 'phabricator-uiexample-reactor-sendclass' => '1def2711', 783 783 'phabricator-uiexample-reactor-sendproperties' => 'b1f0ccee', 784 784 'phabricator-zindex-css' => '57ddcaa2', 785 - 'phame-css' => 'cea3c9e1', 785 + 'phame-css' => '0b018205', 786 786 'pholio-css' => '95174bdd', 787 787 'pholio-edit-css' => '3ad9d1ee', 788 788 'pholio-inline-comments-css' => '8e545e49',
+2 -2
src/__phutil_library_map__.php
··· 3325 3325 'PhameBlogEditor' => 'applications/phame/editor/PhameBlogEditor.php', 3326 3326 'PhameBlogFeedController' => 'applications/phame/controller/blog/PhameBlogFeedController.php', 3327 3327 'PhameBlogListController' => 'applications/phame/controller/blog/PhameBlogListController.php', 3328 + 'PhameBlogListView' => 'applications/phame/view/PhameBlogListView.php', 3328 3329 'PhameBlogManageController' => 'applications/phame/controller/blog/PhameBlogManageController.php', 3329 3330 'PhameBlogProfilePictureController' => 'applications/phame/controller/blog/PhameBlogProfilePictureController.php', 3330 3331 'PhameBlogQuery' => 'applications/phame/query/PhameBlogQuery.php', ··· 3352 3353 'PhamePostListView' => 'applications/phame/view/PhamePostListView.php', 3353 3354 'PhamePostMailReceiver' => 'applications/phame/mail/PhamePostMailReceiver.php', 3354 3355 'PhamePostMoveController' => 'applications/phame/controller/post/PhamePostMoveController.php', 3355 - 'PhamePostNewController' => 'applications/phame/controller/post/PhamePostNewController.php', 3356 3356 'PhamePostPublishController' => 'applications/phame/controller/post/PhamePostPublishController.php', 3357 3357 'PhamePostQuery' => 'applications/phame/query/PhamePostQuery.php', 3358 3358 'PhamePostReplyHandler' => 'applications/phame/mail/PhamePostReplyHandler.php', ··· 7675 7675 'PhameBlogEditor' => 'PhabricatorApplicationTransactionEditor', 7676 7676 'PhameBlogFeedController' => 'PhameBlogController', 7677 7677 'PhameBlogListController' => 'PhameBlogController', 7678 + 'PhameBlogListView' => 'AphrontTagView', 7678 7679 'PhameBlogManageController' => 'PhameBlogController', 7679 7680 'PhameBlogProfilePictureController' => 'PhameBlogController', 7680 7681 'PhameBlogQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', ··· 7712 7713 'PhamePostListView' => 'AphrontTagView', 7713 7714 'PhamePostMailReceiver' => 'PhabricatorObjectMailReceiver', 7714 7715 'PhamePostMoveController' => 'PhamePostController', 7715 - 'PhamePostNewController' => 'PhamePostController', 7716 7716 'PhamePostPublishController' => 'PhamePostController', 7717 7717 'PhamePostQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 7718 7718 'PhamePostReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
-1
src/applications/phame/application/PhabricatorPhameApplication.php
··· 54 54 'preview/(?P<id>\d+)/' => 'PhamePostPreviewController', 55 55 'preview/' => 'PhabricatorMarkupPreviewController', 56 56 'framed/(?P<id>\d+)/' => 'PhamePostFramedController', 57 - 'new/' => 'PhamePostNewController', 58 57 'move/(?P<id>\d+)/' => 'PhamePostMoveController', 59 58 'comment/(?P<id>[1-9]\d*)/' => 'PhamePostCommentController', 60 59 ),
+16 -14
src/applications/phame/controller/PhameHomeController.php
··· 12 12 $blogs = id(new PhameBlogQuery()) 13 13 ->setViewer($viewer) 14 14 ->withStatuses(array(PhameBlog::STATUS_ACTIVE)) 15 + ->needProfileImage(true) 15 16 ->execute(); 16 17 17 18 $blog_phids = mpull($blogs, 'getPHID'); ··· 56 57 ->setHeader($header) 57 58 ->appendChild($post_list); 58 59 60 + $sidebar = id(new PhameBlogListView()) 61 + ->setBlogs($blogs) 62 + ->setViewer($viewer); 63 + 64 + $phame_view = id(new PHUITwoColumnView()) 65 + ->setMainColumn(array( 66 + $page, 67 + )) 68 + ->setSideColumn($sidebar) 69 + ->setDisplay(PHUITwoColumnView::DISPLAY_LEFT) 70 + ->addClass('phame-home-view'); 71 + 59 72 return $this->newPage() 60 73 ->setTitle($title) 61 74 ->setCrumbs($crumbs) 62 75 ->appendChild( 63 76 array( 64 - $page, 77 + $phame_view, 65 78 )); 66 79 67 80 ··· 83 96 ->setHref($this->getApplicationURI('post/')) 84 97 ->setName(pht('All Posts'))); 85 98 86 - $actions->addAction( 87 - id(new PhabricatorActionView()) 88 - ->setIcon('fa-star') 89 - ->setHref($this->getApplicationURI('blog/')) 90 - ->setName(pht('Active Blogs'))); 91 - 92 99 return $actions; 93 100 } 101 + 102 + private function renderBlogs($viewer, $blogs) {} 94 103 95 104 protected function buildApplicationCrumbs() { 96 105 $crumbs = parent::buildApplicationCrumbs(); 97 106 98 107 $can_create = $this->hasApplicationCapability( 99 108 PhameBlogCreateCapability::CAPABILITY); 100 - 101 - $crumbs->addAction( 102 - id(new PHUIListItemView()) 103 - ->setName(pht('New Post')) 104 - ->setHref($this->getApplicationURI('/post/new/')) 105 - ->setIcon('fa-plus-square') 106 - ->setWorkflow(true)); 107 109 108 110 $crumbs->addAction( 109 111 id(new PHUIListItemView())
-63
src/applications/phame/controller/post/PhamePostNewController.php
··· 1 - <?php 2 - 3 - final class PhamePostNewController extends PhamePostController { 4 - 5 - public function handleRequest(AphrontRequest $request) { 6 - $viewer = $request->getViewer(); 7 - $id = $request->getInt('blog'); 8 - 9 - if ($id) { 10 - $blog = id(new PhameBlogQuery()) 11 - ->setViewer($viewer) 12 - ->withIDs(array($id)) 13 - ->requireCapabilities( 14 - array( 15 - PhabricatorPolicyCapability::CAN_EDIT, 16 - )) 17 - ->executeOne(); 18 - if (!$blog) { 19 - return new Aphront404Response(); 20 - } 21 - 22 - $view_uri = '/post/edit/?blog='.$blog->getID(); 23 - $view_uri = $this->getApplicationURI($view_uri); 24 - 25 - return id(new AphrontRedirectResponse())->setURI($view_uri); 26 - } 27 - 28 - $blogs = id(new PhameBlogQuery()) 29 - ->setViewer($viewer) 30 - ->requireCapabilities( 31 - array( 32 - PhabricatorPolicyCapability::CAN_EDIT, 33 - )) 34 - ->execute(); 35 - 36 - if (!$blogs) { 37 - $form = id(new PHUIInfoView()) 38 - ->setSeverity(PHUIInfoView::SEVERITY_NODATA) 39 - ->appendChild( 40 - pht('You do not have permission to post to any blogs. Create a blog '. 41 - 'first, then you can post to it.')); 42 - 43 - } else { 44 - $options = mpull($blogs, 'getName', 'getID'); 45 - asort($options); 46 - 47 - $form = id(new PHUIFormLayoutView()) 48 - ->setUser($viewer) 49 - ->appendChild( 50 - id(new AphrontFormSelectControl()) 51 - ->setLabel(pht('Blog')) 52 - ->setName('blog') 53 - ->setOptions($options)); 54 - } 55 - 56 - return $this->newDialog() 57 - ->setTitle(pht('New Post')) 58 - ->appendChild($form) 59 - ->addSubmitButton(pht('Continue')); 60 - 61 - } 62 - 63 - }
+98
src/applications/phame/view/PhameBlogListView.php
··· 1 + <?php 2 + 3 + final class PhameBlogListView extends AphrontTagView { 4 + 5 + private $blogs; 6 + private $viewer; 7 + 8 + public function setBlogs($blogs) { 9 + assert_instances_of($blogs, 'PhameBlog'); 10 + $this->blogs = $blogs; 11 + return $this; 12 + } 13 + 14 + public function setViewer($viewer) { 15 + $this->viewer = $viewer; 16 + return $this; 17 + } 18 + 19 + protected function getTagAttributes() { 20 + $classes = array(); 21 + $classes[] = 'phame-blog-list'; 22 + return array('class' => implode(' ', $classes)); 23 + } 24 + 25 + protected function getTagContent() { 26 + require_celerity_resource('phame-css'); 27 + Javelin::initBehavior('phabricator-tooltips'); 28 + 29 + $list = array(); 30 + foreach ($this->blogs as $blog) { 31 + $image_uri = $blog->getProfileImageURI(); 32 + $image = phutil_tag( 33 + 'a', 34 + array( 35 + 'class' => 'phame-blog-list-image', 36 + 'style' => 'background-image: url('.$image_uri.');', 37 + 'href' => $blog->getViewURI(), 38 + )); 39 + 40 + $title = phutil_tag( 41 + 'a', 42 + array( 43 + 'class' => 'phame-blog-list-title', 44 + 'href' => $blog->getViewURI(), 45 + ), 46 + $blog->getName()); 47 + 48 + $icon = id(new PHUIIconView()) 49 + ->setIconFont('fa-plus-square') 50 + ->addClass('phame-blog-list-icon'); 51 + 52 + $add_new = phutil_tag( 53 + 'a', 54 + array( 55 + 'href' => '/phame/post/edit/?blog='.$blog->getID(), 56 + 'class' => 'phame-blog-list-new-post', 57 + 'sigil' => 'has-tooltip', 58 + 'meta' => array('tip' => pht('New Post')), 59 + ), 60 + $icon); 61 + 62 + $list[] = phutil_tag( 63 + 'div', 64 + array( 65 + 'class' => 'phame-blog-list-item', 66 + ), 67 + array( 68 + $image, 69 + $title, 70 + $add_new, 71 + )); 72 + } 73 + 74 + if (empty($list)) { 75 + $list = phutil_tag( 76 + 'a', 77 + array( 78 + 'href' => '/phame/blog/new/', 79 + ), 80 + pht('Create a Blog')); 81 + } 82 + 83 + $header = phutil_tag( 84 + 'h4', 85 + array( 86 + 'class' => 'phame-blog-list-header', 87 + ), 88 + phutil_tag( 89 + 'a', 90 + array( 91 + 'href' => '/phame/blog/', 92 + ), 93 + pht('Blogs'))); 94 + 95 + return array($header, $list); 96 + } 97 + 98 + }
+30 -7
src/view/phui/PHUITwoColumnView.php
··· 4 4 5 5 private $mainColumn; 6 6 private $sideColumn; 7 + private $display; 8 + 9 + const DISPLAY_LEFT = 'phui-side-column-left'; 10 + const DISPLAY_RIGHT = 'phui-side-column-right'; 7 11 8 12 public function setMainColumn($main) { 9 13 $this->mainColumn = $main; ··· 15 19 return $this; 16 20 } 17 21 22 + public function setDisplay($display) { 23 + $this->display = $display; 24 + return $this; 25 + } 26 + 27 + public function getDisplay() { 28 + if ($this->display) { 29 + return $this->display; 30 + } else { 31 + return self::DISPLAY_RIGHT; 32 + } 33 + } 34 + 18 35 protected function getTagAttributes() { 36 + $classes = array(); 37 + $classes[] = 'phui-two-column-view'; 38 + $classes[] = 'grouped'; 39 + $classes[] = $this->getDisplay(); 40 + 19 41 return array( 20 - 'class' => 'phui-two-column-view grouped', 42 + 'class' => implode(' ', $classes), 21 43 ); 22 44 } 23 45 ··· 38 60 ), 39 61 $this->sideColumn); 40 62 41 - return phutil_tag_div( 42 - 'phui-two-column-row', 43 - array( 44 - $main, 45 - $side, 46 - )); 63 + if ($this->getDisplay() == self::DISPLAY_LEFT) { 64 + $order = array($side, $main); 65 + } else { 66 + $order = array($main, $side); 67 + } 68 + 69 + return phutil_tag_div('phui-two-column-row', $order); 47 70 } 48 71 }
+97
webroot/rsrc/css/application/phame/phame.css
··· 34 34 border-top: 1px solid rgba(71, 87, 120, 0.20); 35 35 padding-top: 16px; 36 36 } 37 + 38 + .phame-home-view .phui-document-view.phui-document-view-pro { 39 + margin: 0; 40 + } 41 + 42 + .phame-home-view .phui-side-column { 43 + background-color: #fff; 44 + } 45 + 46 + .device .phame-home-view .phui-side-column { 47 + background-color: transparent; 48 + } 49 + 50 + .phame-blog-list { 51 + margin: 24px 16px 16px 16px; 52 + padding: 16px; 53 + background-color: {$bluebackground}; 54 + border-radius: 3px; 55 + } 56 + 57 + .device .phame-blog-list { 58 + background-color: #fff; 59 + padding: 8px; 60 + } 61 + 62 + .phame-blog-list-item:last-child { 63 + margin-bottom: 0; 64 + } 65 + 66 + .phame-blog-list-header { 67 + font-size: {$biggerfontsize}; 68 + margin-bottom: 16px; 69 + } 70 + 71 + .phame-blog-list-header a { 72 + color: {$darkbluetext}; 73 + } 74 + 75 + .phame-blog-list-item { 76 + display: block; 77 + color: {$darkgreytext}; 78 + height: 24px; 79 + position: relative; 80 + margin-bottom: 8px; 81 + padding-right: 20px; 82 + } 83 + 84 + .phame-blog-list-title:hover { 85 + color: {$indigo}; 86 + text-decoration: none; 87 + } 88 + 89 + .phame-blog-list-image { 90 + display: inline-block; 91 + background-repeat: no-repeat; 92 + background-size: 100%; 93 + box-shadow: inset 0 0 0 1px rgba(55,55,55,.15); 94 + width: 24px; 95 + height: 24px; 96 + border-radius: 3px; 97 + position: absolute; 98 + } 99 + 100 + .phame-blog-list-title { 101 + margin-left: 30px; 102 + margin-top: 4px; 103 + display: inline-block; 104 + font-weight: bold; 105 + color: {$bluetext}; 106 + width: 190px; 107 + overflow: hidden; 108 + white-space: nowrap; 109 + text-overflow: ellipsis; 110 + } 111 + 112 + .phame-blog-list-new-post { 113 + display: block; 114 + position: absolute; 115 + top: 6px; 116 + right: 0; 117 + } 118 + 119 + .phame-blog-list-new-post:hover { 120 + color: {$indigo}; 121 + text-decoration: none; 122 + } 123 + 124 + .phame-blog-list-new-post:hover .phame-blog-list-icon { 125 + color: {$indigo}; 126 + } 127 + 128 + .phame-blog-list-icon { 129 + display: block; 130 + height: 14px; 131 + width: 14px; 132 + color: {$lightbluetext}; 133 + }