1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-30 01:10:58 +01:00

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
This commit is contained in:
Chad Little 2016-04-04 13:37:44 -07:00
parent 968a75b579
commit 0b54810ba1
3 changed files with 36 additions and 27 deletions

View file

@ -49,20 +49,26 @@ final class PassphraseCredentialCreateController extends PassphraseController {
$crumbs = $this->buildApplicationCrumbs(); $crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Create')); $crumbs->addTextCrumb(pht('Create'));
$crumbs->setBorder(true);
$box = id(new PHUIObjectBoxView()) $box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Create New Credential')) ->setHeaderText(pht('Credential'))
->setFormErrors($errors) ->setFormErrors($errors)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setForm($form); ->setForm($form);
return $this->buildApplicationPage( $header = id(new PHUIHeaderView())
array( ->setHeader($title)
$crumbs, ->setHeaderIcon('fa-plus-square');
$box,
), $view = id(new PHUITwoColumnView())
array( ->setHeader($header)
'title' => $title, ->setFooter($box);
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($view);
} }
} }

View file

@ -311,20 +311,21 @@ final class PassphraseCredentialEditController extends PassphraseController {
} }
$crumbs = $this->buildApplicationCrumbs(); $crumbs = $this->buildApplicationCrumbs();
$crumbs->setBorder(true);
if ($is_new) { if ($is_new) {
$title = pht('Create Credential'); $title = pht('Create New Credential');
$header = pht('Create New Credential');
$crumbs->addTextCrumb(pht('Create')); $crumbs->addTextCrumb(pht('Create'));
$cancel_uri = $this->getApplicationURI(); $cancel_uri = $this->getApplicationURI();
$header_icon = 'fa-plus-square';
} else { } else {
$title = pht('Edit Credential'); $title = pht('Edit Credential: %s', $credential->getName());
$header = pht('Edit Credential %s', 'K'.$credential->getID());
$crumbs->addTextCrumb( $crumbs->addTextCrumb(
'K'.$credential->getID(), 'K'.$credential->getID(),
'/K'.$credential->getID()); '/K'.$credential->getID());
$crumbs->addTextCrumb(pht('Edit')); $crumbs->addTextCrumb(pht('Edit'));
$cancel_uri = '/K'.$credential->getID(); $cancel_uri = '/K'.$credential->getID();
$header_icon = 'fa-pencil';
} }
if ($request->isAjax()) { if ($request->isAjax()) {
@ -332,16 +333,13 @@ final class PassphraseCredentialEditController extends PassphraseController {
$errors = id(new PHUIInfoView())->setErrors($errors); $errors = id(new PHUIInfoView())->setErrors($errors);
} }
$dialog = id(new AphrontDialogView()) return $this->newDialog()
->setUser($viewer)
->setWidth(AphrontDialogView::WIDTH_FORM) ->setWidth(AphrontDialogView::WIDTH_FORM)
->setTitle($title) ->setTitle($title)
->appendChild($errors) ->appendChild($errors)
->appendChild($form->buildLayoutView()) ->appendChild($form->buildLayoutView())
->addSubmitButton(pht('Create Credential')) ->addSubmitButton(pht('Create Credential'))
->addCancelButton($cancel_uri); ->addCancelButton($cancel_uri);
return id(new AphrontDialogResponse())->setDialog($dialog);
} }
$form->appendChild( $form->appendChild(
@ -350,19 +348,26 @@ final class PassphraseCredentialEditController extends PassphraseController {
->addCancelButton($cancel_uri)); ->addCancelButton($cancel_uri));
$box = id(new PHUIObjectBoxView()) $box = id(new PHUIObjectBoxView())
->setHeaderText($header) ->setHeaderText(pht('Credential'))
->setFormErrors($errors) ->setFormErrors($errors)
->setValidationException($validation_exception) ->setValidationException($validation_exception)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setForm($form); ->setForm($form);
return $this->buildApplicationPage( $header = id(new PHUIHeaderView())
array( ->setHeader($title)
$crumbs, ->setHeaderIcon($header_icon);
$view = id(new PHUITwoColumnView())
->setHeader($header)
->setFooter(array(
$box, $box,
),
array(
'title' => $title,
)); ));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($view);
} }
private function getCredentialType($type_const) { private function getCredentialType($type_const) {

View file

@ -40,14 +40,12 @@ final class PassphraseCredentialPublicController
->setReadOnly(true) ->setReadOnly(true)
->setValue($public_key)); ->setValue($public_key));
$dialog = id(new AphrontDialogView()) return $this->newDialog()
->setUser($viewer)
->setWidth(AphrontDialogView::WIDTH_FORM) ->setWidth(AphrontDialogView::WIDTH_FORM)
->setTitle(pht('Public Key (%s)', $credential->getMonogram())) ->setTitle(pht('Public Key (%s)', $credential->getMonogram()))
->appendChild($body) ->appendChild($body)
->addCancelButton($view_uri, pht('Done')); ->addCancelButton($view_uri, pht('Done'));
return id(new AphrontDialogResponse())->setDialog($dialog);
} }
} }