Class: CurationConcern::LinkedResourcesController

Inherits:
BaseController
  • Object
show all
Includes:
Curate::ParentContainer, Morphine
Defined in:
app/controllers/curation_concern/linked_resources_controller.rb

Instance Method Summary collapse

Methods included from Curate::ParentContainer

#parent

Methods inherited from BaseController

#authorize_curation_concern!, #contributor_agreement

Instance Method Details

#attach_action_breadcrumbObject



49
50
51
52
# File 'app/controllers/curation_concern/linked_resources_controller.rb', line 49

def attach_action_breadcrumb
  add_breadcrumb "#{parent.human_readable_type}", polymorphic_path([:curation_concern, parent])
  super
end

#createObject



15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/curation_concern/linked_resources_controller.rb', line 15

def create
  curation_concern.batch = parent
  if actor.create
    respond_with([:curation_concern, parent])
  else
    respond_with([:curation_concern, curation_concern]) { |wants|
      wants.html { render 'new', status: :unprocessable_entity }
    }
  end
end

#destroyObject



40
41
42
43
44
45
# File 'app/controllers/curation_concern/linked_resources_controller.rb', line 40

def destroy
  parent = curation_concern.batch
  flash[:notice] = "Deleted #{curation_concern}"
  curation_concern.destroy
  respond_with([:curation_concern, parent])
end

#editObject



26
27
28
# File 'app/controllers/curation_concern/linked_resources_controller.rb', line 26

def edit
  respond_with(curation_concern)
end

#newObject



11
12
13
# File 'app/controllers/curation_concern/linked_resources_controller.rb', line 11

def new
  respond_with(curation_concern)
end

#updateObject



30
31
32
33
34
35
36
37
38
# File 'app/controllers/curation_concern/linked_resources_controller.rb', line 30

def update
  if actor.update
    respond_with([:curation_concern, curation_concern.batch])
  else
    respond_with([:curation_concern, curation_concern]) { |wants|
      wants.html { render 'edit', status: :unprocessable_entity }
    }
  end
end