Class: Lipstick::Helpers::PaginationLinkRenderer

Inherits:
Object
  • Object
show all
Defined in:
lib/lipstick/helpers/pagination_link_renderer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#itemsObject (readonly)

Returns the value of attribute items.



8
9
10
# File 'lib/lipstick/helpers/pagination_link_renderer.rb', line 8

def items
  @items
end

Instance Method Details

#prepare(collection, _options, template) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/lipstick/helpers/pagination_link_renderer.rb', line 11

def prepare(collection, _options, template)
  @current = collection.current_page
  @total = collection.total_pages

  @items = [*prefix, *middle, *suffix]
  @template = template
end

#to_htmlObject



19
20
21
22
23
24
25
26
27
# File 'lib/lipstick/helpers/pagination_link_renderer.rb', line 19

def to_html
  template.('nav', class: 'pagination-wrapper') do
    template.('ul', class: 'pagination') do
      items.each do |item|
        template.concat(render_item(item))
      end
    end
  end
end