Sha256: c22a90c0aba46ad4ac03c99a575cf47e469486eb7c35b44b69d3cb75ea0a25fb
Contents?: true
Size: 1.03 KB
Versions: 1
Compression:
Stored size: 1.03 KB
Contents
module ActiveGrid class Column attr_reader :block, :name, :options, :view def initialize(view, name, options = {}, &block) @view, @name, @options, @block = view, name, options, block end def header # TODO: localization? options[:header] || name.to_s.titleize end def filter tag_options = {} tag_options["data-activegrid-filter-field"] = name tag_options["data-activegrid-filter"] = true case filter = options[:filter] when "string" view.text_field_tag("activegird_filter_#{name}", nil, tag_options) when Array view.select_tag("activegrid_filter_#{name}", view.options_for_select(filter), tag_options) end end def tag_options tag_options = {} if options[:sortable] tag_options["class"] = "activegrid-sort" tag_options["data-activegrid-sort-field"] = name tag_options["data-activegrid-sort"] = options[:sortable] end tag_options end def value view.capture(&block) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
activegrid-1.0.0 | app/lib/active_grid/column.rb |