多次点击留言不会重复提交

This commit is contained in:
cxt 2015-12-15 17:34:08 +08:00
parent 45726576cf
commit 44ce4fe592
1 changed files with 48 additions and 52 deletions

View File

@ -1,22 +1,18 @@
<style type="text/css"> <style type="text/css">
div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;} div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;} span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )} span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;} div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;} span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;} span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
div.ke-toolbar .ke-outline{border:none;} div.ke-toolbar .ke-outline{border:none;}
div.respond-form .reply_btn{margin-left:565px;margin-top:5px;} div.respond-form .reply_btn{margin-left:565px;margin-top:5px;}
div.recall_con{width:570px;} div.recall_con{width:570px;}
div.recall_con .reply_btn{margin-left:525px;margin-top:5px;} div.recall_con .reply_btn{margin-left:525px;margin-top:5px;}
/*.ke-container{height: 80px !important;}*/ /*.ke-container{height: 80px !important;}*/
</style> </style>
<%= content_for(:header_tags) do %> <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_KindEditor" %>
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
<% end %>
<script > <script >
init_KindEditor_data('',80); init_KindEditor_data('',80);
</script> </script>
@ -24,11 +20,11 @@
<h4><%= l(:label_leave_message) %></h4> <h4><%= l(:label_leave_message) %></h4>
<% if !User.current.logged?%> <% if !User.current.logged?%>
<div style="font-size: 14px;margin:20px;"> <div style="font-size: 14px;margin:20px;">
<%= l(:label_user_login_tips) %> <%= l(:label_user_login_tips) %>
<%= link_to l(:label_user_login_new), signin_path %> <%= link_to l(:label_user_login_new), signin_path %>
<hr/> <hr/>
</div> </div>
<% else %> <% else %>
<div nhname='new_message_' style="display:none;"> <div nhname='new_message_' style="display:none;">
<%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_course_message'}, :html=>{:id => "course_feedback_new"},:method => "post") do |f|%> <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_course_message'}, :html=>{:id => "course_feedback_new"},:method => "post") do |f|%>
@ -59,37 +55,37 @@
$("#submit_feedback_course").one('click',function() { $("#submit_feedback_course").one('click',function() {
$("#course_feedback_new").submit(); $("#course_feedback_new").submit();
}); });
KindEditor.ready(function(K){ KindEditor.ready(function(K){
$("a[nhname='reply_btn']").live('click',function(){ $("a[nhname='reply_btn']").live('click',function(){
var params = {}; var params = {};
params.kindutil = K; params.kindutil = K;
params.container = $(this).parent('div').parent('div'); params.container = $(this).parent('div').parent('div');
params.div_form = $(">.respond-form",params.container); params.div_form = $(">.respond-form",params.container);
params.form = $("form",params.div_form); params.form = $("form",params.div_form);
params.textarea = $("textarea[name='user_notes']",params.div_form); params.textarea = $("textarea[name='user_notes']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form); params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form); params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form); params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form);
params.height = 55; params.height = 55;
if(params.textarea.data('init') == undefined){ if(params.textarea.data('init') == undefined){
params.editor = init_editor(params); params.editor = init_editor(params);
init_form(params); init_form(params);
params.cancel_btn.click(function(){ params.cancel_btn.click(function(){
nh_reset_form(params); nh_reset_form(params);
}); });
} }
params.cancel_btn.click(); params.cancel_btn.click();
toggleAndSettingWordsVal(params.div_form, params.textarea); toggleAndSettingWordsVal(params.div_form, params.textarea);
setTimeout(function(){ setTimeout(function(){
if(!params.div_form.is(':hidden')){ if(!params.div_form.is(':hidden')){
params.textarea.show(); params.textarea.show();
params.textarea.focus(); params.textarea.focus();
params.textarea.hide(); params.textarea.hide();
} }
},300); },300);
params.textarea.data('init',1); params.textarea.data('init',1);
}); });
});
}); });
});
</script> </script>