1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-20 04:20:55 +01:00

Update Countdown edit page for new UI

Summary: Modernizes Countdown edit page

Test Plan: New countdown, edit countdown

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D15558
This commit is contained in:
Chad Little 2016-04-01 14:13:58 +00:00 committed by chad
parent 25c4101349
commit a22d37f447

View file

@ -8,7 +8,6 @@ final class PhabricatorCountdownEditController
$id = $request->getURIData('id'); $id = $request->getURIData('id');
if ($id) { if ($id) {
$page_title = pht('Edit Countdown');
$countdown = id(new PhabricatorCountdownQuery()) $countdown = id(new PhabricatorCountdownQuery())
->setViewer($viewer) ->setViewer($viewer)
->withIDs(array($id)) ->withIDs(array($id))
@ -28,8 +27,9 @@ final class PhabricatorCountdownEditController
$countdown->getPHID(), $countdown->getPHID(),
PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);
$v_projects = array_reverse($v_projects); $v_projects = array_reverse($v_projects);
$title = pht('Edit Countdown: %s', $countdown->getTitle());
} else { } else {
$page_title = pht('Create Countdown'); $title = pht('Create Countdown');
$countdown = PhabricatorCountdown::initializeNewCountdown($viewer); $countdown = PhabricatorCountdown::initializeNewCountdown($viewer);
$date_value = AphrontFormDateControlValue::newFromEpoch( $date_value = AphrontFormDateControlValue::newFromEpoch(
$viewer, PhabricatorTime::getNow()); $viewer, PhabricatorTime::getNow());
@ -116,6 +116,7 @@ final class PhabricatorCountdownEditController
} }
$crumbs = $this->buildApplicationCrumbs(); $crumbs = $this->buildApplicationCrumbs();
$crumbs->setBorder(true);
$cancel_uri = '/countdown/'; $cancel_uri = '/countdown/';
if ($countdown->getID()) { if ($countdown->getID()) {
@ -123,9 +124,11 @@ final class PhabricatorCountdownEditController
$crumbs->addTextCrumb('C'.$countdown->getID(), $cancel_uri); $crumbs->addTextCrumb('C'.$countdown->getID(), $cancel_uri);
$crumbs->addTextCrumb(pht('Edit')); $crumbs->addTextCrumb(pht('Edit'));
$submit_label = pht('Save Changes'); $submit_label = pht('Save Changes');
$header_icon = 'fa-pencil';
} else { } else {
$crumbs->addTextCrumb(pht('Create Countdown')); $crumbs->addTextCrumb(pht('Create Countdown'));
$submit_label = pht('Create Countdown'); $submit_label = pht('Create Countdown');
$header_icon = 'fa-plus-square';
} }
$policies = id(new PhabricatorPolicyQuery()) $policies = id(new PhabricatorPolicyQuery())
@ -180,16 +183,25 @@ final class PhabricatorCountdownEditController
->setValue($submit_label)); ->setValue($submit_label));
$form_box = id(new PHUIObjectBoxView()) $form_box = id(new PHUIObjectBoxView())
->setHeaderText($page_title) ->setHeaderText(pht('Countdown'))
->setFormErrors($errors) ->setFormErrors($errors)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setForm($form); ->setForm($form);
$header = id(new PHUIHeaderView())
->setHeader($title)
->setHeaderIcon($header_icon);
$view = id(new PHUITwoColumnView())
->setHeader($header)
->setFooter($form_box);
return $this->newPage() return $this->newPage()
->setTitle($page_title) ->setTitle($title)
->setCrumbs($crumbs) ->setCrumbs($crumbs)
->appendChild( ->appendChild(
array( array(
$form_box, $view,
)); ));
} }