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-6.0.0.pre8 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-5.4.0 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.0.0.pre7 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.0.0.pre6 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.0.0.pre5 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.0.0.pre4 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.0.0.pre3 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.0.0.pre2 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.0.0.pre1 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-5.4.0.pre1 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-5.3.0 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-5.2.0 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-5.1.0 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-5.0.1 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-5.0.0 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-5.0.0.rc1 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-5.0.0.pre15 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-5.0.0.pre14 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-5.0.0.pre13 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-5.0.0.pre12 lib/hydra/model_mixins/solr_document_extension.rb