partialize the outer div

This commit is contained in:
Akira Matsuda 2011-02-06 23:17:11 +09:00
parent 7af0d01758
commit 2e406a7bcc
3 changed files with 13 additions and 10 deletions

View File

@ -1,5 +1,3 @@
* partialize the outer div
* add generator option to copy particular template
* add Haml generator

View File

@ -0,0 +1,3 @@
<div class='pagination'>
<%= content_for :kaminari_paginator_tags %>
</div>

View File

@ -54,6 +54,9 @@ module Kaminari
class TruncatedSpan < Tag
end
class Paginator < Tag
end
class PaginationRenderer
attr_reader :options
@ -62,14 +65,6 @@ module Kaminari
@left, @window, @right = (options[:left] || options[:outer_window] || 1), (options[:window] || options[:inner_window] || 4), (options[:right] || options[:outer_window] || 1)
end
def to_s
suppress_logging_render_partial do
@template.content_tag :div, :class => 'pagination' do
tagify.join("\n").html_safe
end
end
end
def tagify
num_pages, current_page, left, window, right = @options[:num_pages], @options[:current_page], @left, @window, @right
@ -94,6 +89,13 @@ module Kaminari
tags << (num_pages > current_page ? NextLink.new(self) : NextSpan.new(self))
end
def to_s
suppress_logging_render_partial do
@template.content_for :kaminari_paginator_tags, tagify.join("\n").html_safe
Paginator.new(self).to_s
end
end
private
def method_missing(meth, *args, &blk)
@template.send meth, *args, &blk