MozillaFoundation / donate-wagtail

[Legacy] - Wagtail based donation stack
Mozilla Public License 2.0
43 stars 22 forks source link

added custom fru form ID functionality #1753

Closed danielfmiranda closed 1 year ago

danielfmiranda commented 1 year ago

Related PRs/issues #1752

Description

This PR adds a new helper function to the DonationPage model called get_fru_form_id, which give users the ability to render a custom FRU form if needed through the use of the URL parameter form_id.

If a valid form ID is used (8 alphabetical characters), the template context is then updated to use the custom form's ID.

However if the attempted value is invalid or not set at all, then the template context is passed the default FRU form ID instead.

Screenshots

(no form id set) localhost:8000:

image

(valid custom form ID) localhost:8000/?form_id=XVFNMBAK :

image

(invalid form ID) localhost:8000/?form_id=123A / localhost:8000/?form_id= :

image

Steps to test:

  1. Check out this branch
  2. Visit http://localhost:8000, the default form (purple buttons) should appear.
  3. Visit http://localhost:8000/?form_id=XVFNMBAK, a custom form (blue buttons) should appear.
  4. Visit http://localhost:8000/?form_id=, the default form (purple buttons) should appear.
  5. Visit http://localhost:8000/?form_id=, the default form (purple buttons) should appear.
  6. If everything is working as expected, testing is complete! 👍

Checklist

Tests