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

Add subtitle to PhamePost

Summary: No view engine yet (adding header image next), but adds subtitle to display like PhameBlog

Test Plan: Add a subtitle, remove a subtitle.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D16871
This commit is contained in:
Chad Little 2016-11-15 11:48:31 -08:00
parent 7c80257a57
commit 015ead6e7b
5 changed files with 40 additions and 0 deletions

View file

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

View file

@ -99,6 +99,14 @@ final class PhamePostEditEngine
->setConduitTypeDescription(pht('New post title.')) ->setConduitTypeDescription(pht('New post title.'))
->setTransactionType(PhamePostTransaction::TYPE_TITLE) ->setTransactionType(PhamePostTransaction::TYPE_TITLE)
->setValue($object->getTitle()), ->setValue($object->getTitle()),
id(new PhabricatorTextEditField())
->setKey('subtitle')
->setLabel(pht('Subtitle'))
->setDescription(pht('Post subtitle.'))
->setConduitDescription(pht('Change the post subtitle.'))
->setConduitTypeDescription(pht('New post subtitle.'))
->setTransactionType(PhamePostTransaction::TYPE_SUBTITLE)
->setValue($object->getSubtitle()),
id(new PhabricatorSelectEditField()) id(new PhabricatorSelectEditField())
->setKey('visibility') ->setKey('visibility')
->setLabel(pht('Visibility')) ->setLabel(pht('Visibility'))

View file

