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

Implement DatasetWizardView with skippable steps and refactor form handling #441

Merged

Conversation

moustaphacheikh
Copy link
Collaborator

@moustaphacheikh moustaphacheikh commented Aug 3, 2023

This commit introduces a multi-step form wizard view, DatasetWizardView, and a mixin, SkipFieldValidationMixin, for handling optional form steps in the wizard. The changes provide a more user-friendly and flexible way of managing the creation of datasets with data declaration, storage location, legal basis, and access

Key changes include:

  1. Implementation of DatasetWizardView:

    • A form_list is introduced to manage the sequence of forms in the wizard view.
    • The render_done method is refactored to handle redirection based on the current step the presence of a dataset_id in the session storage.
    • get_form_kwargs method is added to inject a dataset instance into form initialization after the first step.
    • process_step method is overridden to handle the creation and association of model instances based on form data.
    • get_context_data method is enhanced to provide additional context for template rendering.
  2. Introduction of SkipFieldValidationMixin:

    • This mixin adds a 'skip_wizard' field to the form and overrides the is_valid method.
    • If the 'skip_wizard' field is set to True, is_valid will return True regardless of the validation of other fields in the form.
    • This allows optional steps in the wizard, enabling users to proceed without filling out the entire form.

These changes significantly improve the user experience by breaking down complex form sets into manageable, skippable steps.

Screenshot 2023-08-03 at 11 19 44

@moustaphacheikh moustaphacheikh force-pushed the 433-implement-wizard-form-for-enhanced-user-experience branch from e3fa912 to 752150c Compare August 4, 2023 12:49
@moustaphacheikh moustaphacheikh marked this pull request as ready for review August 7, 2023 07:46
Copy link
Collaborator

@Fancien Fancien left a comment

Choose a reason for hiding this comment

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

Works very well, except for the issue with the reset button.

I asked for some changes, but good job 👍

core/forms/access.py Outdated Show resolved Hide resolved
core/forms/data_declaration.py Outdated Show resolved Hide resolved
core/forms/legal_basis.py Outdated Show resolved Hide resolved
web/templates/_includes/forms.html Outdated Show resolved Hide resolved
web/static/js/data_declaration.js Outdated Show resolved Hide resolved
web/views/datasets.py Show resolved Hide resolved
core/forms/dataset.py Outdated Show resolved Hide resolved
core/forms/storage_location.py Outdated Show resolved Hide resolved
web/tests/test_dataset.py Outdated Show resolved Hide resolved
web/views/datasets.py Show resolved Hide resolved
@Fancien
Copy link
Collaborator

Fancien commented Aug 8, 2023

Small comment regarding the display of the wizard steps. I feel like the skipped steps lack a bit of contrast with the white background. I would add a darker border to increase the contrast (see below).

image

This is a matter of personal preference though, feel free to ignore if you disagree :)

@moustaphacheikh moustaphacheikh merged commit 6e3cbdd into develop Aug 9, 2023
1 check passed
@vildead vildead deleted the 433-implement-wizard-form-for-enhanced-user-experience branch July 10, 2024 09:19
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.

Implement Wizard Form for Enhanced User Experience
2 participants