1、修改标题头、取消修改标题头数据的保存和页面的变更
This commit is contained in:
parent
99ffc8a643
commit
20c160f03f
|
@ -60,12 +60,14 @@ class PollController < ApplicationController
|
|||
end
|
||||
|
||||
def update
|
||||
@poll.polls_name = params[:polls_name]
|
||||
@poll.polls_name = params[:polls_name].empty? ? l(:label_poll_title) : params[:polls_name]
|
||||
@poll.polls_description = params[:polls_description].empty? ? l(:label_poll_description) : params[:polls_description]
|
||||
if @poll.save
|
||||
respond_to do |format|
|
||||
format.html { redirect_to poll_index_url(:polls_type => @course.class.to_s, :polls_group_id => @course.id) }
|
||||
format.js
|
||||
end
|
||||
else
|
||||
render_404
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -98,7 +100,7 @@ class PollController < ApplicationController
|
|||
answer = (params[:question_answer].values[i-1].nil? || params[:question_answer].values[i-1].empty?) ? l(:label_new_answer) : params[:question_answer].values[i-1]
|
||||
question_option = {
|
||||
:answer_position => i,
|
||||
:answer_text => params[:question_answer].values[i-1]
|
||||
:answer_text => answer
|
||||
}
|
||||
@poll_questions.poll_answers.new question_option
|
||||
end
|
||||
|
|
|
@ -1,21 +1,15 @@
|
|||
<script type="text/javascript">
|
||||
function regexPollsTitle()
|
||||
{
|
||||
var polls_title = $.trim($("#polls_title").val());
|
||||
alert(polls_title);
|
||||
}
|
||||
</script>
|
||||
<div class="ur_editor ur_title_editor"> <!--编辑头部start-->
|
||||
<div class="ur_title_editor_title">
|
||||
<input type="text" name="title" id="polls_title" class="input_title" placeholder="问卷标题" onkeyup="regexPollsTitle();"/>
|
||||
</div>
|
||||
<div class="ur_title_editor_prefix">
|
||||
<textarea name="prefix" class="textarea_editor" placeholder="问卷描述">
|
||||
</textarea>
|
||||
</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 @poll,:remote => true do |f|%>
|
||||
<div class="ur_editor ur_title_editor"> <!--编辑头部start-->
|
||||
<div class="ur_title_editor_title">
|
||||
<input type="text" name="polls_name" id="polls_title" value="<%= @poll.polls_name %>" class="input_title" placeholder="问卷标题"/>
|
||||
</div>
|
||||
<div class="ur_title_editor_prefix">
|
||||
<textarea name="polls_description" class="textarea_editor"><%= @poll.polls_description%></textarea>
|
||||
</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="pollsCancel();">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--编辑头部 end-->
|
||||
<% end%>
|
||||
|
|
|
@ -10,6 +10,11 @@
|
|||
function add_MCQ(){$("#poll_content").append("<%= escape_javascript(render :partial => 'edit_MCQ') %>");}
|
||||
function add_single(){$("#poll_content").append("<%= escape_javascript(render :partial => 'edit_single') %>");}
|
||||
function add_mulit(){$("#poll_content").append("<%= escape_javascript(render :partial => 'edit_mulit') %>");}
|
||||
//问卷头
|
||||
function pollsCancel()
|
||||
{
|
||||
$("#polls_head").html("<%= escape_javascript(render :partial => 'show_head', :locals => {:poll => @poll}) %>");
|
||||
}
|
||||
//单选题
|
||||
function add_single_answer(doc)
|
||||
{
|
||||
|
@ -60,7 +65,10 @@
|
|||
<div class="cl"></div>
|
||||
</div><!--选项 end-->
|
||||
|
||||
<%= render :partial => 'edit_head'%>
|
||||
<div id="polls_head">
|
||||
<%#= render :partial => 'show_head', :locals => {:poll => @poll} %>
|
||||
<%= render :partial => 'edit_head', :locals => {:poll => @poll}%>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<% @poll.poll_questions.each do |poll_question|%>
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
<div class="ur_page_head ur_editor02" ><!--头部显示 start-->
|
||||
<h1 class="ur_page_title">标题标题标题标题标题标题标题</h1>
|
||||
<p class="ur_prefix_content">描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述
|
||||
描述描述描述描述描述描述描述描述描述描述描述描述
|
||||
</p>
|
||||
<div class="ur_page_head ur_editor02"><!--头部显示 start-->
|
||||
<a href="#" class="ur_icon_edit" title="编辑"></a>
|
||||
<h1 class="ur_page_title">
|
||||
<%= poll.polls_name%>
|
||||
</h1>
|
||||
<p class="ur_prefix_content">
|
||||
<%= @poll.polls_description%>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
</div><!--头部显示 end-->
|
|
@ -0,0 +1 @@
|
|||
$("#polls_head").html("<%= escape_javascript(render :partial => 'show_head', :locals => {:poll => @poll}) %>");
|
|
@ -2251,5 +2251,7 @@ zh:
|
|||
label_mulit: 多行文字
|
||||
label_enter_single_title: 请输入单选题标题
|
||||
label_new_answer: 新建选项
|
||||
label_poll_title: 问卷标题
|
||||
label_poll_description: 问卷描述
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue