Class: UiBibz::Ui::Ux::Tables::TablePagination

Inherits:
Base
  • Object
show all
Includes:
ActionView, WillPaginate::ActionView
Defined in:
lib/ui_bibz/ui/ux/tables/table_pagination.rb

Overview

Create a pagination for table

Attributes

  • options - Options of element

  • html_options - Html Options of element

Options

You can add HTML attributes using the html_options. You can pass arguments in options attribute:

  • store - Store generate by ‘table_search_pagination’ method

Signatures

UiBibz::Ui::Ux::Tables::TablePagination.new(store: @store)

Helper

table_pagination(options = {})

Instance Attribute Summary

Attributes inherited from Base

#output_buffer

Instance Method Summary collapse

Methods inherited from Base

#generate_id, #i18n_set?, #inject_url

Constructor Details

#initialize(options = nil, html_options = nil) ⇒ TablePagination

Initialize pagination with component item pagination require WillPaginate gem



35
36
37
# File 'lib/ui_bibz/ui/ux/tables/table_pagination.rb', line 35

def initialize(options = nil, html_options = nil)
  @pagination = UiBibz::Ui::Core::Component.new nil, options, html_options
end

Instance Method Details

#renderObject

Render html tag with boostrap pagination theme



40
41
42
43
44
45
46
# File 'lib/ui_bibz/ui/ux/tables/table_pagination.rb', line 40

def render
  paginate_parameters = { controller: store.controller }
  paginate_parameters = paginate_parameters.merge(store.parameters)
  paginate_parameters = paginate_parameters.merge({ store_id: store.id }) unless store.id.nil?
  paginate_parameters = paginate_parameters.merge({ link_type: 'pagination' })
  will_paginate(store.records, params: paginate_parameters.with_indifferent_access.reject { |k, v| default_parameters?(k) || v.blank? }, renderer: WillPaginate::ActionView::BootstrapLinkRenderer)
end