mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +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:
parent
7c80257a57
commit
015ead6e7b
5 changed files with 40 additions and 0 deletions
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE {$NAMESPACE}_phame.phame_post
|
||||
ADD subtitle VARCHAR(64) NOT NULL COLLATE {$COLLATE_TEXT};
|
|
@ -99,6 +99,14 @@ final class PhamePostEditEngine
|
|||
->setConduitTypeDescription(pht('New post title.'))
|
||||
->setTransactionType(PhamePostTransaction::TYPE_TITLE)
|
||||
->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())
|
||||
->setKey('visibility')
|
||||
->setLabel(pht('Visibility'))
|
||||
|
|
|
@ -16,6 +16,7 @@ final class PhamePostEditor
|
|||
|
||||
$types[] = PhamePostTransaction::TYPE_BLOG;
|
||||
$types[] = PhamePostTransaction::TYPE_TITLE;
|
||||
$types[] = PhamePostTransaction::TYPE_SUBTITLE;
|
||||
$types[] = PhamePostTransaction::TYPE_BODY;
|
||||
$types[] = PhamePostTransaction::TYPE_VISIBILITY;
|
||||
$types[] = PhabricatorTransactions::TYPE_COMMENT;
|
||||
|
@ -32,6 +33,8 @@ final class PhamePostEditor
|
|||
return $object->getBlogPHID();
|
||||
case PhamePostTransaction::TYPE_TITLE:
|
||||
return $object->getTitle();
|
||||
case PhamePostTransaction::TYPE_SUBTITLE:
|
||||
return $object->getSubtitle();
|
||||
case PhamePostTransaction::TYPE_BODY:
|
||||
return $object->getBody();
|
||||
case PhamePostTransaction::TYPE_VISIBILITY:
|
||||
|
@ -45,6 +48,7 @@ final class PhamePostEditor
|
|||
|
||||
switch ($xaction->getTransactionType()) {
|
||||
case PhamePostTransaction::TYPE_TITLE:
|
||||
case PhamePostTransaction::TYPE_SUBTITLE:
|
||||
case PhamePostTransaction::TYPE_BODY:
|
||||
case PhamePostTransaction::TYPE_VISIBILITY:
|
||||
case PhamePostTransaction::TYPE_BLOG:
|
||||
|
@ -59,6 +63,8 @@ final class PhamePostEditor
|
|||
switch ($xaction->getTransactionType()) {
|
||||
case PhamePostTransaction::TYPE_TITLE:
|
||||
return $object->setTitle($xaction->getNewValue());
|
||||
case PhamePostTransaction::TYPE_SUBTITLE:
|
||||
return $object->setSubtitle($xaction->getNewValue());
|
||||
case PhamePostTransaction::TYPE_BODY:
|
||||
return $object->setBody($xaction->getNewValue());
|
||||
case PhamePostTransaction::TYPE_BLOG:
|
||||
|
@ -84,6 +90,7 @@ final class PhamePostEditor
|
|||
|
||||
switch ($xaction->getTransactionType()) {
|
||||
case PhamePostTransaction::TYPE_TITLE:
|
||||
case PhamePostTransaction::TYPE_SUBTITLE:
|
||||
case PhamePostTransaction::TYPE_BODY:
|
||||
case PhamePostTransaction::TYPE_VISIBILITY:
|
||||
case PhamePostTransaction::TYPE_BLOG:
|
||||
|
|
|
@ -18,6 +18,7 @@ final class PhamePost extends PhameDAO
|
|||
|
||||
protected $bloggerPHID;
|
||||
protected $title;
|
||||
protected $subtitle;
|
||||
protected $phameTitle;
|
||||
protected $body;
|
||||
protected $visibility;
|
||||
|
@ -122,6 +123,7 @@ final class PhamePost extends PhameDAO
|
|||
),
|
||||
self::CONFIG_COLUMN_SCHEMA => array(
|
||||
'title' => 'text255',
|
||||
'subtitle' => 'text64',
|
||||
'phameTitle' => 'sort64?',
|
||||
'visibility' => 'uint32',
|
||||
'mailKey' => 'bytes20',
|
||||
|
|
|
@ -4,6 +4,7 @@ final class PhamePostTransaction
|
|||
extends PhabricatorApplicationTransaction {
|
||||
|
||||
const TYPE_TITLE = 'phame.post.title';
|
||||
const TYPE_SUBTITLE = 'phame.post.subtitle';
|
||||
const TYPE_BODY = 'phame.post.body';
|
||||
const TYPE_VISIBILITY = 'phame.post.visibility';
|
||||
const TYPE_BLOG = 'phame.post.blog';
|
||||
|
@ -94,6 +95,7 @@ final class PhamePostTransaction
|
|||
$tags[] = self::MAILTAG_SUBSCRIBERS;
|
||||
break;
|
||||
case self::TYPE_TITLE:
|
||||
case self::TYPE_SUBTITLE:
|
||||
case self::TYPE_BODY:
|
||||
$tags[] = self::MAILTAG_CONTENT;
|
||||
break;
|
||||
|
@ -136,6 +138,19 @@ final class PhamePostTransaction
|
|||
$new);
|
||||
}
|
||||
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:
|
||||
return pht(
|
||||
'%s updated the blog post.',
|
||||
|
@ -195,6 +210,12 @@ final class PhamePostTransaction
|
|||
$this->renderHandleLink($object_phid));
|
||||
}
|
||||
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:
|
||||
return pht(
|
||||
'%s updated the blog post %s.',
|
||||
|
|
Loading…
Reference in a new issue