Page MenuHomePhabricator

Harmonize and unify donation form display
Open, Needs TriagePublic

Description

At the moment, we have two routes (donation/new and donation/add ) and two different presenters (DonationFormViolationPresenter and DonationFormPresenter), that do the same thing, only a bit different. We should have a look at how we could DRY this code up for the following use scenarios:

  • User loads page in browser: No data to fill out, no data is validated
  • User comes from a banner: Payment data is filled out & validated, all other data is ignored their validation state is shown.
  • User manages to place a POST request with invalid data to donation/add, form is shown again with all data filled out and with the invalid fields marked as invalid.

In an ideal world, we could somehow determine which data to validate and which data to ignore, so banners could post various amounts of data to donation/add (so future banners could for example request an email address or leave out the payment type) and donation/new would be a "dumb" presenter for the form template, without any pre-filling or validating going on.