% # encoding: utf-8 %> <%= javascript_include_tag "lib/bootstrap-datetimepicker" %> <%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %> <%= javascript_include_tag "survey-front-form" %> <% data = action_data @survey = data["survey"] @questions = data["questions"] @sections = @survey.survey_sections start_paginations = @survey.survey_paginations.pluck(:start_section) end_paginations = @survey.survey_paginations.pluck(:end_section) qnum_start = 1 qnums = [-1]*@questions.count s = 0 @sections.collect do |section| e = section.end_question mode = section.qnum_mode len = e-s case mode when 0 v = (qnum_start...(qnum_start+len)).to_a qnum_start += len when 1 v = [nil]*len when 2 qnum_start = len+1 v = (1..len).to_a end qnums[s,len] = v s = e end if qnums.index(-1) s = qnums.index(-1) e = @questions.count len = e-s qnum_start = qnums[0...s].compact[-1] + 1 rescue nil if qnum_start qnums[s,len] = (qnum_start...(qnum_start+len)).to_a else qnums[s,len] = (s+1..s+len).to_a end end headers = @survey.survey_sections.pluck(:start_question) footers = @survey.survey_sections.pluck(:end_question) @jump_tos_map = data["jump_tos_map"] @answers = data["answers"] answer_present = data['answer_present'] @redirect_url = data["redirect_url"] section_index_tmp = -1 section_index = "[other]" pagination_index = 0 qnum = 0 show_page_url = data["show_page_url"] %> <% if @survey.needs_login && current_user.nil? %> <% elsif answer_present %> <% end %> <% if !@redirect_url.blank? %> <% else %> <% unless @survey.deadline && Time.now > @survey.deadline %>