Class: Fe::QuestionGrid

Inherits:
Element show all
Defined in:
app/models/fe/question_grid.rb

Direct Known Subclasses

QuestionGridWithTotal

Instance Attribute Summary

Attributes inherited from Element

#old_id

Instance Method Summary collapse

Methods inherited from Element

#all_elements, #conditional_answers, #conditional_match, #content, create_from_import, #css_classes, #duplicate, #export_to_yaml, #hidden?, #hidden_by_choice_field?, #hidden_by_conditional?, #label, #limit, #matches_filter, max_label_length, #page_id, #pages_on, #position, #previous_element, #ptemplate, #question?, #required?, #reuseable?, #set_conditional_element, #set_position, #tooltip, #update_any_previous_conditional_elements, #update_page_all_element_ids, #visibility_affecting_element_ids, #visibility_affecting_questions, #visible?

Instance Method Details

#export_hashObject



25
26
27
28
29
30
31
32
33
34
35
# File 'app/models/fe/question_grid.rb', line 25

def export_hash
  super_hash = super
  children = elements.collect do |e|
    h = e.export_hash
    h[:question_grid_id] = :parent_id
    h
  end

  super_hash[:children] += children
  super_hash
end

#has_response?(answer_sheet = nil) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'app/models/fe/question_grid.rb', line 21

def has_response?(answer_sheet = nil)
  elements.any? {|e| e.has_response?(answer_sheet)}
end

#num_colsObject



15
16
17
18
19
# File 'app/models/fe/question_grid.rb', line 15

def num_cols
  num = cols.to_s.split(';').length
  num = 1 if num == 0
  num
end