Sha256: 1d2a015309cf831be98e6845b86137ed3c9f707d7fd88d9c7ae16850d43ef4c3

Contents?: true

Size: 806 Bytes

Versions: 69

Compression:

Stored size: 806 Bytes

Contents

require 'active-fedora'
module Cul::Hydra::Controllers
module AggregatorControllerHelper
  def load_fedora_document
    if params.has_key? :asset_id
      af_base = ActiveFedora::Base.load_instance(params[:asset_id])
    else
      af_base = ActiveFedora::Base.load_instance(params[:id])
    end
    the_model = ActiveFedora::ContentModel.known_models_for( af_base ).first
    if the_model.nil? or the_model == ActiveFedora::Base
      the_model = DcDocument
    end

    @document_fedora = af_base.adapt_to the_model
  end
  def load_resources
    @document_fedora ||= load_fedora_document
    if @document_fedora.is_a? Cul::Hydra::ActiveFedora::Model::Aggregator
      @resources = @document_fedora.resources
    else
      logger.debug "Only aggregators have parts!"
    end
    @resources
  end
end
end

Version data entries

69 entries across 69 versions & 2 rubygems

Version Path
cul_hydra-1.4.14 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.4.13 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.4.12 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.4.11 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.4.10 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.4.8 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.4.7 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.4.5 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.4.4 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.4.3 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.4.2 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.4.1 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.4.0 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.3.11 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.3.10 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.3.9 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.3.8 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.3.7 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.3.6 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.3.5 lib/cul_hydra/controllers/aggregator_controller_helper.rb