Module: BlacklightHelper

Includes:
Blacklight::BlacklightHelperBehavior
Defined in:
app/helpers/blacklight_helper.rb

Instance Method Summary collapse

Instance Method Details

#application_nameObject



16
17
18
# File 'app/helpers/blacklight_helper.rb', line 16

def application_name
  t('sufia.product_name')
end

#get_value_from_pid(field, value) ⇒ Object

Loads the object and returns its name(for creator)/title(for collection)



21
22
23
24
25
26
27
28
29
30
# File 'app/helpers/blacklight_helper.rb', line 21

def get_value_from_pid(field, value)
  attr_value = ""
  begin
    attr_value = ActiveFedora::Base.load_instance_from_solr(value.split("/").last).name if field == "desc_metadata__creator_sim"
    attr_value = ActiveFedora::Base.load_instance_from_solr(value).title if field == "collection_sim"
  rescue => e
    logger.warn("WARN: Helper method get_value_from_pid raised an error when loading #{value}.  Error was #{e}")
  end
  return attr_value.blank? ? value : attr_value
end