Hi all,
I’ve created an extension that use the rails “paginating find” plugin
“Welcome cardboardrocket.com - BlueHost.com” and it work well on
the controller side.
But at this point can I create a radius tag that wrap the
paginating_links() method exposed from the helper (already activated
in my extension) that generate automatically the pagination?
Thanks,
Mariano
The only case where you would want to do that is if you wanted to
generate the links inside a page (not a regular view). Is that what
you’re trying to do? If not, just use the helper as-is in your views.
Sean
Yes I want generate the links of pagination for my “Bookshelf”
extension in a radiant page with a custom tag like this
“<r:books:paginate />” that work like paginating_links() in a standard
rails rhtml view.
This is the code of bookshelf_tags.rb:
module BookshelfTags
include Radiant::Taggable
tag ‘books’ do |tag|
tag.expand
end
tag ‘books:each’ do |tag|
result = []
Book.find(:all, :page => { :start => 1, :current => 2, :size => 6
}).each do |book|
tag.locals.book = book
result << tag.expand
end
result
end
tag ‘books:each:book’ do |tag|
book = tag.locals.book
%{
#{book.title}
#{book.sub_title}
pub year: #{book.pub_year}
- data form year: #{book.data_from_year} - to year:
#{book.data_to_year}
}
end
tag ‘books:paginate’ do |tag|
book = tag.locals.book
%{???}
end
end
And this is the code that I’ve used in my library page:
<r:books:each>
<r:book />
</r:books:each>
<r:books:paginate />
Mariano