Page MenuHomePhabricator

Simplify PHUIObjectBoxViews handling of Save and Error states
ClosedPublic

Authored by chad on Jan 9 2014, 9:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jan 10, 6:57 AM
Unknown Object (File)
Thu, Jan 2, 3:39 AM
Unknown Object (File)
Wed, Jan 1, 11:36 PM
Unknown Object (File)
Wed, Jan 1, 11:23 PM
Unknown Object (File)
Tue, Dec 31, 10:53 PM
Unknown Object (File)
Mon, Dec 30, 12:55 AM
Unknown Object (File)
Thu, Dec 26, 1:15 PM
Unknown Object (File)
Fri, Dec 20, 5:28 PM
Tokens
"Doubloon" token, awarded by btrahan.

Details

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.

Diff Detail

Branch
form-title
Lint
Lint Passed
Unit
Tests Passed

Event Timeline

Looks like a regexp went crazy, but the other changes look good.

One thing I think we should do is put a new:

public function setFormErrors($errors) {
  if ($errors) {
    $this->setFormError(id(new ErrorView())->setErrors($errors);
  }
  return $this;
}

...method on ObjectBoxView, and then simplify all the similar constructs that exist elsewhere. Feeling ambitious?

src/applications/people/controller/PhabricatorPeopleEditController.php
220

hahaha

I think if we do setFormErrors and setFormWarnings, then that would be cool, and I could do header treatments on the whole box accordingly. Right now you can just dump any AphrontErrorBox in there.

chad planned changes to this revision.Jan 9 2014, 11:17 PM
chad updated this revision to Unknown Object (????).Jan 10 2014, 5:06 AM
  • change everything everywherey

setFormErrors is a convenience method for viewing an array of errors
setFormSaved is a convenience method for setting a success state
setErrorView lets you dump any ErrorView into the box.

chad requested a review of this revision.Jan 10 2014, 5:11 AM
chad updated this revision to Unknown Object (????).Jan 10 2014, 6:53 AM
  • change everything everywherey
  • Calendar
  • Rebase

Nice, this look awesome -- way cleaner than the old way. Thanks!

Yeah, I'll follow up with a diff for something similar on dialogs.