diff --git a/TODO.txt b/TODO.txt index 3733810..9dcbdbc 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,5 +1,3 @@ -* partialize the outer div - * add generator option to copy particular template * add Haml generator diff --git a/app/views/kaminari/_paginator.html.erb b/app/views/kaminari/_paginator.html.erb new file mode 100644 index 0000000..167488d --- /dev/null +++ b/app/views/kaminari/_paginator.html.erb @@ -0,0 +1,3 @@ + diff --git a/lib/kaminari/helpers.rb b/lib/kaminari/helpers.rb index 58533af..b2858f5 100644 --- a/lib/kaminari/helpers.rb +++ b/lib/kaminari/helpers.rb @@ -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