Class: CurationConcern::GenericWorksController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/curation_concern/generic_works_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#authorize_curation_concern!, #contributor_agreement

Instance Method Details

#createObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/curation_concern/generic_works_controller.rb', line 9

def create
  if verify_acceptance_of_user_agreement!
    self.curation_concern.inner_object.pid = CurationConcern.mint_a_pid
    hash = params.dup
    params[get_class_name].delete("editors_attributes") if params.has_key?(get_class_name)
    if actor.create && add_depositor_as_editor && add_or_update_editors_and_groups(hash).save
      after_create_response
    else
      setup_form
      respond_with([:curation_concern, curation_concern]) do |wants|
        wants.html { render 'new', status: :unprocessable_entity }
      end
    end
  end
end

#destroyObject



87
88
89
90
91
# File 'app/controllers/curation_concern/generic_works_controller.rb', line 87

def destroy
  title = curation_concern.to_s
  curation_concern.destroy
  after_destroy_response(title)
end

#editObject



62
63
64
65
# File 'app/controllers/curation_concern/generic_works_controller.rb', line 62

def edit
  setup_form
  respond_with(curation_concern)
end

#hash_key_for_curation_concernObject



105
106
107
# File 'app/controllers/curation_concern/generic_works_controller.rb', line 105

def hash_key_for_curation_concern
  curation_concern_type.name.underscore.to_sym
end

#newObject



5
6
7
# File 'app/controllers/curation_concern/generic_works_controller.rb', line 5

def new
  setup_form
end

#showObject



58
59
60
# File 'app/controllers/curation_concern/generic_works_controller.rb', line 58

def show
  respond_with(curation_concern)
end

#updateObject



67
68
69
70
71
72
73
74
75
76
# File 'app/controllers/curation_concern/generic_works_controller.rb', line 67

def update
  if add_or_update_editors_and_groups(params).save && actor.update
    after_update_response
  else
    setup_form
    respond_with([:curation_concern, curation_concern]) do |wants|
      wants.html { render 'edit', status: :unprocessable_entity }
    end
  end
end