Class: UiBibz::Ui::Ux::Tables::Store

Inherits:
Object
  • Object
show all
Defined in:
lib/ui_bibz/ui/ux/tables/components/store.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(store) ⇒ Store

Store Use WillPaginate store methods



10
11
12
13
14
15
16
17
# File 'lib/ui_bibz/ui/ux/tables/components/store.rb', line 10

def initialize(store)
  raise 'Store is nil!' if store.nil?
  raise 'Store can be created only with "table_search_pagination" method!' if store.try(:records).nil?

  @records = store.records
  @store   = store
  @model   = store.model
end

Instance Attribute Details

#modelObject (readonly)

Returns the value of attribute model.



63
64
65
# File 'lib/ui_bibz/ui/ux/tables/components/store.rb', line 63

def model
  @model
end

#recordsObject

Returns the value of attribute records.



7
8
9
# File 'lib/ui_bibz/ui/ux/tables/components/store.rb', line 7

def records
  @records
end

Instance Method Details

#actionObject



85
86
87
# File 'lib/ui_bibz/ui/ux/tables/components/store.rb', line 85

def action
  @store.action
end

#actions_controllerObject



73
74
75
# File 'lib/ui_bibz/ui/ux/tables/components/store.rb', line 73

def actions_controller
  @store.actions_controller
end

#column_idObject



39
40
41
# File 'lib/ui_bibz/ui/ux/tables/components/store.rb', line 39

def column_id
  @store.column_id
end

#columnsObject



59
60
61
# File 'lib/ui_bibz/ui/ux/tables/components/store.rb', line 59

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

#controllerObject



69
70
71
# File 'lib/ui_bibz/ui/ux/tables/components/store.rb', line 69

def controller
  @store.controller
end

#current_pageObject



51
52
53
# File 'lib/ui_bibz/ui/ux/tables/components/store.rb', line 51

def current_page
  @records.current_page
end

#directionObject



43
44
45
# File 'lib/ui_bibz/ui/ux/tables/components/store.rb', line 43

def direction
  @store.direction
end

#idObject



31
32
33
# File 'lib/ui_bibz/ui/ux/tables/components/store.rb', line 31

def id
  @store.id
end

#limit_valueObject



55
56
57
# File 'lib/ui_bibz/ui/ux/tables/components/store.rb', line 55

def limit_value
  @records.limit_value
end

#param_idObject



89
90
91
# File 'lib/ui_bibz/ui/ux/tables/components/store.rb', line 89

def param_id
  @store.param_id
end

#parametersObject



81
82
83
# File 'lib/ui_bibz/ui/ux/tables/components/store.rb', line 81

def parameters
  @store.params.to_h
end

#paramsObject



77
78
79
# File 'lib/ui_bibz/ui/ux/tables/components/store.rb', line 77

def params
  @store.params || {}
end

#per_pageObject



23
24
25
# File 'lib/ui_bibz/ui/ux/tables/components/store.rb', line 23

def per_page
  @records.per_page
end

#searchObject



65
66
67
# File 'lib/ui_bibz/ui/ux/tables/components/store.rb', line 65

def search
  @store.search
end

#searchable_attributesObject



47
48
49
# File 'lib/ui_bibz/ui/ux/tables/components/store.rb', line 47

def searchable_attributes
  @store.searchable_attributes
end

#sortObject



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

def sort
  @store.sort
end

#total_entriesObject



27
28
29
# File 'lib/ui_bibz/ui/ux/tables/components/store.rb', line 27

def total_entries
  @records.total_entries
end

#total_pagesObject



19
20
21
# File 'lib/ui_bibz/ui/ux/tables/components/store.rb', line 19

def total_pages
  @records.total_pages
end