Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wizard refactoring #655

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from
Open

Wizard refactoring #655

wants to merge 11 commits into from

Conversation

Hzaakk
Copy link
Collaborator

@Hzaakk Hzaakk commented Jan 13, 2025

Description

Refactored all usage of wizard forms to remove duplicated code

Notes:

  • all instances of the wizard form seemed to be the exact same, with the only exception being whether they include selectize or not (i decided to always include it). There was also one case where instead of "next step", the button said "submit" but i assumed it was a typo and included the normal template.

Fixes #654

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Ensuring some forms still work properly (e.g. new project request which also has selectize functionality that should work still)

PR Self Evaluation

Strikethrough things that don’t make sense for your PR.

  • My code follows the agreed upon best practices
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if needed)
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in the appropriate modules
  • I have performed a self-review of my own code

@Hzaakk Hzaakk requested a review from matthew-li January 13, 2025 13:19
@Hzaakk Hzaakk self-assigned this Jan 13, 2025
@matthew-li
Copy link
Collaborator

matthew-li commented Feb 6, 2025

Thanks for starting on this. Made some changes:

  • Went with a slightly different approach: there is now a wizard_base.html that any template that is part of a wizard view should inherit from. This additionally removes the need to include this block in every single template:
    {% block head %}
    {{ wizard.form.media }}
    {% endblock %}
    
    • To include the form, use {{ block.super }} in the child template after the custom text for that template.
    • As part of this, dynamically rendered either a "Next Step" or a "Submit" button based on the step number.
  • Added a selectize.html template that includes the CSS and JS for Selectize. The base wizard template does not include it--rather, only the child templates that need it should include it.
  • Added a head block to base.html for custom CSS and JS.
  • Moved request-related views into request subdirectories to make them easier to find.
  • Removed some redundantly-defined paths in the views themselves by modifying how they are fetched in get_template_names.

@Hzaakk Can you review the changes and do some light testing (make sure the forms still render and submit properly)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants