parent
f46c8e8adc
commit
65a3ddce41
|
@ -119,8 +119,7 @@ class PollController < ApplicationController
|
|||
#修改单选题
|
||||
def update_poll_question
|
||||
@poll_question = PollQuestion.find params[:poll_question]
|
||||
@poll = @poll_question.poll
|
||||
|
||||
#@poll = @poll_question.poll
|
||||
@poll_question.is_necessary = params[:is_necessary]=="true" ? 1 : 0
|
||||
@poll_question.question_title = params[:poll_questions_title].nil? || params[:poll_questions_title].empty? ? l(:label_enter_single_title) : params[:poll_questions_title]
|
||||
################处理选项
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
<%= form_for("",:url => update_poll_question_poll_index_path(:poll_question => poll_question.id),:remote => true) do |f|%>
|
||||
<div class="ur_editor text "> <!--编辑单行文字start-->
|
||||
<div class="ur_editor_title">
|
||||
<label for="ur_question_title">问题: </label>
|
||||
<input id="ur_question_title_1" class="ur_question_title" contenteditable="true" type="text" name="title" placeholder="请输入单行文字标题"/>
|
||||
<input type="checkbox" name="required" value="true" id="ur_question_require_2" checked=""/>
|
||||
<input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/>
|
||||
<input id="poll_questions_title_<%=poll_question.id%>" class="ur_question_title" contenteditable="true" type="text"
|
||||
name="poll_questions_title" placeholder="请输入单行文字标题" value="<%= poll_question.question_title%>"/>
|
||||
<input type="checkbox" name="is_necessary" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/>
|
||||
<label for="ur_question_require">必答</label>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn_submit" data-button="ok">确定</a>
|
||||
<a class="btn_cancel" data-button="cancel">取消</a>
|
||||
<a class="btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();">确定</a>
|
||||
<a class="btn_cancel" data-button="cancel" onclick="pollQuestionCancel(<%= poll_question.id%>);">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--编辑单行文字end-->
|
||||
</div><!--编辑单行文字end-->
|
||||
<% end%>
|
|
@ -1,13 +1,16 @@
|
|||
<div class="ur_editor text "> <!--编辑单行文字start-->
|
||||
<div class="ur_editor_title">
|
||||
<label for="ur_question_title">问题: </label>
|
||||
<input id="poll_questions_title" class="ur_question_title" contenteditable="true" type="text" name="title" placeholder="请输入单行文字标题"/>
|
||||
<input type="checkbox" name="required" value="true" id="ur_question_require_2" checked=""/>
|
||||
<label for="ur_question_require">必答</label>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn_submit" data-button="ok">确定</a>
|
||||
<a class="btn_cancel" data-button="cancel">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--编辑单行文字end-->
|
||||
<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>
|
||||
<div class="ur_editor text "> <!--编辑单行文字start-->
|
||||
<div class="ur_editor_title">
|
||||
<label for="ur_question_title">问题: </label>
|
||||
<input type="hidden" name="question_type" value="3"/>
|
||||
<input id="poll_questions_title" class="ur_question_title" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入单行文字标题"/>
|
||||
<input type="checkbox" name="is_necessary" value="true" checked/>
|
||||
<label for="ur_question_require">必答</label>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();">确定</a>
|
||||
<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--编辑单行文字end-->
|
||||
<% end%>
|
|
@ -1,9 +1,17 @@
|
|||
<div class="ur_question_item text ur_editor02 ">
|
||||
<div class="ur_title">
|
||||
<span class="title_index">第3题:</span> 单行文字
|
||||
<span class="title_index">
|
||||
第<%= poll_question.question_number%>题:
|
||||
</span>
|
||||
<%= poll_question.question_title %>
|
||||
<%if poll_question.is_necessary == 1%>
|
||||
<span class="ur_required" title="必答">*</span>
|
||||
<%end%>
|
||||
(单行文字)
|
||||
</div>
|
||||
<a href="#" class="ur_icon_de" title="删除"></a>
|
||||
<a href="#" class="ur_icon_edit" title="编辑"></a>
|
||||
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
|
||||
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
|
||||
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
|
||||
<div class="cl"></div>
|
||||
<div class="ur_inputs">
|
||||
<input class="ur_text ur_textbox" type="text" size="" maxlength=""value="">
|
||||
|
|
|
@ -1,6 +1,22 @@
|
|||
$("#poll_questions_<%= @poll_question.id%>").html("<div id='show_poll_questions_<%= @poll_question.id %>'>" +
|
||||
"<%= escape_javascript(render :partial => 'show_MC', :locals => {:poll_question => @poll_question}) %>" +
|
||||
"<% if @poll_question.question_type == 1%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_MC', :locals => {:poll_question => @poll_question}) %>" +
|
||||
"<% elsif @poll_question.question_type == 2%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:poll_question => @poll_question}) %>" +
|
||||
"<% elsif @poll_question.question_type == 3%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_single', :locals => {:poll_question => @poll_question}) %>" +
|
||||
"<% elsif @poll_question.question_type == 4%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_mulit', :locals => {:poll_question => @poll_question}) %>" +
|
||||
"<% end%>" +
|
||||
"</div>" +
|
||||
"<div id='edit_poll_questions_<%= @poll_question.id %>' style='display: none;'>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_MC', :locals => {:poll_question => @poll_question}) %>" +
|
||||
"<% if @poll_question.question_type == 1%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_MC', :locals => {:poll_question => @poll_question}) %>" +
|
||||
"<% elsif @poll_question.question_type == 2%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_MCQ', :locals => {:poll_question => @poll_question}) %>" +
|
||||
"<% elsif @poll_question.question_type == 3%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_single', :locals => {:poll_question => @poll_question}) %>" +
|
||||
"<% elsif @poll_question.question_type == 4%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_mulit', :locals => {:poll_question => @poll_question}) %>" +
|
||||
"<% end%>" +
|
||||
"</div>");
|
||||
|
|
Loading…
Reference in New Issue