Sha256: 4445dd68713c8a5bff55cbc72b363091c0f9687729a2948dd02ef231d64d0b12
Contents?: true
Size: 704 Bytes
Versions: 3
Compression:
Stored size: 704 Bytes
Contents
module Tableficate module Filter class Base attr_reader :name, :label, :attrs, :template, :table, :field_name, :label_options def initialize(table, name, options = {}) @table = table @name = name @label = options.delete(:label) || table.columns.detect{|column| column.name == @name}.try(:header) || name.to_s.titleize @label_options = options.delete(:label_options) || {} @attrs = options @template = 'filters/' + self.class.name.demodulize.underscore @field_name = "#{table.as}[filter][#{@name}]" end def field_value(params) params[:filter][@name] rescue '' end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
tableficate-0.3.2 | lib/tableficate/filters/base.rb |
tableficate-0.3.1 | lib/tableficate/filters/base.rb |
tableficate-0.3.0 | lib/tableficate/filters/base.rb |