lib/kaminari/helpers/paginator.rb in kaminari-0.12.0 vs lib/kaminari/helpers/paginator.rb in kaminari-0.12.1
- old
+ new
@@ -12,10 +12,11 @@
h[:left] = outer_window if h[:left] == 0
h[:right] = options.delete(:right) || Kaminari.config.right
h[:right] = outer_window if h[:right] == 0
end
@template, @options = template, options
+ @theme = @options[:theme] ? "#{@options[:theme]}/" : ''
@options[:current_page] = PageProxy.new @window_options.merge(@options), @options[:current_page], nil
# so that this instance can actually "render". Black magic?
@output_buffer = ActionView::OutputBuffer.new
end
@@ -45,32 +46,26 @@
end
DEF
end
def to_s #:nodoc:
- suppress_logging_render_partial do
- super @window_options.merge(@options).merge :paginator => self
+ subscriber = ActionView::LogSubscriber.log_subscribers.detect {|ls| ls.is_a? ActionView::LogSubscriber}
+ return super @window_options.merge(@options).merge :paginator => self unless subscriber
+
+ # dirty hack to suppress logging render_partial
+ class << subscriber
+ alias_method :render_partial_with_logging, :render_partial
+ # do nothing
+ def render_partial(event); end
end
- end
- private
- # dirty hack
- def suppress_logging_render_partial(&blk)
- if subscriber = ActionView::LogSubscriber.log_subscribers.detect {|ls| ls.is_a? ActionView::LogSubscriber}
- class << subscriber
- alias_method :render_partial_with_logging, :render_partial
- # do nothing
- def render_partial(event); end
- end
- ret = blk.call
- class << subscriber
- alias_method :render_partial, :render_partial_with_logging
- undef :render_partial_with_logging
- end
- ret
- else
- blk.call
+ ret = super @window_options.merge(@options).merge :paginator => self
+
+ class << subscriber
+ alias_method :render_partial, :render_partial_with_logging
+ undef :render_partial_with_logging
end
+ ret
end
# Wraps a "page number" and provides some utility methods
class PageProxy
include Comparable