Class: UiObjects::ObjectReferenceDropDown
- Defined in:
- lib/question_chain/models/ui_objects/object_reference_drop_down.rb
Instance Attribute Summary
Attributes inherited from UiObject
Class Method Summary collapse
Instance Method Summary collapse
-
#get_target_drop_down_options(object_ids = []) ⇒ Object
object_reference drop down can only target its formula units basically only 1 object in this instance.
- #options ⇒ Object
Methods inherited from UiObject
#change_value!, #enabled?, #initialize, #per_page, #visible?
Constructor Details
This class inherits a constructor from UiObject
Class Method Details
.attributes_for_api ⇒ Object
33 34 35 |
# File 'lib/question_chain/models/ui_objects/object_reference_drop_down.rb', line 33 def self.attributes_for_api %w(id name _type label description rules default_value ui_attributes options prompt max_options object_name drop_down_target_id extra_info css_classes) end |
Instance Method Details
#get_target_drop_down_options(object_ids = []) ⇒ Object
object_reference drop down can only target its formula units basically only 1 object in this instance
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/question_chain/models/ui_objects/object_reference_drop_down.rb', line 39 def (object_ids = []) if object_id = object_ids.first formula_inputs = QuestionChain.calculated_session.formula_inputs_for_generic_object(object_id.to_s) if respond_to?(:drop_down_target_options_filters) && !.empty? selected_formula_inputs = formula_inputs.select{|f| .map(&:downcase).include?(f.name.downcase)} selected_formula_inputs.inject({}){|var, fi| var.merge!({fi.name => fi.label_input_units}); var} else formula_inputs.inject({}){|var, fi| var.merge!({fi.name => fi.label_input_units}); var} end end end |
#options ⇒ Object
28 29 30 31 |
# File 'lib/question_chain/models/ui_objects/object_reference_drop_down.rb', line 28 def return [] if !populate @options ||= (object_name, filters || []) end |