Sha256: f1c1ae85eb76c45155017bb0b9cbe56fcec46f6abbf360dacb72c91295b3212a

Contents?: true

Size: 725 Bytes

Versions: 4

Compression:

Stored size: 725 Bytes

Contents

class AlphabeticalSearchResult
  delegate :url_helpers, :to => 'Rails.application.routes'

  def initialize(pref_labeling)
    @labeling = pref_labeling
  end

  def label
    @labeling.target
  end

  def concept
    @labeling.owner
  end

  def path
    url_helpers.rdf_path(@labeling.owner.origin, :lang => nil, :format => nil)
  end

  def definition?
    relation_name = Note::SKOS::Definition.name.to_relation_name
    @labeling.owner.respond_to?(relation_name) && @labeling.owner.send(relation_name).any?
  end

  def definition
    relation_name = Note::SKOS::Definition.name.to_relation_name
    @labeling.owner.send(relation_name).first
  end

  def partial_name
    'concepts/alphabetical/search_result'
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
iqvoc-4.3.3 app/presenters/alphabetical_search_result.rb
iqvoc-4.3.2 app/presenters/alphabetical_search_result.rb
iqvoc-4.3.1 app/presenters/alphabetical_search_result.rb
iqvoc-4.3.0 app/presenters/alphabetical_search_result.rb