Class: KirguduBase::DynamicPages::FormProperty

Inherits:
Property
  • Object
show all
Defined in:
app/models/kirgudu_base/dynamic_pages/form_property.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ FormProperty

Returns a new instance of FormProperty.



15
16
17
18
19
20
21
22
23
# File 'app/models/kirgudu_base/dynamic_pages/form_property.rb', line 15

def initialize(options = {})
  self.input_type = :text_edit
  self.max_length = 0
  self.read_only = :false
  self.events = nil


  super(options)
end

Instance Attribute Details

#eventsObject

Returns the value of attribute events.



29
30
31
# File 'app/models/kirgudu_base/dynamic_pages/form_property.rb', line 29

def events
  @events
end

#input_typeObject

Returns the value of attribute input_type.



26
27
28
# File 'app/models/kirgudu_base/dynamic_pages/form_property.rb', line 26

def input_type
  @input_type
end

#max_lengthObject

Returns the value of attribute max_length.



27
28
29
# File 'app/models/kirgudu_base/dynamic_pages/form_property.rb', line 27

def max_length
  @max_length
end

#read_onlyObject

Returns the value of attribute read_only.



28
29
30
# File 'app/models/kirgudu_base/dynamic_pages/form_property.rb', line 28

def read_only
  @read_only
end

Instance Method Details

#events_for_jsonObject



41
42
43
# File 'app/models/kirgudu_base/dynamic_pages/form_property.rb', line 41

def events_for_json
  self.events ? self.events.map { |e| e.to_external_hash(nil) } : {}
end

#must_have_data_source?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'app/models/kirgudu_base/dynamic_pages/form_property.rb', line 46

def must_have_data_source?
  [:chosen_select, :select, :autocomplete_with_id, :autocomplete].include?(self.input_type)
end

#to_external_hash(options = {}) ⇒ Object



32
33
34
35
36
37
38
39
# File 'app/models/kirgudu_base/dynamic_pages/form_property.rb', line 32

def to_external_hash(options = {})
  options ||= {}
  options.merge!({

                 })

  super(options)
end