Class: CurationConcern::GenericFilesController

Inherits:
BaseController
  • Object
show all
Includes:
Curate::ParentContainer, Morphine
Defined in:
app/controllers/curation_concern/generic_files_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



6
7
8
9
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 6

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

#createObject



33
34
35
36
37
38
39
40
41
42
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 33

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



20
21
22
23
24
25
26
27
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 20

def curation_concern
  @curation_concern ||=
  if params[:id]
    GenericFile.find(params[:id])
  else
    GenericFile.new(params[:generic_file])
  end
end

#destroyObject



77
78
79
80
81
82
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 77

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

#editObject



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

def edit
  respond_with(curation_concern)
end

#newObject



29
30
31
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 29

def new
  respond_with(curation_concern)
end

#rollbackObject



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

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

#showObject



45
46
47
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 45

def show
  respond_with(curation_concern)
end

#updateObject



53
54
55
56
57
58
59
60
61
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 53

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

#versionsObject



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

def versions
  respond_with(curation_concern)
end