Class: NavigationItemDecorator

Inherits:
ApplicationDecorator show all
Defined in:
app/decorators/navigation_item_decorator.rb

Instance Method Summary collapse

Methods inherited from ApplicationDecorator

collection_decorator_class

Instance Method Details

#labelObject



4
5
6
7
8
9
# File 'app/decorators/navigation_item_decorator.rb', line 4

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

#options_for_pageObject



24
25
26
27
28
# File 'app/decorators/navigation_item_decorator.rb', line 24

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

#path(options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/decorators/navigation_item_decorator.rb', line 11

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