diff --git a/lib/locomotive/liquid/tags/nav.rb b/lib/locomotive/liquid/tags/nav.rb index 169b97ab..81178c19 100644 --- a/lib/locomotive/liquid/tags/nav.rb +++ b/lib/locomotive/liquid/tags/nav.rb @@ -19,7 +19,7 @@ module Locomotive def initialize(tag_name, markup, tokens, context) if markup =~ Syntax @source = ($1 || 'page').gsub(/"|'/, '') - @options = { :id => 'nav', :depth => 1, :class => '', :active_class => 'on' } + @options = { :id => 'nav', :depth => 1, :class => '', :active_class => 'on', :bootstrap => false } markup.scan(::Liquid::TagAttributes) { |key, value| @options[key.to_sym] = value.gsub(/"|'/, '') } @options[:exclude] = Regexp.new(@options[:exclude]) if @options[:exclude] @@ -90,21 +90,37 @@ module Locomotive label = %{#{icon if @options[:icon] != 'after' }#{title}#{icon if @options[:icon] == 'after' }} - output = %{} output.strip end + def render_children_for_page?(page, depth) + depth.succ <= @options[:depth].to_i && page.children.reject { |c| !include_page?(c) }.any? + end + # Recursively creates a nested unordered list for the depth specified def render_entry_children(page, depth) output = %{} children = page.children_with_minimal_attributes( @options[:add_attributes] ).reject { |c| !include_page?(c) } if children.present? - output = %{