Class: Hyrax::FileSetsController

Inherits:
ApplicationController
  • Object
show all
Includes:
Blacklight::AccessControls::Catalog, Blacklight::Base, Breadcrumbs, EnsureMigratedBehavior, FlexibleSchemaBehavior, WorkflowsHelper
Defined in:
app/controllers/hyrax/file_sets_controller.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from WorkflowsHelper

#workflow_restriction?

Methods included from Breadcrumbs

#build_breadcrumbs, #default_trail, #trail_from_referer

Instance Attribute Details

#file_setObject Also known as: curation_concern

A little bit of explanation, CanCan(Can) sets the @file_set via the .load_and_authorize_resource method. However the interface for various CurationConcern modules leverages the #curation_concern method Thus we have file_set and curation_concern that are aliases for each other.



42
43
44
# File 'app/controllers/hyrax/file_sets_controller.rb', line 42

def file_set
  @file_set
end

Instance Method Details

#citationObject

GET /files/:id/citation



96
# File 'app/controllers/hyrax/file_sets_controller.rb', line 96

def citation; end

#destroyObject

DELETE /concern/file_sets/:id



67
68
69
70
71
72
73
# File 'app/controllers/hyrax/file_sets_controller.rb', line 67

def destroy
  guard_for_workflow_restriction_on!(parent: parent)

  delete(file_set: curation_concern)
  redirect_to [main_app, parent],
              notice: view_context.t('hyrax.file_sets.asset_deleted_flash.message')
end

#editObject

GET /concern/file_sets/:id



52
53
54
# File 'app/controllers/hyrax/file_sets_controller.rb', line 52

def edit
  initialize_edit_form
end

#showObject

GET /concern/parent/:parent_id/file_sets/:id



57
58
59
60
61
62
63
64
# File 'app/controllers/hyrax/file_sets_controller.rb', line 57

def show
  guard_for_workflow_restriction_on!(parent: parent(file_set: presenter))
  respond_to do |wants|
    wants.html
    wants.json
    additional_response_formats(wants)
  end
end

#statsObject

GET /files/:id/stats



91
92
93
# File 'app/controllers/hyrax/file_sets_controller.rb', line 91

def stats
  @stats = FileUsage.new(params[:id])
end

#updateObject

PATCH /concern/file_sets/:id



76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'app/controllers/hyrax/file_sets_controller.rb', line 76

def update
  guard_for_workflow_restriction_on!(parent: parent)

  if attempt_update
    after_update_response
  else
    after_update_failure_response
  end
rescue RSolr::Error::Http => error
  flash[:error] = error.message
  logger.error "FileSetsController::update rescued #{error.class}\n\t#{error.message}\n #{error.backtrace.join("\n")}\n\n"
  render action: 'edit'
end