Fixed issue with page drop slug on templatized pages
This commit is contained in:
parent
bc63cd8acf
commit
6f5eec18c6
@ -10,7 +10,7 @@ module Locomotive
|
||||
end
|
||||
|
||||
def slug
|
||||
self._source.templatized? ? self._source.content_type.slug.singularize : self._source.slug
|
||||
self._source.templatized? ? @context['entry']._slug.singularize : self._source.slug
|
||||
end
|
||||
|
||||
def parent
|
||||
|
@ -81,6 +81,22 @@ describe Locomotive::Liquid::Drops::Page do
|
||||
|
||||
end
|
||||
|
||||
context '#rendering page slug' do
|
||||
|
||||
it 'renders the slug of a normal page' do
|
||||
render_template('{{ home.slug }}').should == 'index'
|
||||
end
|
||||
|
||||
it 'renders the content instance slug instead for a templatized page' do
|
||||
templatized = FactoryGirl.build(:page, :title => 'Lorem ipsum template', :templatized => true)
|
||||
|
||||
entry = Locomotive::Liquid::Drops::ContentEntry.new(mock('entry', :_slug => 'my_entry'))
|
||||
|
||||
render_template('{{ page.slug }}', 'page' => templatized, 'entry' => entry).should == 'my_entry'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context '#rendering page with editable_elements' do
|
||||
|
||||
before(:each) do
|
||||
|
Loading…
Reference in New Issue
Block a user