socialforge/app/views/poll/update_question_num.js.erb

34 lines
2.9 KiB
Plaintext

//$("#poll_content").html('<%#= escape_javascript(render :partial => 'poll_content', :locals => {:poll => @poll})%>');
<% if @before_que %>
$("#poll_questions_<%= @poll_question.id%>").insertBefore($("#poll_questions_<%= @before_que.id%>"));
<% if @before_que.question_type == 1%>
$("#show_poll_questions_<%= @before_que.id %>").html("<%= escape_javascript(render :partial => 'show_MC', :locals => {:poll_question => @before_que}) %>");
<% elsif @before_que.question_type == 2%>
$("#show_poll_questions_<%= @before_que.id %>").html("<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:poll_question => @before_que}) %>");
<% elsif @before_que.question_type == 3%>
$("#show_poll_questions_<%= @before_que.id %>").html("<%= escape_javascript(render :partial => 'show_single', :locals => {:poll_question => @before_que}) %>");
<% elsif @before_que.question_type == 4%>
$("#show_poll_questions_<%= @before_que.id %>").html("<%= escape_javascript(render :partial => 'show_mulit', :locals => {:poll_question => @before_que}) %>");
<% end%>
<% elsif @after_que %>
$("#poll_questions_<%= @poll_question.id%>").insertAfter($("#poll_questions_<%= @after_que.id%>"));
$("#poll_question_number_<%=@after_que.id %>").html("<%=@after_que.question_number %>");
<% if @after_que.question_type == 1%>
$("#show_poll_questions_<%= @after_que.id %>").html("<%= escape_javascript(render :partial => 'show_MC', :locals => {:poll_question => @after_que}) %>");
<% elsif @after_que.question_type == 2%>
$("#show_poll_questions_<%= @after_que.id %>").html("<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:poll_question => @after_que}) %>");
<% elsif @after_que.question_type == 3%>
$("#show_poll_questions_<%= @after_que.id %>").html("<%= escape_javascript(render :partial => 'show_single', :locals => {:poll_question => @after_que}) %>");
<% elsif @after_que.question_type == 4%>
$("#show_poll_questions_<%= @after_que.id %>").html("<%= escape_javascript(render :partial => 'show_mulit', :locals => {:poll_question => @after_que}) %>");
<% end%>
<% end %>
<% if @poll_question.question_type == 1%>
$("#show_poll_questions_<%= @poll_question.id %>").html("<%= escape_javascript(render :partial => 'show_MC', :locals => {:poll_question => @poll_question}) %>");
<% elsif @poll_question.question_type == 2%>
$("#show_poll_questions_<%= @poll_question.id %>").html("<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:poll_question => @poll_question}) %>");
<% elsif @poll_question.question_type == 3%>
$("#show_poll_questions_<%= @poll_question.id %>").html("<%= escape_javascript(render :partial => 'show_single', :locals => {:poll_question => @poll_question}) %>");
<% elsif @poll_question.question_type == 4%>
$("#show_poll_questions_<%= @poll_question.id %>").html("<%= escape_javascript(render :partial => 'show_mulit', :locals => {:poll_question => @poll_question}) %>");
<% end%>