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 @@

- <%= poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name%> + <%= poll.polls_name%>

<%= @poll.polls_description%>