Sha256: 462fec1e8b2493ce611ae16e3301456be4323135d0939b0f31e0bebf6f74f490

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

-last_question = Question.new
=f.fields_for(:answers) do |a|
  -question = a.object.question
  -if(question.rhetorical?)
    %h3.section
      =question.name
    %p.section.instructions
      =question.instructions
  -else
    =a.hidden_field(:question_id, :value=>question.id)
    -if question.name != last_question.name
      %dt
        =question_label(question, a)
        =question_instructions(question)
        -if question.required
          %strong{:style=>"color:red;"} *
    -case(question.type.to_sym)

    -when :TextQuestion
      %dd=a.text_field(:answer)

    -when :EssayQuestion
      %dd=a.text_area(:answer)

    -when :ChooseOneQuestion
      -if question.choices.count > 5
        %dd=a.collection_select(:answer, question.choice_names, :to_s, :to_s, :include_blank=>!question.required)
      -else
        -question.choices.each do |choice|
          %dd
            =a.radio_button(:answer, choice.name)
            =a.label(:answer, choice.name, :value=>choice.name)
      
    -when :ChecklistQuestion
      %dd
        =a.hidden_field(:choice_id, :value=>a.object.choice_id)
        =a.check_box(:answer, {}, a.object.choice.try(:name), '')
        =a.label(:answer, a.object.choice.try(:name))
  -last_question = question

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ask-0.1.0 app/views/answerer/_form.html.haml