Class: KirguduBase::DynamicPages::FormProperty

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

Instance Attribute Summary collapse

Attributes inherited from Property

#data_source, #description, #format, #help, #label, #parent, #placeholder, #text_value_property, #tooltip

Attributes inherited from PageElement

#enabled, #html_options, #id, #name, #use_i18n, #visible

Attributes inherited from Element

#parent_entry

Instance Method Summary collapse

Methods inherited from PageElement

#i18n_data_as_string

Methods inherited from Element

#as_json, #fix_parent_entry, #kontroller_klass

Methods included from Models::MergeableElements::ClassMethods

#get_mergeable_attributes, #mergeable_attributes

Methods included from Models::FixableElements::ClassMethods

#fixable_attributes, #get_kb_fixable_attributes

Methods included from Models::FixableElements::InstanceMethods

#fix_parent_entry

Methods included from Models::MergeableElements::InstanceMethods

#merge

Constructor Details

#initialize(options = {}) ⇒ FormProperty

Returns a new instance of FormProperty.



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

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.



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

def events
  @events
end

#input_typeObject

Returns the value of attribute input_type.



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

def input_type
  @input_type
end

#max_lengthObject

Returns the value of attribute max_length.



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

def max_length
  @max_length
end

#read_onlyObject

Returns the value of attribute read_only.



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

def read_only
  @read_only
end

Instance Method Details

#events_for_jsonObject



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

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

#must_have_data_source?Boolean

Returns:

  • (Boolean)


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

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

#to_external_hash(options = {}) ⇒ Object



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

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

	               })

	super(options)
end