Sha256: d05f20fed70efabd1b5c6858b3d6903b203ab23316702f069229dcf7226368bd
Contents?: true
Size: 1.3 KB
Versions: 3
Compression:
Stored size: 1.3 KB
Contents
module Tableficate module Filter class SelectStart < Select def initialize(table, name, options = {}) super(table, name, options) @field_name += '[start]' end def name "#{@name}_start".to_sym end def field_value(params) params[:filter][@name][:start] rescue '' end end class SelectStop < Select def initialize(table, name, options = {}) super(table, name, options) @field_name += '[stop]' end def name "#{@name}_stop".to_sym end def field_value(params) params[:filter][@name][:stop] rescue '' end end class SelectRange < Base attr_reader :start, :stop def initialize(table, name, options = {}) start_options = options.delete(:start) || {} stop_options = options.delete(:stop) || {} super(table, name, options) start_options.reverse_merge!(@attrs) start_options.reverse_merge!(label: self.label, label_options: self.label_options) stop_options.reverse_merge!(@attrs) stop_options.reverse_merge!(label: self.label, label_options: self.label_options) @start = SelectStart.new(table, name, start_options) @stop = SelectStop.new(table, name, stop_options) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
tableficate-0.3.2 | lib/tableficate/filters/select_range.rb |
tableficate-0.3.1 | lib/tableficate/filters/select_range.rb |
tableficate-0.3.0 | lib/tableficate/filters/select_range.rb |