the last commit broke the test suite: fixed now

This commit is contained in:
Didier Lafforgue 2012-03-23 00:41:04 +01:00
parent 58c5e9e238
commit e9bf29f297
2 changed files with 19 additions and 16 deletions

View File

@ -90,19 +90,17 @@ module Locomotive
label = %{#{icon if @options[:icon] != 'after' }#{title}#{icon if @options[:icon] == 'after' }}
dropdow = ""
link_options = ""
link_options = caret = ''
href = "/#{page.fullpath}"
caret = ""
if render_children_for_page?(page, depth) && @options[:bootstrap] == "true"
dropdow = "dropdown"
if render_children_for_page?(page, depth) && bootstrap?
css += ' dropdown'
link_options = %{ class="dropdown-toggle" data-toogle="dropdown"}
href = "#"
href = '#'
caret = %{ <b class="caret"></b>}
end
output = %{<li id="#{page.slug.to_s.dasherize}-link" class="link#{selected} #{css} #{dropdow}">}
output = %{<li id="#{page.slug.to_s.dasherize}-link" class="link#{selected} #{css}">}
output << %{<a href="#{href}"#{link_options}>#{label}#{caret}</a>}
output << render_entry_children(page, depth.succ) if (depth.succ <= @options[:depth].to_i)
output << %{</li>}
@ -120,7 +118,7 @@ module Locomotive
children = page.children_with_minimal_attributes( @options[:add_attributes] ).reject { |c| !include_page?(c) }
if children.present?
output = %{<ul id="#{@options[:id]}-#{page.slug.to_s.dasherize}" class="#{@options[:bootstrap] == "true" ? "dropdown-menu" : ""}">}
output = %{<ul id="#{@options[:id]}-#{page.slug.to_s.dasherize}" class="#{bootstrap? ? 'dropdown-menu' : ''}">}
children.each do |c, page|
css = []
css << 'first' if children.first == c
@ -145,8 +143,13 @@ module Locomotive
end
end
def bootstrap?
@options[:bootstrap] == 'true'
end
end
::Liquid::Template.register_tag('nav', Nav)
end
end
end
end

View File

@ -49,7 +49,7 @@ describe Locomotive::Liquid::Tags::Nav do
output.should match /<ul id="nav">/
output.should match /<li id="child-1-link" class="link first">/
output.should match /<\/a><ul id="nav-child-2">/
output.should match /<\/a><ul id="nav-child-2" class="">/
output.should match /<li id="sub-child-1-link" class="link first">/
output.should match /<li id="sub-child-2-link" class="link last">/
output.should match /<\/a><\/li><\/ul><\/li><\/ul>/