Sha256: e68f54de5e5195e5b9e60d7915c3bc12cf8200b3156b360160d472b060c72f89

Contents?: true

Size: 1.75 KB

Versions: 3

Compression:

Stored size: 1.75 KB

Contents

-# TODO: js for slider
- rg ||= nil
- renderer = q.renderer(g ||= nil)
- disabled = defined?(disableFlag) ? disableFlag : false
- unless q.display_type == "hidden"
  = f.inputs q_text(q, @render_context), :id => rg ? "q_#{q.id}_#{rg}" : "q_#{q.id}", :class => "q_#{renderer} #{q.css_class(@response_set)}" do
    %span.help= render_help_text(q, @render_context)
    - case renderer
    - when :image, :label
    - when :dropdown, :inline_dropdown, :default_dropdown, :slider, :repeater_dropdown
      - r = response_for(@response_set, q, nil, rg)
      - i = response_idx
      = f.semantic_fields_for i, r do |ff|
        = ff.input :question_id, :as => :quiet
        = ff.input :response_group, :as => :quiet, :value => rg if g && g.display_type == "repeater"
        = ff.input :api_id, :as => :quiet
        = ff.input :answer_id, :as => :select, :collection => q.answers.map{|a| [a.text, a.id]}, :include_blank => (renderer != :slider), :label => q.text, :input_html => { :disabled => disabled }
    - 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.input :question_id, :as => :quiet
          = ff.input :response_group, :as => :quiet, :value => rg if g && g.display_type == "repeater"
          = ff.input :api_id, :as => :quiet
      - q.answers.each do |a|
        - next if (q.pick == "one" or q.pick == "any") and disabled and @response_set.responses.where( :question_id => q.id, :answer_id => a.id).empty?
        = render a.custom_renderer || '/partials/answer', :q => q, :a => a, :f => f, :rg => rg, :g => g, :disableFlag => disabled

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
surveyor-1.2.0 app/views/partials/_question.html.haml
surveyor-1.1.0 app/views/partials/_question.html.haml
surveyor-1.0.1 app/views/partials/_question.html.haml