Module: Trestle::NavigationHelper

Defined in:
app/helpers/trestle/navigation_helper.rb

Overview

Internal

Instance Method Summary collapse

Instance Method Details

#current_admin?(admin) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
# File 'app/helpers/trestle/navigation_helper.rb', line 8

def current_admin?(admin)
  respond_to?(:admin) &&
    self.admin.respond_to?(:name) &&
    self.admin.name == admin.name
end

#current_navigation_item?(item) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'app/helpers/trestle/navigation_helper.rb', line 4

def current_navigation_item?(item)
  current_page?(item.path) || (item.admin && current_admin?(item.admin))
end

Returns:

  • (Boolean)


14
15
16
17
18
19
20
21
22
# File 'app/helpers/trestle/navigation_helper.rb', line 14

def navigation_group_collapsed?(group)
  if collapsed_navigation_groups.include?(group.id)
    # Explicitly collapsed by user
    true
  elsif group.collapse?
    # Default to collapsed unless expanded by user
    !expanded_navigation_groups.include?(group.id)
  end
end