Skip to content

Conversation

@oludaara
Copy link
Collaborator

Summary

This PR implements reusable Jinja form partials to eliminate code duplication between the application form and job posting form, addressing issues #708 and #710.

Issues Addressed

Changes Made

New Files Created:

  • templates/_form_macros.html - Reusable Jinja macros for form components
  • static/css/forms.css - Shared form styles

Files Modified:

  • templates/app-form.html - Refactored to use new form macros
  • templates/job-form.html - Refactored to use new form macros with payment integration

Macros Implemented:

  • form_wrapper() - Overall form structure with optional payment integration
  • fieldset() - Fieldset grouping with optional legend
  • input_field() - Text input fields with required/optional labeling
  • textarea_field() - Textarea fields with configurable rows
  • radio_group() - Radio button groups with flexible data structure support
  • checkbox_field() - Individual checkbox fields
  • conduct_checkbox() - Reusable code of conduct agreement checkbox

Key Features:

  • DRY Principle: Eliminates code duplication between forms
  • Maintainability: Centralized form components for easier updates
  • Flexibility: Macros support both required and optional fields
  • Payment Integration: Job form supports payment flow through include_payment parameter
  • Backward Compatibility: Maintains all existing functionality
  • Consistent Styling: Shared CSS ensures uniform appearance

Testing

  • Both forms maintain their original functionality
  • Application form renders correctly with new macros
  • Job posting form renders correctly with payment integration
  • All form fields preserve their required/optional status
  • Radio buttons and checkboxes work as expected

Scope

As specified in the original issues:

- Create reusable form macros in _form_macros.html
- Add shared form styles in forms.css
- Refactor application form to use new macros
- Refactor job posting form to use new macros
- Implement form_wrapper, fieldset, input_field, textarea_field, radio_group, checkbox_field, and conduct_checkbox macros
- Maintain existing functionality while eliminating code duplication
- Support payment integration for job form through include_payment parameter

Fixes #708: Refactor Application form to reusable Jinja partial
Fixes #710: Refactor Post a job form to use application form Jinja partial"
Copy link
Collaborator

@daaimah123 daaimah123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oludaara Great first iteration! Request for changes are as follows:

  • reset this PR to point to mvp branch not develop complete
  • merge latest from mvp branch onto this work as it houses all of the latest information with the application form and some updated folder-architecture complete
  • please follow our styling guidelines for the css / scss additions complete

Please be sure to address the request for changes using our pull request best practices and @-me once you are ready for another review. Here is a reminder of those best practices:

  • Acknowleding each request for change (i.e. feedback was marked with an emoji reaction to show its accepted).
  • Provide a written response to the request for changes in one of the following ways:
    1. summary comment addressing each individual request for change stating how and where (the commit hash referenced) you made the change
    2. reply to each comments generated via GitHub in your generated request for change
    3. share an alternative thought with explanation of why you do not wish to implement the request for change or ask any clarifying questions
  • Once actively stating how you've addressed a request for change alongside referencing the hash in which the change was made, mark the comment as "resolved".

@daaimah123
Copy link
Collaborator

@oludaara Does this PR need to be closed? It seems like a first iteration of PR #780

Alternatively, in the future you can update your base branch (where the PR will be merged into) by editing your PR title. Underneath the title text input field, is a dropdown with a base branch option. You can click into this and update the branch to another one 🚀
Screenshot 2025-06-12 at 12 51 24 PM

@daaimah123 daaimah123 changed the title Refactor forms to use reusable Jinja partials [Issues 708 & 710] Refactor forms to use reusable Jinja partials Jun 12, 2025
@oludaara
Copy link
Collaborator Author

Yes this PR needs to be closed

Didn't Know there was a work around for that, Thanks.

@oludaara oludaara closed this Jun 12, 2025
@github-project-automation github-project-automation bot moved this from Testing or Review to Implemented or Addressed ✅ in Application Process Automation Jun 12, 2025
@daaimah123 daaimah123 deleted the refactor-forms-jinja-partials branch July 18, 2025 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Implemented or Addressed ✅

Development

Successfully merging this pull request may close these issues.

Refactor Post a job form to use application form Jinja partial Refactor Application form to reusable Jinja partial

3 participants