From dbdae2ac7e5d3c4eb654bf684a94a68a5722af82 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 23 Jan 2015 14:25:29 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E7=BC=96=E8=BE=91=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=9C=A8=E5=8F=91=E5=B8=83=E9=97=AE=E5=8D=B7=E5=92=8C?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E9=97=AE=E5=8D=B7=E6=A0=87=E9=A2=98=E7=A1=AE?= =?UTF-8?q?=E8=AE=A4=E5=A2=9E=E5=8A=A0=E9=97=AE=E5=8D=B7=E6=A0=87=E9=A2=98?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E4=B8=BA=E7=A9=BA=E7=9A=84=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_controller.rb | 4 ++-- app/views/poll/_edit_head.html.erb | 2 +- app/views/poll/_poll_form.html.erb | 29 ++++++++++++++++++++--------- app/views/poll/_show_head.html.erb | 2 +- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 0ee17222e..8926c0be6 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -70,8 +70,8 @@ class PollController < ApplicationController end def update - @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] + @poll.polls_name = params[:polls_name] + @poll.polls_description = params[:polls_description] if @poll.save respond_to do |format| format.js diff --git a/app/views/poll/_edit_head.html.erb b/app/views/poll/_edit_head.html.erb index 802832601..ed90a5ef8 100644 --- a/app/views/poll/_edit_head.html.erb +++ b/app/views/poll/_edit_head.html.erb @@ -7,7 +7,7 @@
diff --git a/app/views/poll/_poll_form.html.erb b/app/views/poll/_poll_form.html.erb index df4859613..1d0dee837 100644 --- a/app/views/poll/_poll_form.html.erb +++ b/app/views/poll/_poll_form.html.erb @@ -25,6 +25,10 @@ } //问卷头 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 pollQuestionCancel(question_id){ @@ -57,15 +61,22 @@ function poll_submit() { - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { :poll => @poll,:is_remote => false}) %>'); - showModal('ajax-modal', '310px'); - $('#ajax-modal').css('height','115px'); - $('#ajax-modal').siblings().remove(); - $('#ajax-modal').before("" + - ""); - $('#ajax-modal').parent().removeClass("alert_praise"); - $('#ajax-modal').parent().css("top","").css("left",""); - $('#ajax-modal').parent().addClass("popbox_polls"); + var title = $.trim($("#polls_name_h").html()); + if(title.length == 0) + { + alert("问卷标题不能为空"); + } + else{ + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { :poll => @poll,:is_remote => false}) %>'); + showModal('ajax-modal', '310px'); + $('#ajax-modal').css('height','115px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').before("" + + ""); + $('#ajax-modal').parent().removeClass("alert_praise"); + $('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().addClass("popbox_polls"); + } } diff --git a/app/views/poll/_show_head.html.erb b/app/views/poll/_show_head.html.erb index 7ab16b24d..ce74dc10a 100644 --- a/app/views/poll/_show_head.html.erb +++ b/app/views/poll/_show_head.html.erb @@ -1,7 +1,7 @@