@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

Add new super hero header for Phame Blog

Summary: Adds a new header layout for Phame Blog. Subtitles now also.

Test Plan:
With Image, With Subtitle, Without Image, Without Subtitle. Mobile, Tablet, Desktop.

{F1691506}

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

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

authored by

Chad Little and committed by
chad
20affe9c 96c51028

+104 -8
+2 -2
resources/celerity/map.php
··· 81 81 'rsrc/css/application/owners/owners-path-editor.css' => '2f00933b', 82 82 'rsrc/css/application/paste/paste.css' => '1898e534', 83 83 'rsrc/css/application/people/people-profile.css' => '2473d929', 84 - 'rsrc/css/application/phame/phame.css' => 'dfdaec0e', 84 + 'rsrc/css/application/phame/phame.css' => '4748d928', 85 85 'rsrc/css/application/pholio/pholio-edit.css' => '07676f51', 86 86 'rsrc/css/application/pholio/pholio-inline-comments.css' => '8e545e49', 87 87 'rsrc/css/application/pholio/pholio.css' => 'ca89d380', ··· 808 808 'phabricator-uiexample-reactor-sendclass' => '1def2711', 809 809 'phabricator-uiexample-reactor-sendproperties' => 'b1f0ccee', 810 810 'phabricator-zindex-css' => '5b6fcf3f', 811 - 'phame-css' => 'dfdaec0e', 811 + 'phame-css' => '4748d928', 812 812 'pholio-css' => 'ca89d380', 813 813 'pholio-edit-css' => '07676f51', 814 814 'pholio-inline-comments-css' => '8e545e49',
+2
resources/sql/autopatches/20160618.phame.blog.subtitle.sql
··· 1 + ALTER TABLE {$NAMESPACE}_phame.phame_blog 2 + ADD subtitle VARCHAR(64) NOT NULL COLLATE {$COLLATE_TEXT};
+15 -6
src/applications/phame/controller/blog/PhameBlogViewController.php
··· 32 32 33 33 $posts = $post_query->executeWithCursorPager($pager); 34 34 35 - $hero = $this->buildHeaderImage($blog); 35 + $hero = $this->buildPhameHeader($blog); 36 36 37 37 $header = id(new PHUIHeaderView()) 38 - ->setHeader($blog->getName()) 38 + ->addClass('phame-header-bar') 39 39 ->setUser($viewer); 40 40 41 41 if (!$is_external) { ··· 155 155 return $actions; 156 156 } 157 157 158 - private function buildHeaderImage( 158 + private function buildPhameHeader( 159 159 PhameBlog $blog) { 160 160 161 + $image = null; 161 162 if ($blog->getHeaderImagePHID()) { 162 - $view = phutil_tag( 163 + $image = phutil_tag( 163 164 'div', 164 165 array( 165 166 'class' => 'phame-header-hero', ··· 170 171 'src' => $blog->getHeaderImageURI(), 171 172 'class' => 'phame-header-image', 172 173 ))); 173 - return $view; 174 + } 175 + 176 + $title = phutil_tag_div('phame-header-title', $blog->getName()); 177 + $subtitle = null; 178 + if ($blog->getSubtitle()) { 179 + $subtitle = phutil_tag_div('phame-header-subtitle', $blog->getSubtitle()); 174 180 } 175 - return null; 181 + 182 + return phutil_tag_div( 183 + 'phame-mega-header', array($image, $title, $subtitle)); 184 + 176 185 } 177 186 178 187 }
+8
src/applications/phame/editor/PhameBlogEditEngine.php
··· 77 77 ->setConduitTypeDescription(pht('New blog title.')) 78 78 ->setTransactionType(PhameBlogTransaction::TYPE_NAME) 79 79 ->setValue($object->getName()), 80 + id(new PhabricatorTextEditField()) 81 + ->setKey('subtitle') 82 + ->setLabel(pht('Subtitle')) 83 + ->setDescription(pht('Blog subtitle.')) 84 + ->setConduitDescription(pht('Change the blog subtitle.')) 85 + ->setConduitTypeDescription(pht('New blog subtitle.')) 86 + ->setTransactionType(PhameBlogTransaction::TYPE_SUBTITLE) 87 + ->setValue($object->getSubtitle()), 80 88 id(new PhabricatorRemarkupEditField()) 81 89 ->setKey('description') 82 90 ->setLabel(pht('Description'))
+7
src/applications/phame/editor/PhameBlogEditor.php
··· 15 15 $types = parent::getTransactionTypes(); 16 16 17 17 $types[] = PhameBlogTransaction::TYPE_NAME; 18 + $types[] = PhameBlogTransaction::TYPE_SUBTITLE; 18 19 $types[] = PhameBlogTransaction::TYPE_DESCRIPTION; 19 20 $types[] = PhameBlogTransaction::TYPE_DOMAIN; 20 21 $types[] = PhameBlogTransaction::TYPE_STATUS; ··· 31 32 switch ($xaction->getTransactionType()) { 32 33 case PhameBlogTransaction::TYPE_NAME: 33 34 return $object->getName(); 35 + case PhameBlogTransaction::TYPE_SUBTITLE: 36 + return $object->getSubtitle(); 34 37 case PhameBlogTransaction::TYPE_DESCRIPTION: 35 38 return $object->getDescription(); 36 39 case PhameBlogTransaction::TYPE_DOMAIN: ··· 46 49 47 50 switch ($xaction->getTransactionType()) { 48 51 case PhameBlogTransaction::TYPE_NAME: 52 + case PhameBlogTransaction::TYPE_SUBTITLE: 49 53 case PhameBlogTransaction::TYPE_DESCRIPTION: 50 54 case PhameBlogTransaction::TYPE_STATUS: 51 55 return $xaction->getNewValue(); ··· 65 69 switch ($xaction->getTransactionType()) { 66 70 case PhameBlogTransaction::TYPE_NAME: 67 71 return $object->setName($xaction->getNewValue()); 72 + case PhameBlogTransaction::TYPE_SUBTITLE: 73 + return $object->setSubtitle($xaction->getNewValue()); 68 74 case PhameBlogTransaction::TYPE_DESCRIPTION: 69 75 return $object->setDescription($xaction->getNewValue()); 70 76 case PhameBlogTransaction::TYPE_DOMAIN: ··· 82 88 83 89 switch ($xaction->getTransactionType()) { 84 90 case PhameBlogTransaction::TYPE_NAME: 91 + case PhameBlogTransaction::TYPE_SUBTITLE: 85 92 case PhameBlogTransaction::TYPE_DESCRIPTION: 86 93 case PhameBlogTransaction::TYPE_DOMAIN: 87 94 case PhameBlogTransaction::TYPE_STATUS:
+2
src/applications/phame/storage/PhameBlog.php
··· 15 15 const MARKUP_FIELD_DESCRIPTION = 'markup:description'; 16 16 17 17 protected $name; 18 + protected $subtitle; 18 19 protected $description; 19 20 protected $domain; 20 21 protected $configData; ··· 40 41 ), 41 42 self::CONFIG_COLUMN_SCHEMA => array( 42 43 'name' => 'text64', 44 + 'subtitle' => 'text64', 43 45 'description' => 'text', 44 46 'domain' => 'text128?', 45 47 'status' => 'text32',
+28
src/applications/phame/storage/PhameBlogTransaction.php
··· 4 4 extends PhabricatorApplicationTransaction { 5 5 6 6 const TYPE_NAME = 'phame.blog.name'; 7 + const TYPE_SUBTITLE = 'phame.blog.subtitle'; 7 8 const TYPE_DESCRIPTION = 'phame.blog.description'; 8 9 const TYPE_DOMAIN = 'phame.blog.domain'; 9 10 const TYPE_STATUS = 'phame.blog.status'; ··· 80 81 $tags[] = self::MAILTAG_SUBSCRIBERS; 81 82 break; 82 83 case self::TYPE_NAME: 84 + case self::TYPE_SUBTITLE: 83 85 case self::TYPE_DESCRIPTION: 84 86 case self::TYPE_DOMAIN: 85 87 $tags[] = self::MAILTAG_DETAILS; ··· 116 118 $new); 117 119 } 118 120 break; 121 + case self::TYPE_SUBTITLE: 122 + if ($old === null) { 123 + return pht( 124 + '%s set this blog\'s subtitle to "%s".', 125 + $this->renderHandleLink($author_phid), 126 + $new); 127 + } else { 128 + return pht( 129 + '%s updated the blog\'s subtitle to "%s".', 130 + $this->renderHandleLink($author_phid), 131 + $new); 132 + } 133 + break; 119 134 case self::TYPE_DESCRIPTION: 120 135 return pht( 121 136 '%s updated the blog\'s description.', ··· 162 177 } else { 163 178 return pht( 164 179 '%s updated the name for %s.', 180 + $this->renderHandleLink($author_phid), 181 + $this->renderHandleLink($object_phid)); 182 + } 183 + break; 184 + case self::TYPE_SUBTITLE: 185 + if ($old === null) { 186 + return pht( 187 + '%s set the subtitle for %s.', 188 + $this->renderHandleLink($author_phid), 189 + $this->renderHandleLink($object_phid)); 190 + } else { 191 + return pht( 192 + '%s updated the subtitle for %s.', 165 193 $this->renderHandleLink($author_phid), 166 194 $this->renderHandleLink($object_phid)); 167 195 }
+40
webroot/rsrc/css/application/phame/phame.css
··· 261 261 max-width: 100%; 262 262 margin: 0 auto; 263 263 } 264 + 265 + .phui-document-view.phui-document-view-pro .phui-header-shell.phame-header-bar { 266 + border-top: 1px solid {$thinblueborder}; 267 + border-bottom: none; 268 + padding: 4px 0; 269 + } 270 + 271 + .phame-header-bar .phui-header-subheader { 272 + margin: 0; 273 + } 274 + 275 + .phame-mega-header { 276 + margin: 0 auto; 277 + text-align: center; 278 + background: #fff; 279 + padding: 16px 0 24px; 280 + } 281 + 282 + .device-phone .phame-mega-header { 283 + padding: 24px 0; 284 + } 285 + 286 + .phame-mega-header .phame-header-title { 287 + color: #000; 288 + font-size: 28px; 289 + font-weight: bold; 290 + font-family: 'Aleo', {$fontfamily}; 291 + padding-top: 24px; 292 + } 293 + 294 + .device-phone .phame-mega-header .phame-header-title { 295 + padding-top: 0; 296 + } 297 + 298 + .phame-mega-header .phame-header-subtitle { 299 + color: {$greytext}; 300 + font-size: 20px; 301 + font-family: 'Aleo', {$fontfamily}; 302 + padding-top: 8px; 303 + }