Skip to content

Commit b74c7a3

Browse files
committed
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
1 parent 2ee4507 commit b74c7a3

File tree

64 files changed

+107
-457
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+107
-457
lines changed

resources/celerity/map.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
return array(
88
'names' =>
99
array(
10-
'core.pkg.css' => '3c41daee',
10+
'core.pkg.css' => '9567aaae',
1111
'core.pkg.js' => 'c907bd96',
1212
'darkconsole.pkg.js' => 'ca8671ce',
1313
'differential.pkg.css' => '827749c1',
@@ -23,7 +23,7 @@
2323
'rsrc/css/aphront/context-bar.css' => '1c3b0529',
2424
'rsrc/css/aphront/dark-console.css' => '6378ef3d',
2525
'rsrc/css/aphront/dialog-view.css' => 'dd9db96c',
26-
'rsrc/css/aphront/error-view.css' => '472968e0',
26+
'rsrc/css/aphront/error-view.css' => 'ca515eae',
2727
'rsrc/css/aphront/lightbox-attachment.css' => '686f8885',
2828
'rsrc/css/aphront/list-filter-view.css' => '9577c6da',
2929
'rsrc/css/aphront/multi-column.css' => '05bbd016',
@@ -475,7 +475,7 @@
475475
'aphront-contextbar-view-css' => '1c3b0529',
476476
'aphront-dark-console-css' => '6378ef3d',
477477
'aphront-dialog-view-css' => 'dd9db96c',
478-
'aphront-error-view-css' => '472968e0',
478+
'aphront-error-view-css' => 'ca515eae',
479479
'aphront-list-filter-view-css' => '9577c6da',
480480
'aphront-multi-column-view-css' => '05bbd016',
481481
'aphront-notes' => '6acadd3f',

src/applications/auth/controller/PhabricatorAuthRegisterController.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,6 @@ public function processRequest() {
304304
unset($unguarded);
305305
}
306306

307-
$error_view = null;
308-
if ($errors) {
309-
$error_view = new AphrontErrorView();
310-
$error_view->setTitle(pht('Registration Failed'));
311-
$error_view->setErrors($errors);
312-
}
313-
314307
$form = id(new AphrontFormView())
315308
->setUser($request->getUser());
316309

@@ -424,7 +417,7 @@ public function processRequest() {
424417
$object_box = id(new PHUIObjectBoxView())
425418
->setHeaderText($title)
426419
->setForm($form)
427-
->setFormError($error_view);
420+
->setFormErrors($errors);
428421

429422
return $this->buildApplicationPage(
430423
array(

src/applications/auth/controller/config/PhabricatorAuthEditController.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,6 @@ public function processRequest() {
153153
$issues = array();
154154
}
155155

156-
if ($errors) {
157-
$errors = id(new AphrontErrorView())->setErrors($errors);
158-
}
159-
160156
if ($is_new) {
161157
$button = pht('Add Provider');
162158
$crumb = pht('Add Provider');
@@ -302,7 +298,7 @@ public function processRequest() {
302298

303299
$form_box = id(new PHUIObjectBoxView())
304300
->setHeaderText($title)
305-
->setFormError($errors)
301+
->setFormErrors($errors)
306302
->setForm($form);
307303

308304
return $this->buildApplicationPage(

src/applications/auth/controller/config/PhabricatorAuthNewController.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ public function processRequest() {
3737
}
3838
}
3939

40-
if ($errors) {
41-
$errors = id(new AphrontErrorView())->setErrors($errors);
42-
}
43-
4440
$options = id(new AphrontFormRadioButtonControl())
4541
->setLabel(pht('Provider'))
4642
->setName('provider')
@@ -83,7 +79,7 @@ public function processRequest() {
8379

8480
$form_box = id(new PHUIObjectBoxView())
8581
->setHeaderText(pht('Add Authentication Provider'))
86-
->setFormError($errors)
82+
->setFormErrors($errors)
8783
->setForm($form);
8884

8985
$crumbs = $this->buildApplicationCrumbs();

src/applications/calendar/controller/PhabricatorCalendarEditStatusController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public function processRequest() {
165165

166166
$form_box = id(new PHUIObjectBoxView())
167167
->setHeaderText($page_title)
168-
->setFormError($error_view)
168+
->setFormErrors($errors)
169169
->setForm($form);
170170

171171
$nav = $this->buildSideNavView($status);

src/applications/conduit/controller/PhabricatorConduitConsoleController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function processRequest() {
112112

113113
$form_box = id(new PHUIObjectBoxView())
114114
->setHeaderText($method->getAPIMethodName())
115-
->setFormError($status_view)
115+
->setErrorView($status_view)
116116
->setForm($form);
117117

118118
$crumbs = $this->buildApplicationCrumbs();

src/applications/config/controller/PhabricatorConfigEditController.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,12 @@ public function processRequest() {
195195

196196
$form_box = id(new PHUIObjectBoxView())
197197
->setHeaderText($title)
198-
->setFormError($error_view)
199198
->setForm($form);
200199

200+
if ($error_view) {
201+
$form_box->setErrorView($error_view);
202+
}
203+
201204
$crumbs = $this->buildApplicationCrumbs();
202205
$crumbs->addTextCrumb(pht('Config'), $this->getApplicationURI());
203206

src/applications/countdown/controller/PhabricatorCountdownEditController.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public function processRequest() {
3535
$countdown = PhabricatorCountdown::initializeNewCountdown($user);
3636
}
3737

38-
$error_view = null;
3938
$e_text = true;
4039
$e_epoch = null;
4140

@@ -71,11 +70,6 @@ public function processRequest() {
7170
$countdown->save();
7271
return id(new AphrontRedirectResponse())
7372
->setURI('/countdown/'.$countdown->getID().'/');
74-
} else {
75-
$error_view = id(new AphrontErrorView())
76-
->setErrors($errors)
77-
->setTitle(pht('It\'s not The Final Countdown (du nu nuuu nun)' .
78-
' until you fix these problem'));
7973
}
8074
}
8175

@@ -135,7 +129,7 @@ public function processRequest() {
135129

136130
$form_box = id(new PHUIObjectBoxView())
137131
->setHeaderText($page_title)
138-
->setFormError($error_view)
132+
->setFormErrors($errors)
139133
->setForm($form);
140134

141135
return $this->buildApplicationPage(

src/applications/differential/controller/DifferentialDiffCreateController.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,8 @@ public function processRequest() {
8484

8585
$form_box = id(new PHUIObjectBoxView())
8686
->setHeaderText(pht('Create New Diff'))
87-
->setForm($form);
88-
89-
if ($errors) {
90-
$error_view = id(new AphrontErrorView())
91-
->setSeverity(AphrontErrorView::SEVERITY_ERROR)
92-
->appendChild($errors);
93-
$form_box->setFormError($error_view);
94-
}
87+
->setForm($form)
88+
->setFormErrors($errors);
9589

9690
$crumbs = $this->buildApplicationCrumbs();
9791
$crumbs->addTextCrumb(pht('Create Diff'));

src/applications/differential/controller/DifferentialRevisionEditController.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,6 @@ public function processRequest() {
108108
$form->setAction('/differential/revision/edit/');
109109
}
110110

111-
$error_view = null;
112-
if ($errors) {
113-
$error_view = id(new AphrontErrorView())
114-
->setTitle(pht('Form Errors'))
115-
->setErrors($errors);
116-
}
117-
118111
if ($diff && $revision->getID()) {
119112
$form
120113
->appendChild(
@@ -168,7 +161,7 @@ public function processRequest() {
168161

169162
$form_box = id(new PHUIObjectBoxView())
170163
->setHeaderText($title)
171-
->setFormError($error_view)
164+
->setFormErrors($errors)
172165
->setForm($form);
173166

174167
$crumbs->addTextCrumb($title);

src/applications/diffusion/controller/DiffusionCommitController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public function processRequest() {
269269
->appendChild(
270270
pht("This commit is very large. Load each file individually."));
271271

272-
$change_panel->setFormError($warning_view);
272+
$change_panel->setErrorView($warning_view);
273273
$header->addActionLink($button);
274274
}
275275

src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,6 @@ public function processRequest() {
8383
$crumbs->addTextCrumb(pht('Edit Basics'));
8484

8585
$title = pht('Edit %s', $repository->getName());
86-
87-
$error_view = null;
88-
if ($errors) {
89-
$error_view = id(new AphrontErrorView())
90-
->setTitle(pht('Form Errors'))
91-
->setErrors($errors);
92-
}
93-
9486
$project_handles = $this->loadViewerHandles($repository->getProjectPHIDs());
9587

9688
$form = id(new AphrontFormView())
@@ -122,7 +114,7 @@ public function processRequest() {
122114
$object_box = id(new PHUIObjectBoxView())
123115
->setHeaderText($title)
124116
->setForm($form)
125-
->setFormError($error_view);
117+
->setFormErrors($errors);
126118

127119
return $this->buildApplicationPage(
128120
array(

src/applications/diffusion/controller/DiffusionRepositoryEditEncodingController.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,6 @@ public function processRequest() {
6161

6262
$title = pht('Edit %s', $repository->getName());
6363

64-
$error_view = null;
65-
if ($errors) {
66-
$error_view = id(new AphrontErrorView())
67-
->setTitle(pht('Form Errors'))
68-
->setErrors($errors);
69-
}
70-
7164
$form = id(new AphrontFormView())
7265
->setUser($user)
7366
->appendRemarkupInstructions($this->getEncodingInstructions())
@@ -85,7 +78,7 @@ public function processRequest() {
8578
$object_box = id(new PHUIObjectBoxView())
8679
->setHeaderText($title)
8780
->setForm($form)
88-
->setFormError($error_view);
81+
->setFormErrors($errors);
8982

9083
return $this->buildApplicationPage(
9184
array(

src/applications/diffusion/controller/DiffusionRepositoryEditLocalController.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,6 @@ public function processRequest() {
3333

3434
$title = pht('Edit %s', $repository->getName());
3535

36-
$error_view = null;
37-
if ($errors) {
38-
$error_view = id(new AphrontErrorView())
39-
->setTitle(pht('Form Errors'))
40-
->setErrors($errors);
41-
}
42-
4336
$form = id(new AphrontFormView())
4437
->setUser($user)
4538
->appendRemarkupInstructions(
@@ -61,7 +54,7 @@ public function processRequest() {
6154
$object_box = id(new PHUIObjectBoxView())
6255
->setHeaderText($title)
6356
->setForm($form)
64-
->setFormError($error_view);
57+
->setFormErrors($errors);
6558

6659
return $this->buildApplicationPage(
6760
array(

src/applications/diffusion/panel/DiffusionSetPasswordPanel.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,6 @@ public function processRequest(AphrontRequest $request) {
8686

8787
$title = pht('Set VCS Password');
8888

89-
$error_view = null;
90-
if ($errors) {
91-
$error_view = id(new AphrontErrorView())
92-
->setTitle(pht('Form Errors'))
93-
->setErrors($errors);
94-
}
95-
9689
$form = id(new AphrontFormView())
9790
->setUser($user)
9891
->appendRemarkupInstructions(
@@ -165,7 +158,7 @@ public function processRequest(AphrontRequest $request) {
165158
$object_box = id(new PHUIObjectBoxView())
166159
->setHeaderText($title)
167160
->setForm($form)
168-
->setFormError($error_view);
161+
->setFormErrors($errors);
169162

170163
$remove_form = id(new AphrontFormView())
171164
->setUser($user);

src/applications/drydock/controller/DrydockBlueprintCreateController.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,6 @@ public function processRequest() {
2929
}
3030
}
3131

32-
$error_view = null;
33-
if ($errors) {
34-
$error_view = id(new AphrontErrorView())
35-
->setErrors($errors);
36-
}
37-
3832
$control = id(new AphrontFormRadioButtonControl())
3933
->setName('blueprint-type')
4034
->setLabel(pht('Blueprint Type'))
@@ -69,7 +63,7 @@ public function processRequest() {
6963
->setValue(pht('Continue')));
7064

7165
$box = id(new PHUIObjectBoxView())
72-
->setFormError($error_view)
66+
->setFormErrors($errors)
7367
->setHeaderText($title)
7468
->setForm($form);
7569

src/applications/drydock/controller/DrydockBlueprintEditController.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,6 @@ public function processRequest() {
8686
}
8787
}
8888

89-
$error_view = null;
90-
if ($errors) {
91-
$error_view = id(new AphrontErrorView())->setErrors($errors);
92-
}
93-
9489
$policies = id(new PhabricatorPolicyQuery())
9590
->setViewer($viewer)
9691
->setObject($blueprint)
@@ -144,7 +139,7 @@ public function processRequest() {
144139

145140
$box = id(new PHUIObjectBoxView())
146141
->setHeaderText($header)
147-
->setFormError($error_view)
142+
->setFormErrors($errors)
148143
->setForm($form);
149144

150145
return $this->buildApplicationPage(

src/applications/files/controller/PhabricatorFileUploadController.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,12 @@ public function processRequest() {
6464

6565
$title = pht('Upload File');
6666

67-
if ($errors) {
68-
$errors = id(new AphrontErrorView())
69-
->setTitle(pht('Form Errors'))
70-
->setErrors($errors);
71-
}
72-
7367
$global_upload = id(new PhabricatorGlobalUploadTargetView())
7468
->setShowIfSupportedID($support_id);
7569

7670
$form_box = id(new PHUIObjectBoxView())
7771
->setHeaderText($title)
78-
->setFormError($errors)
72+
->setFormErrors($errors)
7973
->setForm($form);
8074

8175
return $this->buildApplicationPage(

src/applications/herald/controller/HeraldNewController.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,6 @@ public function processRequest() {
9898
$content_type = $request->getStr('content_type');
9999
$rule_type = $request->getStr('rule_type');
100100

101-
if ($errors) {
102-
$errors = id(new AphrontErrorView())->setErrors($errors);
103-
}
104-
105101
$form = id(new AphrontFormView())
106102
->setUser($viewer)
107103
->setAction($this->getApplicationURI('new/'));
@@ -203,7 +199,7 @@ public function processRequest() {
203199
->addCancelButton($cancel_uri, $cancel_text));
204200

205201
$form_box = id(new PHUIObjectBoxView())
206-
->setFormError($errors)
202+
->setFormErrors($errors)
207203
->setHeaderText(pht('Create Herald Rule'))
208204
->setForm($form);
209205

src/applications/herald/controller/HeraldRuleController.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,6 @@ public function processRequest() {
118118
}
119119
}
120120

121-
if ($errors) {
122-
$error_view = new AphrontErrorView();
123-
$error_view->setTitle(pht('Form Errors'));
124-
$error_view->setErrors($errors);
125-
} else {
126-
$error_view = null;
127-
}
128-
129121
$must_match_selector = $this->renderMustMatchSelector($rule);
130122
$repetition_selector = $this->renderRepetitionSelector($rule, $adapter);
131123

@@ -233,7 +225,7 @@ public function processRequest() {
233225

234226
$form_box = id(new PHUIObjectBoxView())
235227
->setHeaderText($title)
236-
->setFormError($error_view)
228+
->setFormErrors($errors)
237229
->setForm($form);
238230

239231
$crumbs = $this

0 commit comments

Comments
 (0)