Class: WorksWizardNewSubmissionController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- WorksWizardNewSubmissionController
- Defined in:
- app/controllers/works_wizard_new_submission_controller.rb
Overview
Controller to handle the policy agreement acknowlegdement before the wizard is started
The wizard flow is shown in the [mermaid diagram here](github.com/pulibrary/pdc_describe/blob/main/docs/wizard_flow.md).
Instance Method Summary collapse
-
#new_submission ⇒ Object
get Renders the “step 0” information page before creating a new dataset GET /works/1/new_submission.
-
#new_submission_delete ⇒ Object
GET /works/1/new-submission-delete.
-
#new_submission_save ⇒ Object
Creates the new dataset or update the dataset is save only was done previously POST /works/new_submission or POST /works/1/new_submission.
Methods inherited from ApplicationController
Instance Method Details
#new_submission ⇒ Object
get Renders the “step 0” information page before creating a new dataset GET /works/1/new_submission
16 17 18 19 |
# File 'app/controllers/works_wizard_new_submission_controller.rb', line 16 def new_submission @work = WorkMetadataService.new(params:, current_user:).work_for_new_submission prepare_decorators_for_work_form(@work) end |
#new_submission_delete ⇒ Object
GET /works/1/new-submission-delete
35 36 37 38 39 40 |
# File 'app/controllers/works_wizard_new_submission_controller.rb', line 35 def new_submission_delete if @work.editable_by?(current_user) && @work.none? @work.destroy end redirect_to user_path(current_user) end |
#new_submission_save ⇒ Object
Creates the new dataset or update the dataset is save only was done previously POST /works/new_submission or POST /works/1/new_submission
23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/works_wizard_new_submission_controller.rb', line 23 def new_submission_save @work = WorkMetadataService.new(params:, current_user:).new_submission @errors = @work.errors.to_a if @errors.count.positive? prepare_decorators_for_work_form(@work) render :new_submission else redirect_to edit_work_wizard_path(@work) end end |