Class: CurationConcern::GenericFilesController

Inherits:
BaseController
  • Object
show all
Includes:
Curate::ParentContainer
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



27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 27

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



71
72
73
74
75
76
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 71

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

#editObject



43
44
45
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 43

def edit
  respond_with(curation_concern)
end

#newObject



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

def new
  curation_concern.copy_permissions_from(parent)
  respond_with(curation_concern)
end

#rollbackObject



61
62
63
64
65
66
67
68
69
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 61

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



39
40
41
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 39

def show
  respond_with(curation_concern)
end

#updateObject



47
48
49
50
51
52
53
54
55
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 47

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



57
58
59
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 57

def versions
  respond_with(curation_concern)
end