Merge pull request #432 from colibri-software/fix_page_drop

Fixed issue with page drop slug on templatized pages
This commit is contained in:
Didier Lafforgue 2012-06-02 09:47:08 -07:00
commit b4dd590f9a
2 changed files with 17 additions and 1 deletions

View File

@ -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

View File

@ -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