Class: RailsPaginationUltimate::Paginator
- Inherits:
-
Object
- Object
- RailsPaginationUltimate::Paginator
- Defined in:
- lib/rails_pagination_ultimate/action_view_helper.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#current_page ⇒ Object
readonly
Returns the value of attribute current_page.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
-
#total_pages ⇒ Object
readonly
Returns the value of attribute total_pages.
Instance Method Summary collapse
-
#initialize(template, collection, options = {}) ⇒ Paginator
constructor
A new instance of Paginator.
- #render ⇒ Object
Constructor Details
#initialize(template, collection, options = {}) ⇒ Paginator
Returns a new instance of Paginator.
47 48 49 50 51 52 53 |
# File 'lib/rails_pagination_ultimate/action_view_helper.rb', line 47 def initialize(template, collection, = {}) @template = template @collection = collection @options = @current_page = collection.current_page @total_pages = collection.total_pages end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
45 46 47 |
# File 'lib/rails_pagination_ultimate/action_view_helper.rb', line 45 def collection @collection end |
#current_page ⇒ Object (readonly)
Returns the value of attribute current_page.
45 46 47 |
# File 'lib/rails_pagination_ultimate/action_view_helper.rb', line 45 def current_page @current_page end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
45 46 47 |
# File 'lib/rails_pagination_ultimate/action_view_helper.rb', line 45 def @options end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
45 46 47 |
# File 'lib/rails_pagination_ultimate/action_view_helper.rb', line 45 def template @template end |
#total_pages ⇒ Object (readonly)
Returns the value of attribute total_pages.
45 46 47 |
# File 'lib/rails_pagination_ultimate/action_view_helper.rb', line 45 def total_pages @total_pages end |
Instance Method Details
#render ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/rails_pagination_ultimate/action_view_helper.rb', line 55 def render return "" if total_pages <= 1 && total_pages != Float::INFINITY if [:template] return template.render(partial: [:template], locals: { collection: collection, options: , template: template, windowed_page_numbers: windowed_page_numbers }) end case [:type] when :load_more render_load_more when :infinite_scroll render_infinite_scroll else render_standard end end |