Class: KirguduBase::Models::DataFilter
- Inherits:
-
Object
- Object
- KirguduBase::Models::DataFilter
- Defined in:
- app/helpers/kirgudu_base/models/data_filter.rb
Instance Attribute Summary collapse
-
#css_class ⇒ Object
Returns the value of attribute css_class.
-
#css_span ⇒ Object
Returns the value of attribute css_span.
-
#filter_name ⇒ Object
Returns the value of attribute filter_name.
-
#input_type ⇒ Object
Returns the value of attribute input_type.
-
#label ⇒ Object
Returns the value of attribute label.
-
#name ⇒ Object
Returns the value of attribute name.
-
#on_change ⇒ Object
Returns the value of attribute on_change.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#placeholder ⇒ Object
Returns the value of attribute placeholder.
-
#source ⇒ Object
Returns the value of attribute source.
-
#source_url ⇒ Object
Returns the value of attribute source_url.
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ DataFilter
constructor
A new instance of DataFilter.
Constructor Details
#initialize(name, options = {}) ⇒ DataFilter
Returns a new instance of DataFilter.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'app/helpers/kirgudu_base/models/data_filter.rb', line 7 def initialize(name, = {}) ||= {} self.name = name # ** SETTING NAME ** self.css_span = [:span].to_s if [:span] # ** SETTING SPAN ** self.css_class = [:class].to_s if [:class] # ** SETTING CLASS ** self.input_type = [:input_type] || :text_edit # ** SETTING INPUT TYPE ** self.filter_name = [:filter_name] # ** SETTING INPUT TYPE ** self.placeholder = [:placeholder] # ** SETTING PLACEHOLDER ** self.label = [:label] # ** SETTING LABEL ** self.parent = [:parent] # ** SETTING PARENT ** self.source = [:source] # ** SETTING SOURCE ** self.source_url = [:source_url] # ** SETTING SOURCE URL ** # ******************* SETTING MASS ASSIGNMENT ***************************** if [:mass_assignment].is_a?(Array) [:mass_assignment].each do |ma_val| unless [:create, :update, :in_place].include?(ma_val) raise "FORM PROPERTY ERROR\r\nForm Property: \"#{name}\".\r\nValue \"#{ma_val}\" is not allowed for array of values of \"mass_assignment\" option" end if [:mass_assignment].include?(ma_val) raise "FORM PROPERTY ERROR\r\nForm Property: \"#{name}\".\r\nDuplicate value \"#{ma_val}\" in array of values of \"mass_assignment\" option" end self.mass_assignment.push(ma_val) end else if [:mass_assignment] == :all [:create, :update, :in_place].each do |ma| self.mass_assignment.push(ma) end elsif [:mass_assignment] == :none elsif [:create, :update, :in_place].include?([:mass_assignment]) self.mass_assignment.push([:mass_assignment]) else if [:mass_assignment] raise "FORM PROPERTY ERROR\r\nForm Property \"#{name}\".\r\nValue \"#{options[:mass_assignment]}\" is not allowed for \"mass_assignment\" option" else [:mass_assignment] = [:create, :update, :in_place] end end end #validateing property by input_type case self.input_type when :chosen_select validate_chosen_select when :autocomplete_with_id validate_autocomplete_with_id when :switcher when :date_picker when :time_picker when :image_selector when :check_box when :radio_button when :link when :elastic_text_area when :text_area when :text_edit else raise "Data Filter: '#{self.name}'\r\nINPUT TYPE #{self.input_type} is not supported at the moment" end validate_attribute_class # validating class attribute validate_attribute_span # validating span attribute end |
Instance Attribute Details
#css_class ⇒ Object
Returns the value of attribute css_class.
81 82 83 |
# File 'app/helpers/kirgudu_base/models/data_filter.rb', line 81 def css_class @css_class end |
#css_span ⇒ Object
Returns the value of attribute css_span.
80 81 82 |
# File 'app/helpers/kirgudu_base/models/data_filter.rb', line 80 def css_span @css_span end |
#filter_name ⇒ Object
Returns the value of attribute filter_name.
79 80 81 |
# File 'app/helpers/kirgudu_base/models/data_filter.rb', line 79 def filter_name @filter_name end |
#input_type ⇒ Object
Returns the value of attribute input_type.
82 83 84 |
# File 'app/helpers/kirgudu_base/models/data_filter.rb', line 82 def input_type @input_type end |
#label ⇒ Object
Returns the value of attribute label.
83 84 85 |
# File 'app/helpers/kirgudu_base/models/data_filter.rb', line 83 def label @label end |
#name ⇒ Object
Returns the value of attribute name.
78 79 80 |
# File 'app/helpers/kirgudu_base/models/data_filter.rb', line 78 def name @name end |
#on_change ⇒ Object
Returns the value of attribute on_change.
88 89 90 |
# File 'app/helpers/kirgudu_base/models/data_filter.rb', line 88 def on_change @on_change end |
#parent ⇒ Object
Returns the value of attribute parent.
85 86 87 |
# File 'app/helpers/kirgudu_base/models/data_filter.rb', line 85 def parent @parent end |
#placeholder ⇒ Object
Returns the value of attribute placeholder.
84 85 86 |
# File 'app/helpers/kirgudu_base/models/data_filter.rb', line 84 def placeholder @placeholder end |
#source ⇒ Object
Returns the value of attribute source.
86 87 88 |
# File 'app/helpers/kirgudu_base/models/data_filter.rb', line 86 def source @source end |
#source_url ⇒ Object
Returns the value of attribute source_url.
87 88 89 |
# File 'app/helpers/kirgudu_base/models/data_filter.rb', line 87 def source_url @source_url end |