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, Apr 12, 2:11 AM
Unknown Object (File)
Sat, Apr 6, 3:56 PM
Unknown Object (File)
Sat, Apr 6, 3:56 PM
Unknown Object (File)
Sat, Apr 6, 3:56 PM
Unknown Object (File)
Sat, Apr 6, 3:56 PM
Unknown Object (File)
Sat, Apr 6, 3:04 PM
Unknown Object (File)
Sat, Apr 6, 2:42 PM
Unknown Object (File)
Tue, Apr 2, 2:01 AM
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

Lint
Lint Skipped
Unit
Tests Skipped

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.