From 0b54810ba120316245a4ced2fc48022307e74214 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Mon, 4 Apr 2016 13:37:44 -0700 Subject: [PATCH] Update Passphrase Edit/Create UI Summary: Updates pages to modern UI, newPage Test Plan: Create Crediential, Edit Credential Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D15612 --- .../PassphraseCredentialCreateController.php | 24 ++++++++----- .../PassphraseCredentialEditController.php | 35 +++++++++++-------- .../PassphraseCredentialPublicController.php | 4 +-- 3 files changed, 36 insertions(+), 27 deletions(-) diff --git a/src/applications/passphrase/controller/PassphraseCredentialCreateController.php b/src/applications/passphrase/controller/PassphraseCredentialCreateController.php index cfddcbcc4a..87afe22cc6 100644 --- a/src/applications/passphrase/controller/PassphraseCredentialCreateController.php +++ b/src/applications/passphrase/controller/PassphraseCredentialCreateController.php @@ -49,20 +49,26 @@ final class PassphraseCredentialCreateController extends PassphraseController { $crumbs = $this->buildApplicationCrumbs(); $crumbs->addTextCrumb(pht('Create')); + $crumbs->setBorder(true); $box = id(new PHUIObjectBoxView()) - ->setHeaderText(pht('Create New Credential')) + ->setHeaderText(pht('Credential')) ->setFormErrors($errors) + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) ->setForm($form); - return $this->buildApplicationPage( - array( - $crumbs, - $box, - ), - array( - 'title' => $title, - )); + $header = id(new PHUIHeaderView()) + ->setHeader($title) + ->setHeaderIcon('fa-plus-square'); + + $view = id(new PHUITwoColumnView()) + ->setHeader($header) + ->setFooter($box); + + return $this->newPage() + ->setTitle($title) + ->setCrumbs($crumbs) + ->appendChild($view); } } diff --git a/src/applications/passphrase/controller/PassphraseCredentialEditController.php b/src/applications/passphrase/controller/PassphraseCredentialEditController.php index 72c21a9e39..4aa687ddc1 100644 --- a/src/applications/passphrase/controller/PassphraseCredentialEditController.php +++ b/src/applications/passphrase/controller/PassphraseCredentialEditController.php @@ -311,20 +311,21 @@ final class PassphraseCredentialEditController extends PassphraseController { } $crumbs = $this->buildApplicationCrumbs(); + $crumbs->setBorder(true); if ($is_new) { - $title = pht('Create Credential'); - $header = pht('Create New Credential'); + $title = pht('Create New Credential'); $crumbs->addTextCrumb(pht('Create')); $cancel_uri = $this->getApplicationURI(); + $header_icon = 'fa-plus-square'; } else { - $title = pht('Edit Credential'); - $header = pht('Edit Credential %s', 'K'.$credential->getID()); + $title = pht('Edit Credential: %s', $credential->getName()); $crumbs->addTextCrumb( 'K'.$credential->getID(), '/K'.$credential->getID()); $crumbs->addTextCrumb(pht('Edit')); $cancel_uri = '/K'.$credential->getID(); + $header_icon = 'fa-pencil'; } if ($request->isAjax()) { @@ -332,16 +333,13 @@ final class PassphraseCredentialEditController extends PassphraseController { $errors = id(new PHUIInfoView())->setErrors($errors); } - $dialog = id(new AphrontDialogView()) - ->setUser($viewer) + return $this->newDialog() ->setWidth(AphrontDialogView::WIDTH_FORM) ->setTitle($title) ->appendChild($errors) ->appendChild($form->buildLayoutView()) ->addSubmitButton(pht('Create Credential')) ->addCancelButton($cancel_uri); - - return id(new AphrontDialogResponse())->setDialog($dialog); } $form->appendChild( @@ -350,19 +348,26 @@ final class PassphraseCredentialEditController extends PassphraseController { ->addCancelButton($cancel_uri)); $box = id(new PHUIObjectBoxView()) - ->setHeaderText($header) + ->setHeaderText(pht('Credential')) ->setFormErrors($errors) ->setValidationException($validation_exception) + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) ->setForm($form); - return $this->buildApplicationPage( - array( - $crumbs, + $header = id(new PHUIHeaderView()) + ->setHeader($title) + ->setHeaderIcon($header_icon); + + $view = id(new PHUITwoColumnView()) + ->setHeader($header) + ->setFooter(array( $box, - ), - array( - 'title' => $title, )); + + return $this->newPage() + ->setTitle($title) + ->setCrumbs($crumbs) + ->appendChild($view); } private function getCredentialType($type_const) { diff --git a/src/applications/passphrase/controller/PassphraseCredentialPublicController.php b/src/applications/passphrase/controller/PassphraseCredentialPublicController.php index 56fc6ac4ae..481d111fd9 100644 --- a/src/applications/passphrase/controller/PassphraseCredentialPublicController.php +++ b/src/applications/passphrase/controller/PassphraseCredentialPublicController.php @@ -40,14 +40,12 @@ final class PassphraseCredentialPublicController ->setReadOnly(true) ->setValue($public_key)); - $dialog = id(new AphrontDialogView()) - ->setUser($viewer) + return $this->newDialog() ->setWidth(AphrontDialogView::WIDTH_FORM) ->setTitle(pht('Public Key (%s)', $credential->getMonogram())) ->appendChild($body) ->addCancelButton($view_uri, pht('Done')); - return id(new AphrontDialogResponse())->setDialog($dialog); } }