Class: Answers::UiObjectView

Inherits:
MustacheRails show all
Defined in:
lib/question_chain/models/answers/ui_object_view.rb

Instance Method Summary collapse

Methods inherited from MustacheRails

#initialize, #method_missing, #render, #respond_to?, #template=

Constructor Details

This class inherits a constructor from MustacheRails

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class MustacheRails

Instance Method Details

#css_classesObject



16
17
18
# File 'lib/question_chain/models/answers/ui_object_view.rb', line 16

def css_classes
  ui_object.css_classes.join(" ")
end

#default_stylesObject



44
45
46
47
48
49
50
51
52
# File 'lib/question_chain/models/answers/ui_object_view.rb', line 44

def default_styles
  default_styles = ""
  ui_object.ui_attributes.each_pair do |key, value|
    if key.to_s == "visible" && value == "false"
      default_styles << "display:none;visibility:hidden;"
    end
  end
  default_styles
end

#default_valueObject



40
41
42
# File 'lib/question_chain/models/answers/ui_object_view.rb', line 40

def default_value
  ui_object.default_value
end

#disabledObject



54
55
56
# File 'lib/question_chain/models/answers/ui_object_view.rb', line 54

def disabled
  ui_object.ui_attributes["disable"] == "true"
end

#dom_idObject



4
5
6
# File 'lib/question_chain/models/answers/ui_object_view.rb', line 4

def dom_id
  "ui_object_#{ui_object.id}"
end

#extra_infoObject



12
13
14
# File 'lib/question_chain/models/answers/ui_object_view.rb', line 12

def extra_info
  ui_object.try(:extra_info)
end

#has_extra_infoObject



20
21
22
# File 'lib/question_chain/models/answers/ui_object_view.rb', line 20

def has_extra_info
  !extra_info.blank?
end

#input_idObject



8
9
10
# File 'lib/question_chain/models/answers/ui_object_view.rb', line 8

def input_id
  "ui_input_#{ui_object.id}"
end

#labelObject



24
25
26
# File 'lib/question_chain/models/answers/ui_object_view.rb', line 24

def label
  ui_object.label
end

#nameObject



36
37
38
# File 'lib/question_chain/models/answers/ui_object_view.rb', line 36

def name
  "answer[#{ui_object.name}]"
end

#ui_object_nameObject



32
33
34
# File 'lib/question_chain/models/answers/ui_object_view.rb', line 32

def ui_object_name
  ui_object.name
end

#valueObject



28
29
30
# File 'lib/question_chain/models/answers/ui_object_view.rb', line 28

def value
  answer_params[ui_object_name] if answer_params
end