mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 11:30:55 +01:00
Add Description field to Countdowns
Summary: Allows countdowns to have a description. Test Plan: Use description, edit description. Check timeline, etc. Reviewers: btrahan, epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D13691
This commit is contained in:
parent
062f38e163
commit
875dc54516
6 changed files with 88 additions and 0 deletions
2
resources/sql/autopatches/20150723.countdown.1.sql
Normal file
2
resources/sql/autopatches/20150723.countdown.1.sql
Normal file
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE {$NAMESPACE}_countdown.countdown
|
||||
ADD description LONGTEXT NOT NULL;
|
|
@ -41,12 +41,14 @@ final class PhabricatorCountdownEditController
|
|||
$e_epoch = null;
|
||||
|
||||
$v_text = $countdown->getTitle();
|
||||
$v_desc = $countdown->getDescription();
|
||||
$v_space = $countdown->getSpacePHID();
|
||||
$v_view = $countdown->getViewPolicy();
|
||||
$v_edit = $countdown->getEditPolicy();
|
||||
|
||||
if ($request->isFormPost()) {
|
||||
$v_text = $request->getStr('title');
|
||||
$v_desc = $request->getStr('description');
|
||||
$v_space = $request->getStr('spacePHID');
|
||||
$date_value = AphrontFormDateControlValue::newFromRequest(
|
||||
$request,
|
||||
|
@ -57,6 +59,7 @@ final class PhabricatorCountdownEditController
|
|||
|
||||
$type_title = PhabricatorCountdownTransaction::TYPE_TITLE;
|
||||
$type_epoch = PhabricatorCountdownTransaction::TYPE_EPOCH;
|
||||
$type_description = PhabricatorCountdownTransaction::TYPE_DESCRIPTION;
|
||||
$type_space = PhabricatorTransactions::TYPE_SPACE;
|
||||
$type_view = PhabricatorTransactions::TYPE_VIEW_POLICY;
|
||||
$type_edit = PhabricatorTransactions::TYPE_EDIT_POLICY;
|
||||
|
@ -71,6 +74,10 @@ final class PhabricatorCountdownEditController
|
|||
->setTransactionType($type_epoch)
|
||||
->setNewValue($date_value);
|
||||
|
||||
$xactions[] = id(new PhabricatorCountdownTransaction())
|
||||
->setTransactionType($type_description)
|
||||
->setNewValue($v_desc);
|
||||
|
||||
$xactions[] = id(new PhabricatorCountdownTransaction())
|
||||
->setTransactionType($type_space)
|
||||
->setNewValue($v_space);
|
||||
|
@ -141,6 +148,11 @@ final class PhabricatorCountdownEditController
|
|||
->setLabel(pht('End Date'))
|
||||
->setError($e_epoch)
|
||||
->setValue($date_value))
|
||||
->appendControl(
|
||||
id(new PhabricatorRemarkupControl())
|
||||
->setName('description')
|
||||
->setLabel(pht('Description'))
|
||||
->setValue($v_desc))
|
||||
->appendControl(
|
||||
id(new AphrontFormPolicyControl())
|
||||
->setName('viewPolicy')
|
||||
|
|
|
@ -123,6 +123,21 @@ final class PhabricatorCountdownViewController
|
|||
pht('Author'),
|
||||
$viewer->renderHandle($countdown->getAuthorPHID()));
|
||||
|
||||
$view->invokeWillRenderEvent();
|
||||
|
||||
$description = $countdown->getDescription();
|
||||
if (strlen($description)) {
|
||||
$description = PhabricatorMarkupEngine::renderOneObject(
|
||||
id(new PhabricatorMarkupOneOff())->setContent($description),
|
||||
'default',
|
||||
$viewer);
|
||||
|
||||
$view->addSectionHeader(
|
||||
pht('Description'),
|
||||
PHUIPropertyListView::ICON_SUMMARY);
|
||||
$view->addTextContent($description);
|
||||
}
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ final class PhabricatorCountdownEditor
|
|||
|
||||
$types[] = PhabricatorCountdownTransaction::TYPE_TITLE;
|
||||
$types[] = PhabricatorCountdownTransaction::TYPE_EPOCH;
|
||||
$types[] = PhabricatorCountdownTransaction::TYPE_DESCRIPTION;
|
||||
|
||||
$types[] = PhabricatorTransactions::TYPE_EDGE;
|
||||
$types[] = PhabricatorTransactions::TYPE_SPACE;
|
||||
|
@ -31,6 +32,8 @@ final class PhabricatorCountdownEditor
|
|||
switch ($xaction->getTransactionType()) {
|
||||
case PhabricatorCountdownTransaction::TYPE_TITLE:
|
||||
return $object->getTitle();
|
||||
case PhabricatorCountdownTransaction::TYPE_DESCRIPTION:
|
||||
return $object->getDescription();
|
||||
case PhabricatorCountdownTransaction::TYPE_EPOCH:
|
||||
return $object->getEpoch();
|
||||
}
|
||||
|
@ -45,6 +48,8 @@ final class PhabricatorCountdownEditor
|
|||
switch ($xaction->getTransactionType()) {
|
||||
case PhabricatorCountdownTransaction::TYPE_TITLE:
|
||||
return $xaction->getNewValue();
|
||||
case PhabricatorCountdownTransaction::TYPE_DESCRIPTION:
|
||||
return $xaction->getNewValue();
|
||||
case PhabricatorCountdownTransaction::TYPE_EPOCH:
|
||||
return $xaction->getNewValue()->getEpoch();
|
||||
}
|
||||
|
@ -61,6 +66,9 @@ final class PhabricatorCountdownEditor
|
|||
case PhabricatorCountdownTransaction::TYPE_TITLE:
|
||||
$object->setTitle($xaction->getNewValue());
|
||||
return;
|
||||
case PhabricatorCountdownTransaction::TYPE_DESCRIPTION:
|
||||
$object->setDescription($xaction->getNewValue());
|
||||
return;
|
||||
case PhabricatorCountdownTransaction::TYPE_EPOCH:
|
||||
$object->setEpoch($xaction->getNewValue());
|
||||
return;
|
||||
|
@ -77,6 +85,8 @@ final class PhabricatorCountdownEditor
|
|||
switch ($type) {
|
||||
case PhabricatorCountdownTransaction::TYPE_TITLE:
|
||||
return;
|
||||
case PhabricatorCountdownTransaction::TYPE_DESCRIPTION:
|
||||
return;
|
||||
case PhabricatorCountdownTransaction::TYPE_EPOCH:
|
||||
return;
|
||||
}
|
||||
|
@ -138,6 +148,8 @@ final class PhabricatorCountdownEditor
|
|||
return array(
|
||||
PhabricatorCountdownTransaction::MAILTAG_TITLE =>
|
||||
pht('Someone changes the countdown title.'),
|
||||
PhabricatorCountdownTransaction::MAILTAG_DESCRIPTION =>
|
||||
pht('Someone changes the countdown description.'),
|
||||
PhabricatorCountdownTransaction::MAILTAG_EPOCH =>
|
||||
pht('Someone changes the countdown end date.'),
|
||||
PhabricatorCountdownTransaction::MAILTAG_OTHER =>
|
||||
|
|
|
@ -13,6 +13,7 @@ final class PhabricatorCountdown extends PhabricatorCountdownDAO
|
|||
protected $title;
|
||||
protected $authorPHID;
|
||||
protected $epoch;
|
||||
protected $description;
|
||||
protected $viewPolicy;
|
||||
protected $editPolicy;
|
||||
|
||||
|
@ -39,6 +40,7 @@ final class PhabricatorCountdown extends PhabricatorCountdownDAO
|
|||
self::CONFIG_AUX_PHID => true,
|
||||
self::CONFIG_COLUMN_SCHEMA => array(
|
||||
'title' => 'text255',
|
||||
'description' => 'text',
|
||||
),
|
||||
) + parent::getConfiguration();
|
||||
}
|
||||
|
|
|
@ -5,9 +5,11 @@ final class PhabricatorCountdownTransaction
|
|||
|
||||
const TYPE_TITLE = 'countdown:title';
|
||||
const TYPE_EPOCH = 'countdown:epoch';
|
||||
const TYPE_DESCRIPTION = 'countdown:description';
|
||||
|
||||
const MAILTAG_TITLE = 'countdown:title';
|
||||
const MAILTAG_EPOCH = 'countdown:epoch';
|
||||
const MAILTAG_DESRICPTION = 'countdown:description';
|
||||
const MAILTAG_OTHER = 'countdown:other';
|
||||
|
||||
public function getApplicationName() {
|
||||
|
@ -43,6 +45,18 @@ final class PhabricatorCountdownTransaction
|
|||
$old,
|
||||
$new);
|
||||
}
|
||||
break;
|
||||
case self::TYPE_DESCRIPTION:
|
||||
if ($old === null) {
|
||||
return pht(
|
||||
'%s set the description of this countdown.',
|
||||
$this->renderHandleLink($author_phid));
|
||||
} else {
|
||||
return pht(
|
||||
'%s edited the description of this countdown.',
|
||||
$this->renderHandleLink($author_phid));
|
||||
}
|
||||
break;
|
||||
case self::TYPE_EPOCH:
|
||||
if ($old === null) {
|
||||
return pht(
|
||||
|
@ -84,6 +98,34 @@ final class PhabricatorCountdownTransaction
|
|||
$this->renderHandleLink($object_phid));
|
||||
}
|
||||
break;
|
||||
case self::TYPE_DESCRIPTION:
|
||||
if ($old === null) {
|
||||
return pht(
|
||||
'%s set the description of %s.',
|
||||
$this->renderHandleLink($author_phid),
|
||||
$this->renderHandleLink($object_phid));
|
||||
|
||||
} else {
|
||||
return pht(
|
||||
'%s edited the description of %s.',
|
||||
$this->renderHandleLink($author_phid),
|
||||
$this->renderHandleLink($object_phid));
|
||||
}
|
||||
break;
|
||||
case self::TYPE_EPOCH:
|
||||
if ($old === null) {
|
||||
return pht(
|
||||
'%s set the end date of %s.',
|
||||
$this->renderHandleLink($author_phid),
|
||||
$this->renderHandleLink($object_phid));
|
||||
|
||||
} else {
|
||||
return pht(
|
||||
'%s edited the end date of %s.',
|
||||
$this->renderHandleLink($author_phid),
|
||||
$this->renderHandleLink($object_phid));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return parent::getTitleForFeed();
|
||||
|
@ -99,6 +141,9 @@ final class PhabricatorCountdownTransaction
|
|||
case self::TYPE_EPOCH:
|
||||
$tags[] = self::MAILTAG_EPOCH;
|
||||
break;
|
||||
case self::TYPE_DESCRIPTION:
|
||||
$tags[] = self::MAILTAG_DESCRIPTION;
|
||||
break;
|
||||
default:
|
||||
$tags[] = self::MAILTAG_OTHER;
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue