Sha256: 4a12757f4d3e082a81f256831664651672da749622a4c0a99117099886bd4290

Contents?: true

Size: 595 Bytes

Versions: 5

Compression:

Stored size: 595 Bytes

Contents

class NavigationItemDecorator < Draper::Decorator
  delegate_all

  def label
    result = ''
    result = object.translation.label if object.translation.label
    result = object.page.translation.title if object.page && result.blank?
    result
  end

  def path(options = {})
    result = '/'

    if object.translation.path.present?
      result = object.translation.path

    elsif object.page.present?
      result = object.page.decorate.path(options)
    end

    result
  end

  def options_for_page
    ::Page.order(:description).map do |p|
      [p.description, p.id]
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
udongo-1.0.3 app/decorators/navigation_item_decorator.rb
udongo-1.0.2 app/decorators/navigation_item_decorator.rb
udongo-1.0.1 app/decorators/navigation_item_decorator.rb
udongo-1.0.0 app/decorators/navigation_item_decorator.rb
udongo-0.1.0 app/decorators/navigation_item_decorator.rb