added .breadcrumbs method to Page drop. It gives all the ancestors of the page and the page itself
This commit is contained in:
parent
025d5a7dda
commit
69e24e8fe0
@ -17,6 +17,10 @@ module Locomotive
|
|||||||
@parent ||= self._source.parent.to_liquid
|
@parent ||= self._source.parent.to_liquid
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def breadcrumbs
|
||||||
|
@breadcrumbs ||= liquify(*self._source.self_and_ancestors)
|
||||||
|
end
|
||||||
|
|
||||||
def children
|
def children
|
||||||
@children ||= liquify(*self._source.children)
|
@children ||= liquify(*self._source.children)
|
||||||
end
|
end
|
||||||
|
@ -53,6 +53,17 @@ describe Locomotive::Liquid::Drops::Page do
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context '#breadcrumbs' do
|
||||||
|
before(:each) do
|
||||||
|
@sub_page = Factory.build(:sub_page, :meta_keywords => 'Sub Libidinous, Angsty', :meta_description => "Sub Quite the combination.")
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'renders breadcrumbs of current page' do
|
||||||
|
content = render_template '{% for crumb in sub_page.breadcrumbs %}{{ crumb.title}},{% endfor %}', {'sub_page' => @sub_page}
|
||||||
|
content.should == 'Home page,Subpage,'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context '#rendering page title' do
|
context '#rendering page title' do
|
||||||
|
|
||||||
it 'renders the title of a normal page' do
|
it 'renders the title of a normal page' do
|
||||||
|
Loading…
Reference in New Issue
Block a user