Class: UiObject
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(*args) ⇒ UiObject
Returns a new instance of UiObject.
56
57
58
59
|
# File 'lib/question_chain/models/ui_object.rb', line 56
def initialize(*args)
super
add_rule_observers!
end
|
Instance Attribute Details
#value ⇒ Object
26
27
28
|
# File 'lib/question_chain/models/ui_object.rb', line 26
def value
@value
end
|
Class Method Details
.attributes_for_api ⇒ Object
47
48
49
|
# File 'lib/question_chain/models/ui_object.rb', line 47
def self.attributes_for_api
%w(id name _type label description default_value ui_attributes ui_group_id rules extra_info css_classes)
end
|
Instance Method Details
#change_value!(ui_objects = []) ⇒ Object
fires the rules that are attached the ui object
62
63
64
65
66
67
68
|
# File 'lib/question_chain/models/ui_object.rb', line 62
def change_value!(ui_objects = [])
if ui_object = ui_objects.detect{|ui| ui["id"] == self.id.to_s}
value = ui_object["ui_attributes"] && ui_object["ui_attributes"]["value"] || ""
@observer_state = true
notify_observers(value, ui_objects)
end
end
|
#enabled? ⇒ Boolean
74
75
76
|
# File 'lib/question_chain/models/ui_object.rb', line 74
def enabled?
ui_attributes[:enabled]
end
|
#per_page ⇒ Object
need as added a little late in the day basically
52
53
54
|
# File 'lib/question_chain/models/ui_object.rb', line 52
def per_page
read_attribute(:per_page) || 50
end
|
#visible? ⇒ Boolean
70
71
72
|
# File 'lib/question_chain/models/ui_object.rb', line 70
def visible?
ui_attributes[:visible]
end
|