<h1><%= @survey.title %> <%= t('survey.jump') %></h1>

<%= form_for @survey, :url => panel_survey_back_end_survey_path(@survey), :html => {:class => 'clear'} do |f| %>
  <div id="post-body">
    <div id="post-body-content" class="clear">
      <div class="jump_mode">
        <%= f.label :jump_mode, t('survey.jump_mode')%> 
        <%= f.check_box :jump_mode %>
      </div>

      <% @questions.each_with_index do |question, i| %>

        <%= f.fields_for :survey_questions, question do |f| %>

          <div id="<%= "survey_question_#{question.id}"%>" class="survey_question_item clear">
            <div id="widget-question" class="widget-box">
              <h3 class="widget-title"><i class="icons-help"></i><%= question.title %></h3>
              <div class="widget-content">
                <% if question.jumpable? %>
                  <% if question.can_set_jump? %>
                    <ol>
                      <% question.survey_question_options.each_with_index do |option, i| %>

                        <%= f.fields_for :survey_question_options, option do |f| %>

                          <li>
                            <%= f.label :survey_question_options, option.name %>
                            <%= f.select :jump_to, @jump_to_options %>
                          </li>
                          
                        <% end %>

                      <% end %>
                    </ol>
                  <% else %>
                    <%= t('survey.right_type_cant_jump') %>
                  <% end %>
                <% else %>
                  <%= t('survey.wrong_type_cant_jump') %>
                <% end %>
              </div>
            </div>
          </div>

        <% end %>

      <% end %>

      <div class="form-actions">
        <%= hidden_field_tag 'page', params[:page] if !params[:page].blank? %>
        <%= f.submit t('submit'), :class=>'btn btn-primary' %>
        <%= link_to t('cancel'), get_go_back, :class=>"btn" %> 
      </div>
    </div>
  </div>
<% end %>