Class: Matestack::Ui::Bootstrap::Components::Pagination

Inherits:
BaseComponent
  • Object
show all
Defined in:
lib/matestack/ui/bootstrap/components/pagination.rb

Instance Method Summary collapse

Instance Method Details

#responseObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/matestack/ui/bootstrap/components/pagination.rb', line 8

def response
  nav pagination_attributes do
    ul class: ul_classes do
      if context.items.present?
        context.items.each do |item|
          li class: "page-item #{ 'active' if item[:active] }" do
            if item[:type] == :link
              a item.merge({ class: 'page-link' })
            else
              transition item.merge({ class: 'page-link' })
            end
          end
        end
      end
      yield if block_given?
    end
  end
end