|
|
|
@ -11,9 +11,11 @@
|
|
|
|
|
div.recall_con{width:570px;}
|
|
|
|
|
div.recall_con .reply_btn{margin-left:525px;margin-top:5px;}
|
|
|
|
|
</style>
|
|
|
|
|
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
|
|
|
|
|
<div class="msg_box fl" id='leave-message' nhname="new_message">
|
|
|
|
|
<%# reply_allow = JournalsForMessage.create_by_user? User.current %>
|
|
|
|
|
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_KindEditor" %>
|
|
|
|
|
<script >
|
|
|
|
|
init_KindEditor_data('');
|
|
|
|
|
</script>
|
|
|
|
|
<div class="msg_box fl mb10" id='leave-message'>
|
|
|
|
|
<h4><%= l(:label_leave_message) %></h4>
|
|
|
|
|
|
|
|
|
|
<% if !User.current.logged?%>
|
|
|
|
@ -23,21 +25,15 @@
|
|
|
|
|
<hr/>
|
|
|
|
|
</div>
|
|
|
|
|
<% else %>
|
|
|
|
|
<%= form_for('new_form', :method => :post,
|
|
|
|
|
:url => {:controller => 'words', :action => 'leave_course_message'},:html => {:id=>'leave_message_form'}) do |f|%>
|
|
|
|
|
<div nhname='new_message_' style="display:none;">
|
|
|
|
|
<%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_course_message'},:method => "post") do |f|%>
|
|
|
|
|
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
|
|
|
|
<%#= f.kindeditor 'course_message',:height => '140px;',:editor_id => 'leave_message_editor',:input_html=>{:id => "leave_meassge",:style => "resize: none;",
|
|
|
|
|
:placeholder => "#{l(:label_welcome_my_respond)}",:maxlength => 250}%>
|
|
|
|
|
<textarea cols="40" nhname="new_message_textarea" maxlength="250" name="new_form[course_message]" placeholder="请在此留下你的意见和建议!" rows="20" style="display: none;"></textarea>
|
|
|
|
|
<p nhname="contentmsg"></p>
|
|
|
|
|
<textarea placeholder="有问题或有建议,请直接给我留言吧!" nhname='new_message_textarea_' name="new_form[course_message]"></textarea>
|
|
|
|
|
<p nhname='contentmsg_'></p>
|
|
|
|
|
<div nhname='toolbar_container_' style="float:left;padding-top:3px;margin-bottom: 15px;"></div>
|
|
|
|
|
<a id="new_message_cancel_btn_" href="javascript:void(0)" class="grey_btn fr mt10">取消</a>
|
|
|
|
|
<a id="new_message_submit_btn_" href="javascript:void(0)" class="blue_btn fr ml10 mt10">留言</a>
|
|
|
|
|
<% end%>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
<div>
|
|
|
|
|
<div class="fl" style="padding-top:5px;" nhname="toolbar_container"></div>
|
|
|
|
|
<a href="javascript:void(0)" class="grey_btn fr ml10 mt10" nhname="cancel_btn">取 消</a>
|
|
|
|
|
<a href="javascript:void(0)" onclick='$("#leave_message_form").submit();' class="blue_btn fr mt10">
|
|
|
|
|
<%= l(:button_leave_meassge)%>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
@ -54,106 +50,6 @@
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
$(function(){
|
|
|
|
|
|
|
|
|
|
function init_editor(params){
|
|
|
|
|
params.textarea.removeAttr('placeholder');
|
|
|
|
|
var editor = params.kindutil.create(params.textarea, {
|
|
|
|
|
resizeType : 1,minWidth:"1px",width:"100%",height:"150px",
|
|
|
|
|
items:['emoticons'],
|
|
|
|
|
afterChange:function(){//按键事件
|
|
|
|
|
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
|
|
|
|
|
},
|
|
|
|
|
afterCreate:function(){
|
|
|
|
|
var toolbar = $("div[class='ke-toolbar']",params.div_form);
|
|
|
|
|
$(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
|
|
|
|
|
params.toolbar_container.append(toolbar);
|
|
|
|
|
}
|
|
|
|
|
}).loadPlugin('paste');
|
|
|
|
|
return editor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function nh_check_field(params){
|
|
|
|
|
var result=true;
|
|
|
|
|
if(params.content!=undefined){
|
|
|
|
|
if(params.content.isEmpty()){
|
|
|
|
|
result=false;
|
|
|
|
|
}
|
|
|
|
|
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
|
|
|
|
|
params.textarea.html(params.content.html());
|
|
|
|
|
params.content.sync();
|
|
|
|
|
if(params.content.isEmpty()){
|
|
|
|
|
params.contentmsg.html('内容不能为空');
|
|
|
|
|
params.contentmsg.css({color:'#ff0000'});
|
|
|
|
|
}else{
|
|
|
|
|
params.contentmsg.html('填写正确');
|
|
|
|
|
params.contentmsg.css({color:'#008000'});
|
|
|
|
|
}
|
|
|
|
|
params.contentmsg.show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
function init_form(params){
|
|
|
|
|
// var flag = false;
|
|
|
|
|
// if(params.form.attr('data-remote') != undefined ){
|
|
|
|
|
// flag = true
|
|
|
|
|
// }
|
|
|
|
|
// params.form[0].onsubmit = function(){
|
|
|
|
|
// if(flag){
|
|
|
|
|
// $(this).removeAttr('data-remote');//不这么搞return false没用 花擦花擦
|
|
|
|
|
// }
|
|
|
|
|
// var is_checked = nh_check_field({
|
|
|
|
|
// issubmit:true,
|
|
|
|
|
// content:params.editor,
|
|
|
|
|
// contentmsg:params.contentmsg,
|
|
|
|
|
// textarea:params.textarea
|
|
|
|
|
// });
|
|
|
|
|
// if(is_checked){
|
|
|
|
|
// if(flag){
|
|
|
|
|
// alert('add')
|
|
|
|
|
// $(this).attr('data-remote','true');
|
|
|
|
|
// }
|
|
|
|
|
// alert('ok')
|
|
|
|
|
// return true;
|
|
|
|
|
// }
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
params.form.submit(function(){
|
|
|
|
|
var flag = false;
|
|
|
|
|
if(params.form.attr('data-remote') != undefined ){
|
|
|
|
|
flag = true
|
|
|
|
|
}
|
|
|
|
|
var is_checked = nh_check_field({
|
|
|
|
|
issubmit:true,
|
|
|
|
|
content:params.editor,
|
|
|
|
|
contentmsg:params.contentmsg,
|
|
|
|
|
textarea:params.textarea
|
|
|
|
|
});
|
|
|
|
|
if(is_checked){
|
|
|
|
|
if(flag){
|
|
|
|
|
return true;
|
|
|
|
|
}else{
|
|
|
|
|
$(this)[0].submit();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// return true; //这个涛哥的firefox不能提交
|
|
|
|
|
//$(this).trigger('submit'); //这个虽然能提交 但是他是个死循环
|
|
|
|
|
//$(this)[0].submit(); //用这个form的data-remote='true'没效果了
|
|
|
|
|
//肿么破阿 我滴个神 实在不行就用$.ajax()算了
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
function nh_reset_form(params){
|
|
|
|
|
params.form[0].reset();
|
|
|
|
|
params.textarea.empty();
|
|
|
|
|
if(params.editor != undefined){
|
|
|
|
|
params.editor.html(params.textarea.html());
|
|
|
|
|
}
|
|
|
|
|
params.contentmsg.hide();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KindEditor.ready(function(K){
|
|
|
|
|
$("a[nhname='reply_btn']").live('click',function(){
|
|
|
|
|
var params = {};
|
|
|
|
@ -179,33 +75,10 @@
|
|
|
|
|
params.textarea.show();
|
|
|
|
|
params.textarea.focus();
|
|
|
|
|
params.textarea.hide();
|
|
|
|
|
// $("#nhjump").attr('href','#'+params.div_form.attr('id'));
|
|
|
|
|
// $("#nhjump")[0].click();
|
|
|
|
|
}
|
|
|
|
|
},300);
|
|
|
|
|
params.textarea.data('init',1);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$("div[nhname='new_message']").each(function(){
|
|
|
|
|
var params = {};
|
|
|
|
|
params.kindutil = K;
|
|
|
|
|
params.div_form = $(this);
|
|
|
|
|
params.form = $("form",params.div_form);
|
|
|
|
|
if(params.form==undefined || params.form.length==0){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
params.textarea = $("textarea[nhname='new_message_textarea']",params.div_form);
|
|
|
|
|
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
|
|
|
|
|
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
|
|
|
|
|
if(params.textarea.data('init') == undefined){
|
|
|
|
|
params.editor = init_editor(params);
|
|
|
|
|
init_form(params);
|
|
|
|
|
$("a[nhname='cancel_btn']",params.div_form).click(function(){
|
|
|
|
|
nh_reset_form(params);
|
|
|
|
|
});
|
|
|
|
|
params.textarea.data('init',1);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|