Sha256: b347475e7c0c749d4975e6e9fd4ee91b219a61280278ca6022bede240ca2d3cd

Contents?: true

Size: 1.28 KB

Versions: 8

Compression:

Stored size: 1.28 KB

Contents

# @deprecated  Leftover from Hydrangea; will be removed in release 5.x
module Uva
  module ModsIndexMethods

  def self.included(base)
    ActiveSupport::Deprecation.warn("Uva::ModsIndexMethods has been deprecated and its functionality has been encorporated into Hydra::Datastream::ModsArticle")
  end

  # extracts the last_name##full_name##computing_id to be used by home view
  def extract_person_full_names_and_computing_ids
    names = {}
    self.find_by_terms(:person).each do |person|
      name_parts = person.children.inject({}) do |hash,child|
        hash[child.get_attribute(:type)] = child.text if ["family","given"].include? child.get_attribute(:type)
        hash["computing_id"] = child.text if child.name == 'computing_id'
        hash
      end
      if name_parts.length == 3 and person.search(:roleTerm).children.text.include?("Author")
        if name_parts["family"].blank? && name_parts["given"].blank? && name_parts["computing_id"].blank?
          value = "Unknown Author"
        else
          value = "#{name_parts["family"]}, #{name_parts["given"]} (#{name_parts["computing_id"]})"
        end
        ::Solrizer::Extractor.insert_solr_field_value(names, "person_full_name_cid_facet", value) if name_parts.length == 3        
      end      
    end
    names
  end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
hydra-mods-0.0.6 lib/uva/mods_index_methods.rb
hydra-mods-0.0.5 lib/uva/mods_index_methods.rb
hydra-mods-0.0.4 lib/uva/mods_index_methods.rb
hydra-mods-0.0.3 lib/uva/mods_index_methods.rb
hydra-mods-0.0.2 lib/uva/mods_index_methods.rb
hydra-mods-0.0.1 lib/uva/mods_index_methods.rb
hydra-head-4.0.3 lib/uva/mods_index_methods.rb
hydra-head-4.0.2 lib/uva/mods_index_methods.rb