2017-03-20 15:15:14 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Helpers for navbar partial
|
2016-07-31 19:28:23 +02:00
|
|
|
module NavigationHelper
|
2017-04-03 22:32:02 +02:00
|
|
|
def child_of(item)
|
|
|
|
item == @item || children_of(item).include?(@item)
|
2016-07-31 19:28:23 +02:00
|
|
|
end
|
2016-10-31 13:48:39 +01:00
|
|
|
|
2017-03-20 15:15:14 +01:00
|
|
|
# Returns every navigable item
|
|
|
|
# A navigable item contains the :navigable attribute
|
|
|
|
# Optionally contains an order attribute, determining the order in the navbar
|
2016-10-31 13:48:39 +01:00
|
|
|
def navigables
|
|
|
|
items.select { |i| i[:navigable] }.sort_by { |x| x[:order] || 10_000 }
|
|
|
|
end
|
2016-07-31 19:28:23 +02:00
|
|
|
end
|