Class: IndexView::Base
- Inherits:
-
Object
- Object
- IndexView::Base
- Includes:
- CustomizationDefaults, Implementation
- Defined in:
- lib/index_view.rb
Constant Summary
Constants included from CustomizationDefaults
CustomizationDefaults::DEFAULT_PAGINATION_NUMBER
Constants included from Implementation
Implementation::ASC, Implementation::DESC, Implementation::SORT_DIRECTIONS
Instance Attribute Summary
Attributes included from Implementation
Class Method Summary collapse
- .all(*args) ⇒ Object
-
.column(*args, &block) ⇒ Object
used to define columns you want to render in the view, and gives you a way to customize how they render See IndexView::Column to get an idea of the options you can pass in.
-
.columns ⇒ Object
returns a collection of the IndexView::Column objects that were added through the
column
method. - .fields_for_search ⇒ Object
- .find(*args) ⇒ Object
- .first(*args) ⇒ Object
Methods included from CustomizationDefaults
#default_sort_direction, #default_sort_term, #per_page, #secondary_sort_term, #target_class
Methods included from Implementation
#all, #ascending?, #columns, #descending?, #fields_for_search, #find, #find_options, #first, #initialize, #opposite_sort_direction, #paginate, #pagination_options, #search_term, #search_term?, #sort, #sort_direction, #sort_term, #sorting?, #state, #state?, #table_name
Methods included from SQLGenerator
Class Method Details
.all(*args) ⇒ Object
27 28 29 |
# File 'lib/index_view.rb', line 27 def all(*args) new({}).all(*args) end |
.column(*args, &block) ⇒ Object
used to define columns you want to render in the view, and gives you a way to customize how they render See IndexView::Column to get an idea of the options you can pass in.
38 39 40 |
# File 'lib/index_view.rb', line 38 def column(*args, &block) columns << Column.new(*args, &block) end |
.columns ⇒ Object
returns a collection of the IndexView::Column objects that were added through the column
method
44 45 46 |
# File 'lib/index_view.rb', line 44 def columns @columns ||= [] end |
.fields_for_search ⇒ Object
48 49 50 51 |
# File 'lib/index_view.rb', line 48 def fields_for_search searchable_columns = columns.select { |c| c.searchable? } searchable_columns.map { |col| col.column_name } end |
.find(*args) ⇒ Object
23 24 25 |
# File 'lib/index_view.rb', line 23 def find(*args) new({}).find(*args) end |
.first(*args) ⇒ Object
31 32 33 |
# File 'lib/index_view.rb', line 31 def first(*args) new({}).first(*args) end |