Class: Kadmin::Pager::Presenter

Inherits:
Kadmin::Presenter
  • Object
show all
Defined in:
app/components/kadmin/pager/presenter.rb

Overview

Generates HTML code to present the given pager

Constant Summary collapse

FIRST_PAGE_SYMBOL =
'«'
PREVIOUS_PAGE_SYMBOL =
'‹'
LAST_PAGE_SYMBOL =
'»'
NEXT_PAGE_SYMBOL =
'›'
SEPARATOR_SYMBOL =
'…'
DEFAULT_SIZES =
[50, 100, 500, 1000].freeze

Instance Method Summary collapse

Instance Method Details

#generate(captured, page_sizes: DEFAULT_SIZES) ⇒ ActiveSupport::SafeBuffer

Generates HTML controls to change page, and pager behaviour.



27
28
29
30
31
32
33
34
# File 'app/components/kadmin/pager/presenter.rb', line 27

def generate(captured, page_sizes: DEFAULT_SIZES, **)
  navigation = page_list
  controls = size_list(page_sizes)
  contents = navigation + controls
  contents << captured unless captured.nil?

  return "<div class='btn-toolbar'>#{contents}</div>".html_safe
end