Module: Trestle::NavigationHelper

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

Instance Method Summary collapse

Instance Method Details

#current_admin?(admin) ⇒ Boolean

Returns:

  • (Boolean)

7
8
9
# File 'app/helpers/trestle/navigation_helper.rb', line 7

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

#current_navigation_item?(item) ⇒ Boolean

Returns:

  • (Boolean)

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

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

Returns:

  • (Boolean)

11
12
13
14
15
16
17
18
19
# File 'app/helpers/trestle/navigation_helper.rb', line 11

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