Sha256: 28744a107ed09cca26bd57b29a16870b743e632920abb53d8a795be5edffa146

Contents?: true

Size: 1.31 KB

Versions: 58

Compression:

Stored size: 1.31 KB

Contents

require 'ui_bibz/ui/ux/tables/components/columns'
require 'ui_bibz/ui/ux/tables/components/column'
module UiBibz::Ui::Ux::Tables
  class Store

    attr_accessor :records

    # Store Use WillPaginate store methods
    def initialize store
      @records = store.records
      @store   = store
      @model   = store.model
    end

    def total_pages
      @records.total_pages
    end

    def per_page
      @records.per_page
    end

    def total_entries
      @records.total_entries
    end

    def id
      @store.id
    end

    def sort
      @store.sort
    end

    def column_id
      @store.column_id
    end

    def direction
      @store.direction
    end

    def searchable_attributes
      @store.searchable_attributes
    end

    def current_page
      @records.current_page
    end

    def limit_value
      @records.limit_value
    end

    def columns
      @columns ||= Columns.new model.new.attributes.keys.map{ |record| Column.new(record, { name: record.humanize }) }
    end

    def model
      @model
    end

    def search
      @store.search
    end

    def controller
      @store.controller
    end

    def params
      @store.params || {}
    end

    def parameters
      @store.params.to_h
    end

    def action
      @store.action
    end

    def param_id
      @store.param_id
    end

  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
ui_bibz-2.1.6 lib/ui_bibz/ui/ux/tables/components/store.rb
ui_bibz-2.1.5 lib/ui_bibz/ui/ux/tables/components/store.rb
ui_bibz-2.1.4 lib/ui_bibz/ui/ux/tables/components/store.rb
ui_bibz-2.1.3 lib/ui_bibz/ui/ux/tables/components/store.rb
ui_bibz-2.1.2 lib/ui_bibz/ui/ux/tables/components/store.rb
ui_bibz-2.1.1 lib/ui_bibz/ui/ux/tables/components/store.rb
ui_bibz-2.0.10 lib/ui_bibz/ui/ux/tables/components/store.rb
ui_bibz-2.0.9 lib/ui_bibz/ui/ux/tables/components/store.rb
ui_bibz-2.1.0 lib/ui_bibz/ui/ux/tables/components/store.rb
ui_bibz-2.0.8 lib/ui_bibz/ui/ux/tables/components/store.rb
ui_bibz-2.0.7 lib/ui_bibz/ui/ux/tables/components/store.rb
ui_bibz-2.0.5 lib/ui_bibz/ui/ux/tables/components/store.rb
ui_bibz-2.0.4 lib/ui_bibz/ui/ux/tables/components/store.rb
ui_bibz-2.0.3 lib/ui_bibz/ui/ux/tables/components/store.rb
ui_bibz-2.0.2 lib/ui_bibz/ui/ux/tables/components/store.rb
ui_bibz-2.0.1 lib/ui_bibz/ui/ux/tables/components/store.rb
ui_bibz-2.0.0 lib/ui_bibz/ui/ux/tables/components/store.rb
ui_bibz-2.0.0.beta2.6 lib/ui_bibz/ui/ux/tables/components/store.rb
ui_bibz-2.0.0.beta2.5 lib/ui_bibz/ui/ux/tables/components/store.rb
ui_bibz-2.0.0.beta2.4 lib/ui_bibz/ui/ux/tables/components/store.rb