<%= form_for :answer, :method => :put, :url => panel_survey_front_end_survey_path(@survey, :standalone => true), :html => {:class => 'survey clear'} do |f| %>
<%= @survey.title %>
<%= @survey.description %>
<% @questions.each_with_index do |question, i| %>
-
<% label = question.title %>
<% if question.is_required %>
(*)
<% end %>
<%= f.label question.id, label, :class => "o-question-title" %>
<%= question.description %>
<% case question.type %>
<% when ::SurveyQuestion::Oneline %>
<%= f.text_field question.id, :required => question.is_required %>
<% when ::SurveyQuestion::Multiline %>
<%= f.text_area question.id, :rows => 5, :required => question.is_required %>
<% when ::SurveyQuestion::Radio %>
<% question.survey_question_options.each do |option| %>
-
<%= f.radio_button question.id, option.id %>
<%= f.label "#{question.id}_#{option.id}", option.name, :class => 'o-question-option' %>
<% end %>
<% if question.custom_option %>
-
<%= f.radio_button question.id, 'custom_option' %>
<%= f.label "#{question.id}_custom_option", t('survey_question.use_custom_option') + ': ', :class => 'o-question-option' %>
<%= f.text_field "#{question.id}_custom_option" %>
<% end %>
<% when ::SurveyQuestion::Check %>
<%= f.fields_for "#{question.id}" do |cf| %>
<% question.survey_question_options.each do |option| %>
-
<%= cf.check_box option.id %>
<%= cf.label option.id, option.name, :class => 'o-question-option' %>
<% end %>
<% if question.custom_option %>
-
<%= cf.check_box 'custom_option' %>
<%= f.label "#{question.id}_custom_option", t('survey_question.use_custom_option') + ': ', :class => 'o-question-option' %>
<%= f.text_field "#{question.id}_custom_option" %>
<% end %>
<% end %>
<% when ::SurveyQuestion::Select %>
<% options = question.survey_question_options.collect {|o| [ o.name, o.id ] } %>
<% if question.custom_option %>
<% options.push [t('survey_question.use_custom_option'), 'custom_option'] %>
<% end %>
<%= f.select question.id, options, {}, :class => 'o-question-group view-dropdown' %>
<% if question.custom_option %>
<%= f.text_field "#{question.id}_custom_option", :class => 'custom_option' %>
<% end %>
<% when ::SurveyQuestion::Radiogroup %>
<%= f.fields_for "#{question.id}" do |rgf| %>
|
<% question.survey_question_radiogroups.each do |radiogroup| %>
<%= radiogroup.name %>
|
<% end %>
<% question.survey_question_options.each_with_index do |option, j| %>
>
<%= option.name %>
|
<% question.survey_question_radiogroups.each do |radiogroup| %>
<%= rgf.radio_button option.id, radiogroup.id %>
|
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>
<%= f.submit t('submit'), :class => 'survey-submit' %>
<% end %>
<% content_for :page_stylesheets do %>