问卷编辑页面在发布问卷和点击问卷标题确认增加问卷标题不能为空的提示
This commit is contained in:
parent
016f4f9a0d
commit
dbdae2ac7e
|
@ -70,8 +70,8 @@ class PollController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@poll.polls_name = params[:polls_name].empty? ? l(:label_poll_title) : params[:polls_name]
|
@poll.polls_name = params[:polls_name]
|
||||||
@poll.polls_description = params[:polls_description].empty? ? l(:label_poll_description) : params[:polls_description]
|
@poll.polls_description = params[:polls_description]
|
||||||
if @poll.save
|
if @poll.save
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<textarea name="polls_description" maxlength="300" id="polls_description" class="textarea_editor"><%= @poll.polls_description%></textarea>
|
<textarea name="polls_description" maxlength="300" id="polls_description" class="textarea_editor"><%= @poll.polls_description%></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="ur_editor_footer">
|
<div class="ur_editor_footer">
|
||||||
<a class="btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();">确定</a>
|
<a class="btn_submit" data-button="ok" onclick="pollsSubmit($(this));">确定</a>
|
||||||
<a class="btn_cancel" data-button="cancel" onclick="pollsCancel();">取消</a>
|
<a class="btn_cancel" data-button="cancel" onclick="pollsCancel();">取消</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
|
|
@ -25,6 +25,10 @@
|
||||||
}
|
}
|
||||||
//问卷头
|
//问卷头
|
||||||
function pollsCancel(){$("#polls_head_edit").hide();$("#polls_head_show").show();}
|
function pollsCancel(){$("#polls_head_edit").hide();$("#polls_head_show").show();}
|
||||||
|
function pollsSubmit(doc){
|
||||||
|
var title = $.trim($("#polls_title").val());
|
||||||
|
if(title.length == 0){alert("问卷标题不能为空");}else{doc.parent().parent().parent().submit();}
|
||||||
|
}
|
||||||
function pollsEdit(){$("#polls_head_edit").show();$("#polls_head_show").hide();}
|
function pollsEdit(){$("#polls_head_edit").show();$("#polls_head_show").hide();}
|
||||||
//
|
//
|
||||||
function pollQuestionCancel(question_id){
|
function pollQuestionCancel(question_id){
|
||||||
|
@ -57,15 +61,22 @@
|
||||||
|
|
||||||
function poll_submit()
|
function poll_submit()
|
||||||
{
|
{
|
||||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { :poll => @poll,:is_remote => false}) %>');
|
var title = $.trim($("#polls_name_h").html());
|
||||||
showModal('ajax-modal', '310px');
|
if(title.length == 0)
|
||||||
$('#ajax-modal').css('height','115px');
|
{
|
||||||
$('#ajax-modal').siblings().remove();
|
alert("问卷标题不能为空");
|
||||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
}
|
||||||
"<a href='#' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
else{
|
||||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { :poll => @poll,:is_remote => false}) %>');
|
||||||
$('#ajax-modal').parent().css("top","").css("left","");
|
showModal('ajax-modal', '310px');
|
||||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
$('#ajax-modal').css('height','115px');
|
||||||
|
$('#ajax-modal').siblings().remove();
|
||||||
|
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||||
|
"<a href='#' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||||
|
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||||
|
$('#ajax-modal').parent().css("top","").css("left","");
|
||||||
|
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<div class="ur_page_head ur_editor02"><!--头部显示 start-->
|
<div class="ur_page_head ur_editor02"><!--头部显示 start-->
|
||||||
<a href="#" class="ur_icon_edit" title="编辑" onclick="pollsEdit();"></a>
|
<a href="#" class="ur_icon_edit" title="编辑" onclick="pollsEdit();"></a>
|
||||||
<h1 class="ur_page_title" id="polls_name_h">
|
<h1 class="ur_page_title" id="polls_name_h">
|
||||||
<%= poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name%>
|
<%= poll.polls_name%>
|
||||||
</h1>
|
</h1>
|
||||||
<p class="ur_prefix_content" id="polls_description_p">
|
<p class="ur_prefix_content" id="polls_description_p">
|
||||||
<%= @poll.polls_description%>
|
<%= @poll.polls_description%>
|
||||||
|
|
Loading…
Reference in New Issue