2015-06-11 17:31:47 +08:00
|
|
|
<style type="text/css">
|
2015-07-29 16:54:10 +08:00
|
|
|
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-url{background-image:url( /images/public_icon.png )}
|
|
|
|
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:hover{background-position:-79px -671px;width:50px;height:26px;}
|
|
|
|
div.ke-toolbar .ke-outline{border:none;}
|
2015-06-11 17:31:47 +08:00
|
|
|
|
2015-07-29 16:54:10 +08:00
|
|
|
div.respond-form .reply_btn{margin-left:565px;margin-top:5px;}
|
|
|
|
div.recall_con{width:570px;}
|
|
|
|
div.recall_con .reply_btn{margin-left:525px;margin-top:5px;}
|
2015-06-11 17:31:47 +08:00
|
|
|
</style>
|
2015-12-06 15:03:36 +08:00
|
|
|
<%= content_for(:header_tags) do %>
|
|
|
|
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
|
|
|
|
<% end %>
|
|
|
|
|
2015-06-11 17:31:47 +08:00
|
|
|
<div class="msg_box" id='leave-message' nhname='new_message' style="height:auto;">
|
2014-11-04 18:30:45 +08:00
|
|
|
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
|
2015-04-11 14:25:47 +08:00
|
|
|
<h4><%= l(:label_user_response) %></h4>
|
2014-11-04 18:30:45 +08:00
|
|
|
<% if !User.current.logged?%>
|
|
|
|
<div style="font-size: 14px;margin:20px;">
|
|
|
|
<%= l(:label_user_login_tips) %>
|
|
|
|
<%= link_to l(:label_user_login_new), signin_path %>
|
|
|
|
<hr/>
|
|
|
|
</div>
|
|
|
|
<% else %>
|
2015-07-29 16:54:10 +08:00
|
|
|
<%= form_for('new_form', :method => :post, :html => {:id => 'project_feedback_form', :multipart => true},
|
|
|
|
:url => {:controller => 'words', :action => 'leave_project_message'}) do |f|%>
|
|
|
|
<%= f.text_area 'project_message', :rows => 3, :cols => 65,
|
|
|
|
:placeholder => "#{l(:label_welcome_my_respond)}",:nhname=>'new_message_textarea' %>
|
|
|
|
<p nhname="contentmsg"></p>
|
|
|
|
<div class="fl mt10" style="padding-top:5px;" nhname="toolbar_container"></div>
|
|
|
|
<%#= submit_tag l(:button_leave_meassge), :name => nil , :class => "blue_btn fr mt10 mb10" %>
|
2015-12-11 09:52:17 +08:00
|
|
|
<a href="javascript:void(0);" class="blue_btn fr ml10 mt10" id="submit_feedback_project" >留言</a>
|
|
|
|
<%#= link_to l(:button_leave_meassge), "javascript:void(0)", :onclick => 'submitProjectFeedback();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fr mt10 mb10' %>
|
2015-07-29 16:54:10 +08:00
|
|
|
<% end %>
|
2015-04-11 14:25:47 +08:00
|
|
|
|
2014-11-04 18:30:45 +08:00
|
|
|
<% end %>
|
2015-07-29 16:54:10 +08:00
|
|
|
<div class="cl"></div>
|
2014-11-04 18:30:45 +08:00
|
|
|
</div>
|
|
|
|
<div id="history">
|
2014-11-05 10:41:34 +08:00
|
|
|
<%= render :partial => 'history',:locals => { :journals => @jour, :state => false} %>
|
2014-11-04 18:30:45 +08:00
|
|
|
</div>
|
2014-11-05 09:51:30 +08:00
|
|
|
<ul class="wlist"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%></ul>
|
2015-04-11 14:25:47 +08:00
|
|
|
|
2015-06-11 17:31:47 +08:00
|
|
|
<div style="display:none;"><a href="#" id="nhjump"></a></div>
|
|
|
|
<script type="text/javascript">
|
2015-07-29 16:54:10 +08:00
|
|
|
$(function(){
|
2015-12-11 09:52:17 +08:00
|
|
|
$("#submit_feedback_project").one('click',function() {
|
|
|
|
$("#project_feedback_form").submit();
|
|
|
|
});
|
2015-06-12 16:31:29 +08:00
|
|
|
|
2015-07-29 16:54:10 +08:00
|
|
|
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;
|
2015-06-11 17:31:47 +08:00
|
|
|
}
|
|
|
|
|
2015-07-29 16:54:10 +08:00
|
|
|
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'});
|
2016-05-18 10:57:56 +08:00
|
|
|
params.submit_btn.one('click', function(){
|
|
|
|
params.form.submit();
|
|
|
|
});
|
2015-07-29 16:54:10 +08:00
|
|
|
}else{
|
|
|
|
params.contentmsg.html('填写正确');
|
|
|
|
params.contentmsg.css({color:'#008000'});
|
|
|
|
}
|
|
|
|
params.contentmsg.show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
2015-06-11 17:31:47 +08:00
|
|
|
}
|
2015-07-29 16:54:10 +08:00
|
|
|
function init_form(params){
|
2015-06-11 17:31:47 +08:00
|
|
|
// 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;
|
|
|
|
// }
|
|
|
|
|
2015-07-29 16:54:10 +08:00
|
|
|
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,
|
2016-05-18 10:57:56 +08:00
|
|
|
textarea:params.textarea,
|
|
|
|
submit_btn:params.submit_btn,
|
|
|
|
form:params.form
|
2015-07-29 16:54:10 +08:00
|
|
|
});
|
|
|
|
if(is_checked){
|
|
|
|
if(flag){
|
|
|
|
return true;
|
|
|
|
}else{
|
|
|
|
$(this)[0].submit();
|
|
|
|
return false;
|
|
|
|
}
|
2015-06-11 17:31:47 +08:00
|
|
|
// return true; //这个涛哥的firefox不能提交
|
2015-07-29 16:54:10 +08:00
|
|
|
//$(this).trigger('submit'); //这个虽然能提交 但是他是个死循环
|
|
|
|
//$(this)[0].submit(); //用这个form的data-remote='true'没效果了
|
|
|
|
//肿么破阿 我滴个神 实在不行就用$.ajax()算了
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
});
|
2015-06-11 17:31:47 +08:00
|
|
|
}
|
2015-07-29 16:54:10 +08:00
|
|
|
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();
|
2015-06-11 17:31:47 +08:00
|
|
|
}
|
2015-07-29 16:54:10 +08:00
|
|
|
|
|
|
|
KindEditor.ready(function(K){
|
|
|
|
$("a[nhname='reply_btn']").live('click',function(){
|
|
|
|
var params = {};
|
|
|
|
params.kindutil = K;
|
|
|
|
params.container = $(this).parent('div').parent('div');
|
|
|
|
params.div_form = $(">.respond-form",params.container);
|
|
|
|
params.form = $("form",params.div_form);
|
|
|
|
params.textarea = $("textarea[name='user_notes']",params.div_form);
|
|
|
|
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
|
|
|
|
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
|
|
|
|
params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form);
|
2016-05-18 10:57:56 +08:00
|
|
|
params.submit_btn = $("input[nhname='submit_btn']",params.div_form);
|
|
|
|
params.editor = init_editor(params);
|
|
|
|
init_form(params);
|
|
|
|
params.submit_btn.one('click', function () {
|
|
|
|
params.form.submit();
|
|
|
|
});
|
|
|
|
params.cancel_btn.click(function(){
|
|
|
|
nh_reset_form(params);
|
|
|
|
});
|
2015-07-29 16:54:10 +08:00
|
|
|
params.cancel_btn.click();
|
|
|
|
toggleAndSettingWordsVal(params.div_form, params.textarea);
|
|
|
|
setTimeout(function(){
|
|
|
|
if(!params.div_form.is(':hidden')){
|
|
|
|
params.textarea.show();
|
|
|
|
params.textarea.focus();
|
|
|
|
params.textarea.hide();
|
2015-06-12 10:52:15 +08:00
|
|
|
// $("#nhjump").attr('href','#'+params.div_form.attr('id'));
|
|
|
|
// $("#nhjump")[0].click();
|
2015-07-29 16:54:10 +08:00
|
|
|
}
|
|
|
|
},300);
|
|
|
|
params.textarea.data('init',1);
|
|
|
|
});
|
2015-06-11 17:31:47 +08:00
|
|
|
|
2015-07-29 16:54:10 +08:00
|
|
|
$("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);
|
2015-06-11 17:31:47 +08:00
|
|
|
// $("a[nhname='cancel_btn']",params.div_form).click(function(){
|
|
|
|
// nh_reset_form(params);
|
|
|
|
// });
|
2015-07-29 16:54:10 +08:00
|
|
|
params.textarea.data('init',1);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2015-06-11 17:31:47 +08:00
|
|
|
});
|
2015-06-17 17:01:03 +08:00
|
|
|
</script>
|