Commit b74c7a3d authored by Chad Little's avatar Chad Little
Browse files

Simplify PHUIObjectBoxViews handling of Save and Error states

Summary: This removes the bulk of the "Form Errors" text, some variations likely exists. These are a bit redundant and space consuming. I'd also like to back ErrorView more into PHUIObjectBox.

Test Plan: Test out the forms, see errors without the text.

Reviewers: epriestley, btrahan

CC: Korvin, epriestley, aran, hach-que

Differential Revision: https://secure.phabricator.com/D7924
parent 2ee45074
......@@ -7,7 +7,7 @@
return array(
'names' =>
array(
'core.pkg.css' => '3c41daee',
'core.pkg.css' => '9567aaae',
'core.pkg.js' => 'c907bd96',
'darkconsole.pkg.js' => 'ca8671ce',
'differential.pkg.css' => '827749c1',
......@@ -23,7 +23,7 @@ return array(
'rsrc/css/aphront/context-bar.css' => '1c3b0529',
'rsrc/css/aphront/dark-console.css' => '6378ef3d',
'rsrc/css/aphront/dialog-view.css' => 'dd9db96c',
'rsrc/css/aphront/error-view.css' => '472968e0',
'rsrc/css/aphront/error-view.css' => 'ca515eae',
'rsrc/css/aphront/lightbox-attachment.css' => '686f8885',
'rsrc/css/aphront/list-filter-view.css' => '9577c6da',
'rsrc/css/aphront/multi-column.css' => '05bbd016',
......@@ -475,7 +475,7 @@ return array(
'aphront-contextbar-view-css' => '1c3b0529',
'aphront-dark-console-css' => '6378ef3d',
'aphront-dialog-view-css' => 'dd9db96c',
'aphront-error-view-css' => '472968e0',
'aphront-error-view-css' => 'ca515eae',
'aphront-list-filter-view-css' => '9577c6da',
'aphront-multi-column-view-css' => '05bbd016',
'aphront-notes' => '6acadd3f',
......
......@@ -304,13 +304,6 @@ final class PhabricatorAuthRegisterController
unset($unguarded);
}
$error_view = null;
if ($errors) {
$error_view = new AphrontErrorView();
$error_view->setTitle(pht('Registration Failed'));
$error_view->setErrors($errors);
}
$form = id(new AphrontFormView())
->setUser($request->getUser());
......@@ -424,7 +417,7 @@ final class PhabricatorAuthRegisterController
$object_box = id(new PHUIObjectBoxView())
->setHeaderText($title)
->setForm($form)
->setFormError($error_view);
->setFormErrors($errors);
return $this->buildApplicationPage(
array(
......
......@@ -153,10 +153,6 @@ final class PhabricatorAuthEditController
$issues = array();
}
if ($errors) {
$errors = id(new AphrontErrorView())->setErrors($errors);
}
if ($is_new) {
$button = pht('Add Provider');
$crumb = pht('Add Provider');
......@@ -302,7 +298,7 @@ final class PhabricatorAuthEditController
$form_box = id(new PHUIObjectBoxView())
->setHeaderText($title)
->setFormError($errors)
->setFormErrors($errors)
->setForm($form);
return $this->buildApplicationPage(
......
......@@ -37,10 +37,6 @@ final class PhabricatorAuthNewController
}
}
if ($errors) {
$errors = id(new AphrontErrorView())->setErrors($errors);
}
$options = id(new AphrontFormRadioButtonControl())
->setLabel(pht('Provider'))
->setName('provider')
......@@ -83,7 +79,7 @@ final class PhabricatorAuthNewController
$form_box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Add Authentication Provider'))
->setFormError($errors)
->setFormErrors($errors)
->setForm($form);
$crumbs = $this->buildApplicationCrumbs();
......
......@@ -165,7 +165,7 @@ final class PhabricatorCalendarEditStatusController
$form_box = id(new PHUIObjectBoxView())
->setHeaderText($page_title)
->setFormError($error_view)
->setFormErrors($errors)
->setForm($form);
$nav = $this->buildSideNavView($status);
......
......@@ -112,7 +112,7 @@ final class PhabricatorConduitConsoleController
$form_box = id(new PHUIObjectBoxView())
->setHeaderText($method->getAPIMethodName())
->setFormError($status_view)
->setErrorView($status_view)
->setForm($form);
$crumbs = $this->buildApplicationCrumbs();
......
......@@ -195,9 +195,12 @@ final class PhabricatorConfigEditController
$form_box = id(new PHUIObjectBoxView())
->setHeaderText($title)
->setFormError($error_view)
->setForm($form);
if ($error_view) {
$form_box->setErrorView($error_view);
}
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Config'), $this->getApplicationURI());
......
......@@ -35,7 +35,6 @@ final class PhabricatorCountdownEditController
$countdown = PhabricatorCountdown::initializeNewCountdown($user);
}
$error_view = null;
$e_text = true;
$e_epoch = null;
......@@ -71,11 +70,6 @@ final class PhabricatorCountdownEditController
$countdown->save();
return id(new AphrontRedirectResponse())
->setURI('/countdown/'.$countdown->getID().'/');
} else {
$error_view = id(new AphrontErrorView())
->setErrors($errors)
->setTitle(pht('It\'s not The Final Countdown (du nu nuuu nun)' .
' until you fix these problem'));
}
}
......@@ -135,7 +129,7 @@ final class PhabricatorCountdownEditController
$form_box = id(new PHUIObjectBoxView())
->setHeaderText($page_title)
->setFormError($error_view)
->setFormErrors($errors)
->setForm($form);
return $this->buildApplicationPage(
......
......@@ -84,14 +84,8 @@ final class DifferentialDiffCreateController extends DifferentialController {
$form_box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Create New Diff'))
->setForm($form);
if ($errors) {
$error_view = id(new AphrontErrorView())
->setSeverity(AphrontErrorView::SEVERITY_ERROR)
->appendChild($errors);
$form_box->setFormError($error_view);
}
->setForm($form)
->setFormErrors($errors);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Create Diff'));
......
......@@ -108,13 +108,6 @@ final class DifferentialRevisionEditController extends DifferentialController {
$form->setAction('/differential/revision/edit/');
}
$error_view = null;
if ($errors) {
$error_view = id(new AphrontErrorView())
->setTitle(pht('Form Errors'))
->setErrors($errors);
}
if ($diff && $revision->getID()) {
$form
->appendChild(
......@@ -168,7 +161,7 @@ final class DifferentialRevisionEditController extends DifferentialController {
$form_box = id(new PHUIObjectBoxView())
->setHeaderText($title)
->setFormError($error_view)
->setFormErrors($errors)
->setForm($form);
$crumbs->addTextCrumb($title);
......
......@@ -269,7 +269,7 @@ final class DiffusionCommitController extends DiffusionController {
->appendChild(
pht("This commit is very large. Load each file individually."));
$change_panel->setFormError($warning_view);
$change_panel->setErrorView($warning_view);
$header->addActionLink($button);
}
......
......@@ -83,14 +83,6 @@ final class DiffusionRepositoryEditBasicController
$crumbs->addTextCrumb(pht('Edit Basics'));
$title = pht('Edit %s', $repository->getName());
$error_view = null;
if ($errors) {
$error_view = id(new AphrontErrorView())
->setTitle(pht('Form Errors'))
->setErrors($errors);
}
$project_handles = $this->loadViewerHandles($repository->getProjectPHIDs());
$form = id(new AphrontFormView())
......@@ -122,7 +114,7 @@ final class DiffusionRepositoryEditBasicController
$object_box = id(new PHUIObjectBoxView())
->setHeaderText($title)
->setForm($form)
->setFormError($error_view);
->setFormErrors($errors);
return $this->buildApplicationPage(
array(
......
......@@ -61,13 +61,6 @@ final class DiffusionRepositoryEditEncodingController
$title = pht('Edit %s', $repository->getName());
$error_view = null;
if ($errors) {
$error_view = id(new AphrontErrorView())
->setTitle(pht('Form Errors'))
->setErrors($errors);
}
$form = id(new AphrontFormView())
->setUser($user)
->appendRemarkupInstructions($this->getEncodingInstructions())
......@@ -85,7 +78,7 @@ final class DiffusionRepositoryEditEncodingController
$object_box = id(new PHUIObjectBoxView())
->setHeaderText($title)
->setForm($form)
->setFormError($error_view);
->setFormErrors($errors);
return $this->buildApplicationPage(
array(
......
......@@ -33,13 +33,6 @@ final class DiffusionRepositoryEditLocalController
$title = pht('Edit %s', $repository->getName());
$error_view = null;
if ($errors) {
$error_view = id(new AphrontErrorView())
->setTitle(pht('Form Errors'))
->setErrors($errors);
}
$form = id(new AphrontFormView())
->setUser($user)
->appendRemarkupInstructions(
......@@ -61,7 +54,7 @@ final class DiffusionRepositoryEditLocalController
$object_box = id(new PHUIObjectBoxView())
->setHeaderText($title)
->setForm($form)
->setFormError($error_view);
->setFormErrors($errors);
return $this->buildApplicationPage(
array(
......
......@@ -86,13 +86,6 @@ final class DiffusionSetPasswordPanel extends PhabricatorSettingsPanel {
$title = pht('Set VCS Password');
$error_view = null;
if ($errors) {
$error_view = id(new AphrontErrorView())
->setTitle(pht('Form Errors'))
->setErrors($errors);
}
$form = id(new AphrontFormView())
->setUser($user)
->appendRemarkupInstructions(
......@@ -165,7 +158,7 @@ final class DiffusionSetPasswordPanel extends PhabricatorSettingsPanel {
$object_box = id(new PHUIObjectBoxView())
->setHeaderText($title)
->setForm($form)
->setFormError($error_view);
->setFormErrors($errors);
$remove_form = id(new AphrontFormView())
->setUser($user);
......
......@@ -29,12 +29,6 @@ final class DrydockBlueprintCreateController
}
}
$error_view = null;
if ($errors) {
$error_view = id(new AphrontErrorView())
->setErrors($errors);
}
$control = id(new AphrontFormRadioButtonControl())
->setName('blueprint-type')
->setLabel(pht('Blueprint Type'))
......@@ -69,7 +63,7 @@ final class DrydockBlueprintCreateController
->setValue(pht('Continue')));
$box = id(new PHUIObjectBoxView())
->setFormError($error_view)
->setFormErrors($errors)
->setHeaderText($title)
->setForm($form);
......
......@@ -86,11 +86,6 @@ final class DrydockBlueprintEditController extends DrydockBlueprintController {
}
}
$error_view = null;
if ($errors) {
$error_view = id(new AphrontErrorView())->setErrors($errors);
}
$policies = id(new PhabricatorPolicyQuery())
->setViewer($viewer)
->setObject($blueprint)
......@@ -144,7 +139,7 @@ final class DrydockBlueprintEditController extends DrydockBlueprintController {
$box = id(new PHUIObjectBoxView())
->setHeaderText($header)
->setFormError($error_view)
->setFormErrors($errors)
->setForm($form);
return $this->buildApplicationPage(
......
......@@ -64,18 +64,12 @@ final class PhabricatorFileUploadController extends PhabricatorFileController {
$title = pht('Upload File');
if ($errors) {
$errors = id(new AphrontErrorView())
->setTitle(pht('Form Errors'))
->setErrors($errors);
}
$global_upload = id(new PhabricatorGlobalUploadTargetView())
->setShowIfSupportedID($support_id);
$form_box = id(new PHUIObjectBoxView())
->setHeaderText($title)
->setFormError($errors)
->setFormErrors($errors)
->setForm($form);
return $this->buildApplicationPage(
......
......@@ -98,10 +98,6 @@ final class HeraldNewController extends HeraldController {
$content_type = $request->getStr('content_type');
$rule_type = $request->getStr('rule_type');
if ($errors) {
$errors = id(new AphrontErrorView())->setErrors($errors);
}
$form = id(new AphrontFormView())
->setUser($viewer)
->setAction($this->getApplicationURI('new/'));
......@@ -203,7 +199,7 @@ final class HeraldNewController extends HeraldController {
->addCancelButton($cancel_uri, $cancel_text));
$form_box = id(new PHUIObjectBoxView())
->setFormError($errors)
->setFormErrors($errors)
->setHeaderText(pht('Create Herald Rule'))
->setForm($form);
......
......@@ -118,14 +118,6 @@ final class HeraldRuleController extends HeraldController {
}
}
if ($errors) {
$error_view = new AphrontErrorView();
$error_view->setTitle(pht('Form Errors'));
$error_view->setErrors($errors);
} else {
$error_view = null;
}
$must_match_selector = $this->renderMustMatchSelector($rule);
$repetition_selector = $this->renderRepetitionSelector($rule, $adapter);
......@@ -233,7 +225,7 @@ final class HeraldRuleController extends HeraldController {
$form_box = id(new PHUIObjectBoxView())
->setHeaderText($title)
->setFormError($error_view)
->setFormErrors($errors)
->setForm($form);
$crumbs = $this
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment