Sha256: 2f9d6a83262424584fc7a185fc33efd397fdb7b65b02678fed61d16ff9f633d4
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
# A bento_search item decorator customizing display for use in umlaut # recent articles. class UmlautJournalTocsDecorator < BentoSearch::StandardDecorator # Always full publication date def display_date if self.publication_date I18n.localize(self.publication_date, :format => "%d %b %Y") elsif self.year self.year.to_s else nil end end # Replace link with openurl pointing to ourselves with direct-to-fulltext, # or else nothing. def link if good_openurl? self_openurl("umlaut.skip_resolve_menu_for_type" => "fulltext") else nil end end #def other_links # links = [] # # if good_openurl? # links << BentoSearch::Link.new(:label => _h.umlaut_config.app_name, :url => self_openurl) # end #end # helper method for ourselves, do we have enough # metadata for a good article openurl? def good_openurl? self.doi.present? || self.pmid.present? || (self.volume.present? && self.issue.present? && self.start_page.present?) end def self_openurl(extra_params = {}) _h.url_for_with_co( { :controller => "/resolve", :action => :index }.merge(extra_params), self.to_openurl) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
umlaut_journal_tocs-0.0.1 | app/item_decorators/umlaut_journal_tocs_decorator.rb |