1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 00:32:42 +01:00

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
This commit is contained in:
Chad Little 2016-06-18 14:21:39 +00:00 committed by chad
parent 96c51028e5
commit 20affe9ce8
8 changed files with 104 additions and 8 deletions

View file

@ -81,7 +81,7 @@ return array(
'rsrc/css/application/owners/owners-path-editor.css' => '2f00933b',
'rsrc/css/application/paste/paste.css' => '1898e534',
'rsrc/css/application/people/people-profile.css' => '2473d929',
'rsrc/css/application/phame/phame.css' => 'dfdaec0e',
'rsrc/css/application/phame/phame.css' => '4748d928',
'rsrc/css/application/pholio/pholio-edit.css' => '07676f51',
'rsrc/css/application/pholio/pholio-inline-comments.css' => '8e545e49',
'rsrc/css/application/pholio/pholio.css' => 'ca89d380',
@ -808,7 +808,7 @@ return array(
'phabricator-uiexample-reactor-sendclass' => '1def2711',
'phabricator-uiexample-reactor-sendproperties' => 'b1f0ccee',
'phabricator-zindex-css' => '5b6fcf3f',
'phame-css' => 'dfdaec0e',
'phame-css' => '4748d928',
'pholio-css' => 'ca89d380',
'pholio-edit-css' => '07676f51',
'pholio-inline-comments-css' => '8e545e49',

View file

@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_phame.phame_blog
ADD subtitle VARCHAR(64) NOT NULL COLLATE {$COLLATE_TEXT};

View file

@ -32,10 +32,10 @@ final class PhameBlogViewController extends PhameLiveController {
$posts = $post_query->executeWithCursorPager($pager);
$hero = $this->buildHeaderImage($blog);
$hero = $this->buildPhameHeader($blog);
$header = id(new PHUIHeaderView())
->setHeader($blog->getName())
->addClass('phame-header-bar')
->setUser($viewer);
if (!$is_external) {
@ -155,11 +155,12 @@ final class PhameBlogViewController extends PhameLiveController {
return $actions;
}
private function buildHeaderImage(
private function buildPhameHeader(
PhameBlog $blog) {
$image = null;
if ($blog->getHeaderImagePHID()) {
$view = phutil_tag(
$image = phutil_tag(
'div',
array(
'class' => 'phame-header-hero',
@ -170,9 +171,17 @@ final class PhameBlogViewController extends PhameLiveController {
'src' => $blog->getHeaderImageURI(),
'class' => 'phame-header-image',
)));
return $view;
}
return null;
$title = phutil_tag_div('phame-header-title', $blog->getName());
$subtitle = null;
if ($blog->getSubtitle()) {
$subtitle = phutil_tag_div('phame-header-subtitle', $blog->getSubtitle());
}
return phutil_tag_div(
'phame-mega-header', array($image, $title, $subtitle));
}
}

View file

@ -77,6 +77,14 @@ final class PhameBlogEditEngine
->setConduitTypeDescription(pht('New blog title.'))
->setTransactionType(PhameBlogTransaction::TYPE_NAME)
->setValue($object->getName()),
id(new PhabricatorTextEditField())
->setKey('subtitle')
->setLabel(pht('Subtitle'))
->setDescription(pht('Blog subtitle.'))
->setConduitDescription(pht('Change the blog subtitle.'))
->setConduitTypeDescription(pht('New blog subtitle.'))
->setTransactionType(PhameBlogTransaction::TYPE_SUBTITLE)
->setValue($object->getSubtitle()),
id(new PhabricatorRemarkupEditField())
->setKey('description')
->setLabel(pht('Description'))

View file

@ -15,6 +15,7 @@ final class PhameBlogEditor
$types = parent::getTransactionTypes();
$types[] = PhameBlogTransaction::TYPE_NAME;
$types[] = PhameBlogTransaction::TYPE_SUBTITLE;
$types[] = PhameBlogTransaction::TYPE_DESCRIPTION;
$types[] = PhameBlogTransaction::TYPE_DOMAIN;
$types[] = PhameBlogTransaction::TYPE_STATUS;
@ -31,6 +32,8 @@ final class PhameBlogEditor
switch ($xaction->getTransactionType()) {
case PhameBlogTransaction::TYPE_NAME:
return $object->getName();
case PhameBlogTransaction::TYPE_SUBTITLE:
return $object->getSubtitle();
case PhameBlogTransaction::TYPE_DESCRIPTION:
return $object->getDescription();
case PhameBlogTransaction::TYPE_DOMAIN:
@ -46,6 +49,7 @@ final class PhameBlogEditor
switch ($xaction->getTransactionType()) {
case PhameBlogTransaction::TYPE_NAME:
case PhameBlogTransaction::TYPE_SUBTITLE:
case PhameBlogTransaction::TYPE_DESCRIPTION:
case PhameBlogTransaction::TYPE_STATUS:
return $xaction->getNewValue();
@ -65,6 +69,8 @@ final class PhameBlogEditor
switch ($xaction->getTransactionType()) {
case PhameBlogTransaction::TYPE_NAME:
return $object->setName($xaction->getNewValue());
case PhameBlogTransaction::TYPE_SUBTITLE:
return $object->setSubtitle($xaction->getNewValue());
case PhameBlogTransaction::TYPE_DESCRIPTION:
return $object->setDescription($xaction->getNewValue());
case PhameBlogTransaction::TYPE_DOMAIN:
@ -82,6 +88,7 @@ final class PhameBlogEditor
switch ($xaction->getTransactionType()) {
case PhameBlogTransaction::TYPE_NAME:
case PhameBlogTransaction::TYPE_SUBTITLE:
case PhameBlogTransaction::TYPE_DESCRIPTION:
case PhameBlogTransaction::TYPE_DOMAIN:
case PhameBlogTransaction::TYPE_STATUS:

View file

@ -15,6 +15,7 @@ final class PhameBlog extends PhameDAO
const MARKUP_FIELD_DESCRIPTION = 'markup:description';
protected $name;
protected $subtitle;
protected $description;
protected $domain;
protected $configData;
@ -40,6 +41,7 @@ final class PhameBlog extends PhameDAO
),
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'text64',
'subtitle' => 'text64',
'description' => 'text',
'domain' => 'text128?',
'status' => 'text32',

View file

@ -4,6 +4,7 @@ final class PhameBlogTransaction
extends PhabricatorApplicationTransaction {
const TYPE_NAME = 'phame.blog.name';
const TYPE_SUBTITLE = 'phame.blog.subtitle';
const TYPE_DESCRIPTION = 'phame.blog.description';
const TYPE_DOMAIN = 'phame.blog.domain';
const TYPE_STATUS = 'phame.blog.status';
@ -80,6 +81,7 @@ final class PhameBlogTransaction
$tags[] = self::MAILTAG_SUBSCRIBERS;
break;
case self::TYPE_NAME:
case self::TYPE_SUBTITLE:
case self::TYPE_DESCRIPTION:
case self::TYPE_DOMAIN:
$tags[] = self::MAILTAG_DETAILS;
@ -116,6 +118,19 @@ final class PhameBlogTransaction
$new);
}
break;
case self::TYPE_SUBTITLE:
if ($old === null) {
return pht(
'%s set this blog\'s subtitle to "%s".',
$this->renderHandleLink($author_phid),
$new);
} else {
return pht(
'%s updated the blog\'s subtitle to "%s".',
$this->renderHandleLink($author_phid),
$new);
}
break;
case self::TYPE_DESCRIPTION:
return pht(
'%s updated the blog\'s description.',
@ -166,6 +181,19 @@ final class PhameBlogTransaction
$this->renderHandleLink($object_phid));
}
break;
case self::TYPE_SUBTITLE:
if ($old === null) {
return pht(
'%s set the subtitle for %s.',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
} else {
return pht(
'%s updated the subtitle for %s.',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
}
break;
case self::TYPE_DESCRIPTION:
return pht(
'%s updated the description for %s.',

View file

@ -261,3 +261,43 @@
max-width: 100%;
margin: 0 auto;
}
.phui-document-view.phui-document-view-pro .phui-header-shell.phame-header-bar {
border-top: 1px solid {$thinblueborder};
border-bottom: none;
padding: 4px 0;
}
.phame-header-bar .phui-header-subheader {
margin: 0;
}
.phame-mega-header {
margin: 0 auto;
text-align: center;
background: #fff;
padding: 16px 0 24px;
}
.device-phone .phame-mega-header {
padding: 24px 0;
}
.phame-mega-header .phame-header-title {
color: #000;
font-size: 28px;
font-weight: bold;
font-family: 'Aleo', {$fontfamily};
padding-top: 24px;
}
.device-phone .phame-mega-header .phame-header-title {
padding-top: 0;
}
.phame-mega-header .phame-header-subtitle {
color: {$greytext};
font-size: 20px;
font-family: 'Aleo', {$fontfamily};
padding-top: 8px;
}