Class: CurationConcern::LinkedResourcesController

Inherits:
ApplicationController
  • Object
show all
Includes:
Worthwhile::ParentContainer, Worthwhile::ThemedLayoutController, Worthwhile::WithoutNamespace
Defined in:
app/controllers/curation_concern/linked_resources_controller.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Worthwhile::ParentContainer

#parent, #parent_id

Methods included from Worthwhile::ThemedLayoutController

#show_site_actions?, #show_site_search?

Instance Attribute Details

#actorObject



52
53
54
# File 'app/controllers/curation_concern/linked_resources_controller.rb', line 52

def actor
  @actor ||= Worthwhile::CurationConcern.actor(curation_concern, current_user, params[:linked_resource])
end

Instance Method Details

#attach_action_breadcrumbObject



46
47
48
49
# File 'app/controllers/curation_concern/linked_resources_controller.rb', line 46

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

#createObject



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

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

#curation_concernObject



56
57
58
# File 'app/controllers/curation_concern/linked_resources_controller.rb', line 56

def curation_concern
  @curation_concern
end

#destroyObject



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

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

#editObject



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

def edit
  respond_with(curation_concern)
end

#newObject



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

def new
  respond_with(curation_concern)
end

#updateObject



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

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