add layout file and add helper
This commit is contained in:
parent
75ab78fc68
commit
6c672e686e
3 changed files with 33 additions and 5 deletions
|
@ -1,5 +1,10 @@
|
|||
<ul>
|
||||
<% @items.find_all("**/verenigingen/*").sort_by {|x| x[:naam]}.each do |i| %>
|
||||
<li> <%= link_to(i[:naam], i) %> </li>
|
||||
<% end %>
|
||||
<% for vereniging in themes %>
|
||||
<li> <%= vereniging %> </li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<ul>
|
||||
<% for konvent in konvents %>
|
||||
<li> <%= konvent %> </li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
22
lib/helpers/verenigingen.rb
Normal file
22
lib/helpers/verenigingen.rb
Normal file
|
@ -0,0 +1,22 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Helpers for navbar partial
|
||||
module VerenigingenLists
|
||||
def current_child_of(item)
|
||||
child_of(item, @item)
|
||||
end
|
||||
|
||||
def child_of(parent, child)
|
||||
children_of(parent).include?(child)
|
||||
end
|
||||
|
||||
# Returns every navigable item
|
||||
# A navigable item contains the :navigable attribute
|
||||
# Optionally contains an order attribute, determining the order in the navbar
|
||||
def themes
|
||||
@items.find_all("**/verenigingen/*").map{|x| x[:themas]}.flatten.uniq.compact
|
||||
end
|
||||
def konvents
|
||||
@items.find_all("**/verenigingen/*").map{|x| x[:konvent]}.uniq.compact
|
||||
end
|
||||
end
|
|
@ -3,3 +3,4 @@ use_helper Nanoc::Helpers::Rendering
|
|||
use_helper Nanoc::Helpers::ChildParent
|
||||
|
||||
use_helper NavigationHelper
|
||||
use_helper VerenigingenLists
|
Loading…
Reference in a new issue