• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / pdc_describe / 9091a1ae-29be-458c-984a-339d213919c4

12 Dec 2024 07:41PM UTC coverage: 26.434% (-69.7%) from 96.113%
9091a1ae-29be-458c-984a-339d213919c4

Pull #2000

circleci

jrgriffiniii
Removing integration with ActiveStorage
Pull Request #2000: Bump actionpack from 7.2.1.1 to 7.2.2.1

945 of 3575 relevant lines covered (26.43%)

0.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

12.0
/app/controllers/works_wizard_new_submission_controller.rb
1
# frozen_string_literal: true
2

3
require "nokogiri"
1✔
4
require "open-uri"
1✔
5

6
# Controller to handle the policy agreement acknowlegdement before the wizard is started
7
#
8
# The wizard flow is shown in the [mermaid diagram here](https://github.com/pulibrary/pdc_describe/blob/main/docs/wizard_flow.md).
9
#
10
class WorksWizardNewSubmissionController < ApplicationController
1✔
11
  before_action :load_work
×
12
  before_action :can_edit
×
13

14
  # get Renders the "step 0" information page before creating a new dataset
15
  # GET /works/1/new_submission
16
  def new_submission
×
17
    @work = WorkMetadataService.new(params:, current_user:).work_for_new_submission
×
18
    prepare_decorators_for_work_form(@work)
×
19
  end
20

21
  # Creates the new dataset or update the dataset is save only was done previously
22
  # POST /works/new_submission or POST /works/1/new_submission
23
  def new_submission_save
×
24
    @work = WorkMetadataService.new(params:, current_user:).new_submission
×
25
    @errors = @work.errors.to_a
×
26
    if @errors.count.positive?
×
27
      prepare_decorators_for_work_form(@work)
×
28
      render :new_submission
×
29
    else
30
      redirect_to edit_work_wizard_path(@work)
×
31
    end
32
  end
33

34
  # GET /works/1/new-submission-delete
35
  def new_submission_delete
×
36
    if @work.editable_by?(current_user) && @work.none?
×
37
      @work.destroy
×
38
    end
39
    redirect_to user_path(current_user)
×
40
  end
41

42
  private
×
43

44
    def load_work
×
45
      @work = Work.find(params[:id])
×
46
    end
47

48
    def can_edit
×
49
      return if @work.editable_by?(current_user)
×
50

51
      redirect_to user_path(current_user), notice: "You do not have permission to modify the work."
×
52
    end
53
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc