jipe_app/app/views/survey_sets/_form.html.haml
2017-08-14 10:53:30 +02:00

104 lines
2.9 KiB
Plaintext

=#form_for SurveySet.find(5) do |f|
=form_for @survey_set do |f|
=f.hidden_field :survey_type_id
-i =0
-@survey_set.survey_type.survey_steps.each do |survey_step|
-i += 1
=hidden_field_tag :survey_set_step, @survey_set_step
-if i == @survey_set_step
-jauge = (i-1)*33.33
.step#step{:id => i}
.jauge
.inner_step{:style => "width:#{jauge}%;"}
.step_point.step_point_1{:class => ("active" if i >= 1).to_s}
.step_point.step_point_2{:class => ("active" if i >= 2).to_s}
.step_point.step_point_3{:class => ("active" if i >= 3).to_s}
.step_point.step_point_4{:class => ("active" if i >= 4).to_s}
%h2
=survey_step.name
-survey_step.survey_groups.each do |survey_group|
-@group_type = survey_group.group_type
-if survey_group.group_type == 2
.group#group{:id => survey_group.slug.to_s}
%h3
=raw survey_group.name
-if survey_group.group_type == 2 and survey_group.survey_items.count > 0
.group#group{:id => survey_group.slug.to_s}
%table
%tr
%th
-survey_group.survey_items.first.answers.each do |answer|
%th
=answer.label_text
-survey_group.survey_items.each do |survey_item|
= f.fields_for(:question_sets) do |f|
-if f.object.survey_item.id == survey_item.id
=f.hidden_field :survey_item_id
=render :partial => "survey_sets/question_set", :locals => {:f => f, :item => f.object.survey_item}
-else
.group#group{:id => survey_group.slug.to_s}
-survey_group.survey_items.each do |survey_item|
= f.fields_for(:question_sets) do |f|
-if f.object.survey_item.id == survey_item.id
=f.hidden_field :survey_item_id
=render :partial => "survey_sets/question_set", :locals => {:f => f, :item => f.object.survey_item}
.step_links
%p
-if i > 1
=link_to "Revenir à l'étape précédente", new_survey_set_path(:slug => @survey_set.survey_type.slug, :survey_set_step => (@survey_set_step-1))
-if i == 4
=f.submit "Envoyer ma réponse"
-else
=f.submit "Etape suivante"
=# f.fields_for(:question_sets) do |f|
=#f.hidden_field :survey_item_id
=#render :partial => "survey_sets/question_set", :locals => {:f => f, :item => f.object.survey_item}