Sha256: 8cba1ab877b89edea9566e9e40e2f8a67a0498527ab4482628bb8d6b17b74753

Contents?: true

Size: 1.22 KB

Versions: 4

Compression:

Stored size: 1.22 KB

Contents

-# TODO: js for slider
- rg ||= nil
- renderer = q.renderer(g ||= nil)
- f.inputs q_text(q), :id => rg ? "q_#{q.id}_#{rg.id}" : "q_#{q.id}", :class => "q_#{renderer} #{q.css_class(@response_set)}" do
  %span.help= q.help_text
  - case renderer
  - when :image, :label
  - when :dropdown, :inline_dropdown, :slider
    - r = response_for(@response_set, q, nil, rg)
    - i = response_idx
    - f.semantic_fields_for i, r do |ff|
      = ff.quiet_input :question_id
      = ff.quiet_input :response_group, :value => rg if g && g.display_type == "repeater"
      = ff.input :answer_id, :as => :select, :collection => q.answers.map{|a| [a.text, a.id]}, :label => false
  - else # :default, :inline, :inline_default
    - if q.pick == "one"
      - r = response_for(@response_set, q, nil, rg)
      - i = response_idx  # increment the response index since the answer partial skips for q.pick == one
      - f.semantic_fields_for i, r do |ff|
        = ff.quiet_input :question_id
        = ff.quiet_input :response_group, :value => rg if g && g.display_type == "repeater"
        = ff.quiet_input :id unless r.new_record?
    - q.answers.each do |a|
      = render a.custom_renderer || '/partials/answer', :q => q, :a => a, :f => f, :rg => rg, :g => g

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
surveyor-0.19.3 app/views/partials/_question.html.haml
surveyor-0.19.2 app/views/partials/_question.html.haml
surveyor-0.19.1 app/views/partials/_question.html.haml
surveyor-0.19.0 app/views/partials/_question.html.haml