lib/trestle/navigation.rb in trestle-0.8.11 vs lib/trestle/navigation.rb in trestle-0.8.12
- old
+ new
@@ -27,15 +27,15 @@
def first
sorted = by_group.values
sorted.first.first if sorted.any?
end
- def visible(context)
- self.class.new(items.select { |item| item.visible?(context) })
- end
-
- def self.build(blocks)
- new(blocks.map(&:items).flatten)
+ def self.build(blocks, context)
+ new(blocks.map { |block|
+ block.items(context)
+ }.flatten.select { |item|
+ item.visible?(context)
+ })
end
private
def stable_sort(items)
items.sort_by.with_index { |item, i| [item, i] }