elixir-luxembourg / daisy

Data Information System (DAISY) is a data bookkeeping application designed to help Biomedical Research institutions with their GDPR compliance.
GNU Affero General Public License v3.0
12 stars 10 forks source link

Implement DatasetWizardView with skippable steps and refactor form handling #441

Closed moustaphacheikh closed 10 months ago

moustaphacheikh commented 11 months ago

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
Fancien commented 11 months ago

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 :)