Sha256: 6cb03879bbecab493a1abe12f6b638b92c6e39c9c1122fd78f5d62a8aafd6487

Contents?: true

Size: 908 Bytes

Versions: 46

Compression:

Stored size: 908 Bytes

Contents

module Hydra::ModelMixins
  module SolrDocumentExtension
    def document_type display_type = CatalogController.blacklight_config.show.display_type
      type = self.fetch(:medium_t, nil)

      type ||= self.fetch(display_type, nil) if display_type

      type.first.to_s.gsub("info:fedora/afmodel:","").gsub("Hydrangea","").gsub(/^Generic/,"")
    end

    def get_person_from_role(role, opts={})
      i = 0
      while i < 10
        persons_roles = self["person_#{i}_role_t"].map{|w|w.strip.downcase} unless self["person_#{i}_role_t"].nil?
        if persons_roles and persons_roles.include?(role.downcase)
          return {:first=>self["person_#{i}_first_name_t"], :last=>self["person_#{i}_last_name_t"]}
        end
        i += 1
      end
    end
    def get_file_asset_count()
      ActiveFedora::Base.count(:conditions=>"is_part_of_t:#{ActiveFedora::Base.quote_for_solr(id)}")
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
hydra-core-5.4.1 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.4.0.rc1 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.4.0.pre2 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.4.0.pre1 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.3.4 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.3.3 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.3.2 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.3.1 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.3.0 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.3.0.rc1 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.2.2 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.2.1 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.2.0 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.1.1 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.1.0 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.0.0 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.0.0.rc4 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.0.0.rc3 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.0.0.rc2 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.0.0.rc1 lib/hydra/model_mixins/solr_document_extension.rb