Sha256: 8b4f70d2e912a81cba02f8b01e53b40c2b36314cf8ee4b051bfd0539c172531c

Contents?: true

Size: 1.05 KB

Versions: 48

Compression:

Stored size: 1.05 KB

Contents

module UiBibz::Ui::Ux::Tables
  class Paginable < UiBibz::Ui::Base
    include WillPaginate::ActionView

    def initialize store, options, html_options = nil
      @store        = store
      @options      = options
      @html_options = html_options
    end

    # Render html tag
    def render
      content_tag :div, @html_options do
        concat UiBibz::Ui::Ux::Tables::TablePagination.new(store: @store, wrap_form: @options[:wrap_form]).render
        concat UiBibz::Ui::Ux::Tables::TablePaginationPerPage.new(store: @store, wrap_form: @options[:wrap_form]).render
        concat tag(:br, class: 'ui-bibz-clear')
      end
    end

    def paginable?
      @options[:paginable].nil? ? true : @options[:paginable]
    end

  private

    def store
      @store ||= if @search_field.options[:store].nil?
        raise 'Store is nil!'
      elsif @search_field.options[:store].try(:records).nil?
        raise 'Store can be created only with "table_search_pagination" method!'
      else
        Store.new @search_field.options.delete :store
      end
    end

  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
ui_bibz-2.4.0 lib/ui_bibz/ui/ux/tables/extensions/paginable.rb
ui_bibz-2.3.15 lib/ui_bibz/ui/ux/tables/extensions/paginable.rb
ui_bibz-2.3.14 lib/ui_bibz/ui/ux/tables/extensions/paginable.rb
ui_bibz-2.3.13 lib/ui_bibz/ui/ux/tables/extensions/paginable.rb
ui_bibz-2.3.12 lib/ui_bibz/ui/ux/tables/extensions/paginable.rb
ui_bibz-2.3.11 lib/ui_bibz/ui/ux/tables/extensions/paginable.rb
ui_bibz-2.3.10 lib/ui_bibz/ui/ux/tables/extensions/paginable.rb
ui_bibz-2.3.9 lib/ui_bibz/ui/ux/tables/extensions/paginable.rb
ui_bibz-2.3.8 lib/ui_bibz/ui/ux/tables/extensions/paginable.rb
ui_bibz-2.3.7 lib/ui_bibz/ui/ux/tables/extensions/paginable.rb
ui_bibz-2.3.6 lib/ui_bibz/ui/ux/tables/extensions/paginable.rb
ui_bibz-2.3.5 lib/ui_bibz/ui/ux/tables/extensions/paginable.rb
ui_bibz-2.3.4 lib/ui_bibz/ui/ux/tables/extensions/paginable.rb
ui_bibz-2.3.3 lib/ui_bibz/ui/ux/tables/extensions/paginable.rb
ui_bibz-2.3.2 lib/ui_bibz/ui/ux/tables/extensions/paginable.rb
ui_bibz-2.3.1 lib/ui_bibz/ui/ux/tables/extensions/paginable.rb
ui_bibz-2.3.0 lib/ui_bibz/ui/ux/tables/extensions/paginable.rb
ui_bibz-2.2.2 lib/ui_bibz/ui/ux/tables/extensions/paginable.rb
ui_bibz-2.2.1 lib/ui_bibz/ui/ux/tables/extensions/paginable.rb
ui_bibz-2.2.0 lib/ui_bibz/ui/ux/tables/extensions/paginable.rb