Sha256: 429e546174c4abf5cd11030dc4a307c1dae2b4408c40699e4b489330020cb351
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 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(options[:blank_filter] ? options[:blank_filter] + filter : 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.1 | app/lib/active_grid/column.rb |