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 << %{#{label}}
+ dropdow = ""
+ link_options = ""
+ href = "/#{page.fullpath}"
+ caret = ""
+
+ if render_children_for_page?(page, depth) && @options[:bootstrap] == "true"
+ dropdow = "dropdown"
+ link_options = %{class="dropdown-toggle" data-toogle="dropdown"}
+ href = "#"
+ caret = %{}
+ end
+
+ output = %{}
+ output << %{#{label} #{caret}}
output << render_entry_children(page, depth.succ) if (depth.succ <= @options[:depth].to_i)
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 = %{}
+ output = %{}
children.each do |c, page|
css = []
css << 'first' if children.first == c