Module: BulmaPagination::BulmaRenderer

Included in:
Hanami, Rails, Sinatra
Defined in:
lib/bulma_pagination/bulma_renderer.rb

Overview

Contains functionality shared by all renderer classes.

Instance Method Summary collapse

Instance Method Details

#container_attributesObject



20
21
22
# File 'lib/bulma_pagination/bulma_renderer.rb', line 20

def container_attributes
  super.except(*[:link_options])
end

#to_htmlObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/bulma_pagination/bulma_renderer.rb', line 7

def to_html
  pages = pagination
  page_prev = pages.delete(:previous_page)
  page_next = pages.delete(:next_page)
  list_items = pages.map do |item|
    item.is_a?(Integer) ? page_number(item) : send(item)
  end.join(@options[:link_separator])
  content = tag("ul", list_items, class: "pagination-list")
  content.prepend(next_page) if page_next
  content.prepend(previous_page) if page_prev
  tag("nav", content, class: "pagination #{@options[:class]}")
end