Class: FlowPagination::LinkRenderer

Inherits:
WillPaginate::ViewHelpers::LinkRenderer
  • Object
show all
Defined in:
lib/flow_pagination.rb

Overview

FlowPagination renderer for (Mislav) WillPaginate Plugin

Instance Method Summary collapse

Instance Method Details

#ajax_optionsObject



27
28
29
30
# File 'lib/flow_pagination.rb', line 27

def ajax_options
  return @ajax_options if @ajax_options
  @ajax_options = Hash[@options.select{ |k,v| [:loading, :loaded, :interactive, :success, :failure, :complete, :confirm, :condition, :before, :after, :submit, :with, :update, :position].include? k }]
end

#to_htmlObject

Render flow navigation



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/flow_pagination.rb', line 7

def to_html
  flow_pagination = ''

  if self.current_page < self.last_page
    if @options[:noajax]
      flow_pagination = @template.link_to(
        @template.t('flow_pagination.link', :default => 'more'),
        url_for(self.next_page))
    else
      flow_pagination = @template.link_to_remote(
        @template.t('flow_pagination.link', :default => 'more'),
        {:url => url_for(self.next_page),
         :method => @template.request.request_method}.
          merge(ajax_options) )
    end
  end

  @template.(:div, flow_pagination, :id => 'flow_pagination')
end