1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-20 12:30:56 +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->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);
}
}

View file

@ -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) {

View file

@ -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);
}
}