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

Separate out PhameDescriptionView

Summary: Make this function re-usable in other views. Ref T9897

Test Plan: View a blog, see the same information

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T9897

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

+74 -46
+2
src/__phutil_library_map__.php
··· 3319 3319 'PhameController' => 'applications/phame/controller/PhameController.php', 3320 3320 'PhameCreatePostConduitAPIMethod' => 'applications/phame/conduit/PhameCreatePostConduitAPIMethod.php', 3321 3321 'PhameDAO' => 'applications/phame/storage/PhameDAO.php', 3322 + 'PhameDescriptionView' => 'applications/phame/view/PhameDescriptionView.php', 3322 3323 'PhameHomeController' => 'applications/phame/controller/PhameHomeController.php', 3323 3324 'PhamePost' => 'applications/phame/storage/PhamePost.php', 3324 3325 'PhamePostCommentController' => 'applications/phame/controller/post/PhamePostCommentController.php', ··· 7649 7650 'PhameController' => 'PhabricatorController', 7650 7651 'PhameCreatePostConduitAPIMethod' => 'PhameConduitAPIMethod', 7651 7652 'PhameDAO' => 'PhabricatorLiskDAO', 7653 + 'PhameDescriptionView' => 'AphrontTagView', 7652 7654 'PhameHomeController' => 'PhamePostController', 7653 7655 'PhamePost' => array( 7654 7656 'PhameDAO',
+12 -46
src/applications/phame/controller/blog/PhameBlogViewController.php
··· 73 73 ->setHeader($header) 74 74 ->appendChild($post_list); 75 75 76 - $description = $this->renderDescription($blog, $viewer); 77 - 78 - return $this->newPage() 79 - ->setTitle($blog->getName()) 80 - ->setCrumbs($crumbs) 81 - ->appendChild( 82 - array( 83 - $page, 84 - $description, 85 - )); 86 - } 87 - 88 - private function renderDescription( 89 - PhameBlog $blog, 90 - PhabricatorUser $viewer) { 91 - 92 - require_celerity_resource('phame-css'); 93 - 76 + $description = null; 94 77 if (strlen($blog->getDescription())) { 95 78 $description = PhabricatorMarkupEngine::renderOneObject( 96 79 id(new PhabricatorMarkupOneOff())->setContent($blog->getDescription()), ··· 100 83 $description = phutil_tag('em', array(), pht('No description.')); 101 84 } 102 85 103 - $picture = $blog->getProfileImageURI(); 104 - $description = phutil_tag_div( 105 - 'phame-blog-description-content', $description); 106 - 107 - $image = phutil_tag( 108 - 'div', 109 - array( 110 - 'class' => 'phame-blog-description-image', 111 - 'style' => 'background-image: url('.$picture.');', 112 - )); 86 + $about = id(new PhameDescriptionView()) 87 + ->setTitle($blog->getName()) 88 + ->setDescription($description) 89 + ->setImage($blog->getProfileImageURI()); 113 90 114 - $header = phutil_tag( 115 - 'div', 116 - array( 117 - 'class' => 'phame-blog-description-name', 118 - ), 119 - pht('About %s', $blog->getName())); 120 - 121 - $view = phutil_tag( 122 - 'div', 123 - array( 124 - 'class' => 'phame-blog-description', 125 - ), 126 - array( 127 - $image, 128 - $header, 129 - $description, 91 + return $this->newPage() 92 + ->setTitle($blog->getName()) 93 + ->setCrumbs($crumbs) 94 + ->appendChild( 95 + array( 96 + $page, 97 + $about, 130 98 )); 131 - 132 - return $view; 133 99 } 134 100 135 101 private function renderActions(PhameBlog $blog, PhabricatorUser $viewer) {
+60
src/applications/phame/view/PhameDescriptionView.php
··· 1 + <?php 2 + 3 + final class PhameDescriptionView extends AphrontTagView { 4 + 5 + private $title; 6 + private $description; 7 + private $image; 8 + private $imageHref; 9 + 10 + public function setTitle($title) { 11 + $this->title = $title; 12 + return $this; 13 + } 14 + 15 + public function setDescription($description) { 16 + $this->description = $description; 17 + return $this; 18 + } 19 + 20 + public function setImage($image) { 21 + $this->image = $image; 22 + return $this; 23 + } 24 + 25 + public function setImageHref($href) { 26 + $this->imageHref = $href; 27 + return $this; 28 + } 29 + 30 + protected function getTagAttributes() { 31 + $classes = array(); 32 + $classes[] = 'phame-blog-description'; 33 + return array('class' => implode(' ', $classes)); 34 + } 35 + 36 + protected function getTagContent() { 37 + require_celerity_resource('phame-css'); 38 + 39 + $description = phutil_tag_div( 40 + 'phame-blog-description-content', $this->description); 41 + 42 + $image = phutil_tag( 43 + ($this->imageHref) ? 'a' : 'div', 44 + array( 45 + 'class' => 'phame-blog-description-image', 46 + 'style' => 'background-image: url('.$this->image.');', 47 + 'href' => $this->imageHref, 48 + )); 49 + 50 + $header = phutil_tag( 51 + 'div', 52 + array( 53 + 'class' => 'phame-blog-description-name', 54 + ), 55 + pht('About %s', $this->title)); 56 + 57 + return array($image, $header, $description); 58 + } 59 + 60 + }