the last commit broke the test suite: fixed now
This commit is contained in:
parent
58c5e9e238
commit
e9bf29f297
@ -90,19 +90,17 @@ module Locomotive
|
|||||||
|
|
||||||
label = %{#{icon if @options[:icon] != 'after' }#{title}#{icon if @options[:icon] == 'after' }}
|
label = %{#{icon if @options[:icon] != 'after' }#{title}#{icon if @options[:icon] == 'after' }}
|
||||||
|
|
||||||
dropdow = ""
|
link_options = caret = ''
|
||||||
link_options = ""
|
|
||||||
href = "/#{page.fullpath}"
|
href = "/#{page.fullpath}"
|
||||||
caret = ""
|
|
||||||
|
|
||||||
if render_children_for_page?(page, depth) && @options[:bootstrap] == "true"
|
if render_children_for_page?(page, depth) && bootstrap?
|
||||||
dropdow = "dropdown"
|
css += ' dropdown'
|
||||||
link_options = %{ class="dropdown-toggle" data-toogle="dropdown"}
|
link_options = %{ class="dropdown-toggle" data-toogle="dropdown"}
|
||||||
href = "#"
|
href = '#'
|
||||||
caret = %{ <b class="caret"></b>}
|
caret = %{ <b class="caret"></b>}
|
||||||
end
|
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 << %{<a href="#{href}"#{link_options}>#{label}#{caret}</a>}
|
||||||
output << render_entry_children(page, depth.succ) if (depth.succ <= @options[:depth].to_i)
|
output << render_entry_children(page, depth.succ) if (depth.succ <= @options[:depth].to_i)
|
||||||
output << %{</li>}
|
output << %{</li>}
|
||||||
@ -120,7 +118,7 @@ module Locomotive
|
|||||||
|
|
||||||
children = page.children_with_minimal_attributes( @options[:add_attributes] ).reject { |c| !include_page?(c) }
|
children = page.children_with_minimal_attributes( @options[:add_attributes] ).reject { |c| !include_page?(c) }
|
||||||
if children.present?
|
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|
|
children.each do |c, page|
|
||||||
css = []
|
css = []
|
||||||
css << 'first' if children.first == c
|
css << 'first' if children.first == c
|
||||||
@ -145,8 +143,13 @@ module Locomotive
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def bootstrap?
|
||||||
|
@options[:bootstrap] == 'true'
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
::Liquid::Template.register_tag('nav', Nav)
|
::Liquid::Template.register_tag('nav', Nav)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
@ -49,7 +49,7 @@ describe Locomotive::Liquid::Tags::Nav do
|
|||||||
|
|
||||||
output.should match /<ul id="nav">/
|
output.should match /<ul id="nav">/
|
||||||
output.should match /<li id="child-1-link" class="link first">/
|
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-1-link" class="link first">/
|
||||||
output.should match /<li id="sub-child-2-link" class="link last">/
|
output.should match /<li id="sub-child-2-link" class="link last">/
|
||||||
output.should match /<\/a><\/li><\/ul><\/li><\/ul>/
|
output.should match /<\/a><\/li><\/ul><\/li><\/ul>/
|
||||||
|
Loading…
Reference in New Issue
Block a user