@ -16,6 +16,7 @@ final class PhamePostEditor
$types[] = PhamePostTransaction::TYPE_BLOG; $types[] = PhamePostTransaction::TYPE_BLOG;
$types[] = PhamePostTransaction::TYPE_TITLE; $types[] = PhamePostTransaction::TYPE_TITLE;
$types[] = PhamePostTransaction::TYPE_SUBTITLE;
$types[] = PhamePostTransaction::TYPE_BODY; $types[] = PhamePostTransaction::TYPE_BODY;
$types[] = PhamePostTransaction::TYPE_VISIBILITY; $types[] = PhamePostTransaction::TYPE_VISIBILITY;
$types[] = PhabricatorTransactions::TYPE_COMMENT; $types[] = PhabricatorTransactions::TYPE_COMMENT;
@ -32,6 +33,8 @@ final class PhamePostEditor
return $object->getBlogPHID(); return $object->getBlogPHID();
case PhamePostTransaction::TYPE_TITLE: case PhamePostTransaction::TYPE_TITLE:
return $object->getTitle(); return $object->getTitle();
case PhamePostTransaction::TYPE_SUBTITLE:
return $object->getSubtitle();
case PhamePostTransaction::TYPE_BODY: case PhamePostTransaction::TYPE_BODY:
return $object->getBody(); return $object->getBody();
case PhamePostTransaction::TYPE_VISIBILITY: case PhamePostTransaction::TYPE_VISIBILITY:
@ -45,6 +48,7 @@ final class PhamePostEditor
switch ($xaction->getTransactionType()) { switch ($xaction->getTransactionType()) {
case PhamePostTransaction::TYPE_TITLE: case PhamePostTransaction::TYPE_TITLE:
case PhamePostTransaction::TYPE_SUBTITLE:
case PhamePostTransaction::TYPE_BODY: case PhamePostTransaction::TYPE_BODY:
case PhamePostTransaction::TYPE_VISIBILITY: case PhamePostTransaction::TYPE_VISIBILITY:
case PhamePostTransaction::TYPE_BLOG: case PhamePostTransaction::TYPE_BLOG:
@ -59,6 +63,8 @@ final class PhamePostEditor
switch ($xaction->getTransactionType()) { switch ($xaction->getTransactionType()) {
case PhamePostTransaction::TYPE_TITLE: case PhamePostTransaction::TYPE_TITLE:
return $object->setTitle($xaction->getNewValue()); return $object->setTitle($xaction->getNewValue());
case PhamePostTransaction::TYPE_SUBTITLE:
return $object->setSubtitle($xaction->getNewValue());
case PhamePostTransaction::TYPE_BODY: case PhamePostTransaction::TYPE_BODY:
return $object->setBody($xaction->getNewValue()); return $object->setBody($xaction->getNewValue());
case PhamePostTransaction::TYPE_BLOG: case PhamePostTransaction::TYPE_BLOG:
@ -84,6 +90,7 @@ final class PhamePostEditor
switch ($xaction->getTransactionType()) { switch ($xaction->getTransactionType()) {
case PhamePostTransaction::TYPE_TITLE: case PhamePostTransaction::TYPE_TITLE:
case PhamePostTransaction::TYPE_SUBTITLE:
case PhamePostTransaction::TYPE_BODY: case PhamePostTransaction::TYPE_BODY:
case PhamePostTransaction::TYPE_VISIBILITY: case PhamePostTransaction::TYPE_VISIBILITY:
case PhamePostTransaction::TYPE_BLOG: case PhamePostTransaction::TYPE_BLOG:

View file

@ -18,6 +18,7 @@ final class PhamePost extends PhameDAO
protected $bloggerPHID; protected $bloggerPHID;
protected $title; protected $title;
protected $subtitle;
protected $phameTitle; protected $phameTitle;
protected $body; protected $body;
protected $visibility; protected $visibility;
@ -122,6 +123,7 @@ final class PhamePost extends PhameDAO
), ),
self::CONFIG_COLUMN_SCHEMA => array( self::CONFIG_COLUMN_SCHEMA => array(
'title' => 'text255', 'title' => 'text255',
'subtitle' => 'text64',
'phameTitle' => 'sort64?', 'phameTitle' => 'sort64?',
'visibility' => 'uint32', 'visibility' => 'uint32',
'mailKey' => 'bytes20', 'mailKey' => 'bytes20',

View file

@ -4,6 +4,7 @@ final class PhamePostTransaction
extends PhabricatorApplicationTransaction { extends PhabricatorApplicationTransaction {
const TYPE_TITLE = 'phame.post.title'; const TYPE_TITLE = 'phame.post.title';
const TYPE_SUBTITLE = 'phame.post.subtitle';
const TYPE_BODY = 'phame.post.body'; const TYPE_BODY = 'phame.post.body';
const TYPE_VISIBILITY = 'phame.post.visibility'; const TYPE_VISIBILITY = 'phame.post.visibility';
const TYPE_BLOG = 'phame.post.blog'; const TYPE_BLOG = 'phame.post.blog';
@ -94,6 +95,7 @@ final class PhamePostTransaction
$tags[] = self::MAILTAG_SUBSCRIBERS; $tags[] = self::MAILTAG_SUBSCRIBERS;
break; break;
case self::TYPE_TITLE: case self::TYPE_TITLE:
case self::TYPE_SUBTITLE:
case self::TYPE_BODY: case self::TYPE_BODY:
$tags[] = self::MAILTAG_CONTENT; $tags[] = self::MAILTAG_CONTENT;
break; break;
@ -136,6 +138,19 @@ final class PhamePostTransaction
$new); $new);
} }
break; break;
case self::TYPE_SUBTITLE:
if ($old === null) {
return pht(
'%s set the post\'s subtitle to "%s".',
$this->renderHandleLink($author_phid),
$new);
} else {
return pht(
'%s updated the post\'s subtitle to "%s".',
$this->renderHandleLink($author_phid),
$new);
}
break;
case self::TYPE_BODY: case self::TYPE_BODY:
return pht( return pht(
'%s updated the blog post.', '%s updated the blog post.',
@ -195,6 +210,12 @@ final class PhamePostTransaction
$this->renderHandleLink($object_phid)); $this->renderHandleLink($object_phid));
} }
break; break;
case self::TYPE_SUBTITLE:
return pht(
'%s updated the subtitle for %s.',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
break;
case self::TYPE_BODY: case self::TYPE_BODY:
return pht( return pht(
'%s updated the blog post %s.', '%s updated the blog post %s.',