Class: ActiveGrid::Column
- Inherits:
-
Object
- Object
- ActiveGrid::Column
- Defined in:
- app/lib/active_grid/column.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#view ⇒ Object
readonly
Returns the value of attribute view.
Instance Method Summary collapse
- #filter ⇒ Object
- #header ⇒ Object
-
#initialize(view, name, options = {}, &block) ⇒ Column
constructor
A new instance of Column.
- #tag_options ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(view, name, options = {}, &block) ⇒ Column
Returns a new instance of Column.
5 6 7 |
# File 'app/lib/active_grid/column.rb', line 5 def initialize(view, name, = {}, &block) @view, @name, @options, @block = view, name, , block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
3 4 5 |
# File 'app/lib/active_grid/column.rb', line 3 def block @block end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'app/lib/active_grid/column.rb', line 3 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'app/lib/active_grid/column.rb', line 3 def @options end |
#view ⇒ Object (readonly)
Returns the value of attribute view.
3 4 5 |
# File 'app/lib/active_grid/column.rb', line 3 def view @view end |
Instance Method Details
#filter ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/lib/active_grid/column.rb', line 14 def filter = {} ["data-activegrid-filter-field"] = name ["data-activegrid-filter"] = true case filter = [:filter] when "string" view.text_field_tag("activegird_filter_#{name}", nil, ) when Array view.select_tag("activegrid_filter_#{name}", view.([:blank_filter] ? ["#{[:blank_filter]}"] + filter : filter), ) end end |
#header ⇒ Object
9 10 11 12 |
# File 'app/lib/active_grid/column.rb', line 9 def header # TODO: localization? [:header] || name.to_s.titleize end |
#tag_options ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'app/lib/active_grid/column.rb', line 27 def = {} if [:sortable] ["class"] = "activegrid-sort" ["data-activegrid-sort-field"] = name ["data-activegrid-sort"] = [:sortable] end end |
#value ⇒ Object
38 39 40 |
# File 'app/lib/active_grid/column.rb', line 38 def value view.capture(&block) end |