This commit is contained in:
Didier Lafforgue 2012-05-25 13:24:10 +02:00
parent 24ae75c6f5
commit 2ac74c9a50
2 changed files with 14 additions and 8 deletions

View File

@ -91,7 +91,7 @@ module Locomotive
label = %{#{icon if @options[:icon] != 'after' }#{title}#{icon if @options[:icon] == 'after' }}
link_options = caret = ''
href = "/#{page.fullpath}"
href = File.join('/', @site.localized_page_fullpath(page))
if render_children_for_page?(page, depth) && bootstrap?
css += ' dropdown'

View File

@ -24,7 +24,7 @@ describe Locomotive::Liquid::Tags::Nav do
pages = [@home]
pages.stubs(:root).returns(pages)
pages.stubs(:minimal_attributes).returns(pages) # iso
@site = FactoryGirl.build(:site)
@site = FactoryGirl.build(:site, :locales => %w(en fr))
@site.stubs(:pages).returns(pages)
end
@ -122,6 +122,12 @@ describe Locomotive::Liquid::Tags::Nav do
render_nav('site', {}, 'no_wrapper: true').should_not match /<ul id="nav">/
end
it 'localizes the links' do
I18n.with_locale('fr') do
render_nav.should == '<ul id="nav"><li id="child-1-link" class="link first"><a href="/fr/child_1">Child #1</a></li><li id="child-2-link" class="link last"><a href="/fr/child_2">Child #2</a></li></ul>'
end
end
end
def render_nav(source = 'site', registers = {}, template_option = '')