Merge branch 'szzh' into dev_hjq

This commit is contained in:
huang 2015-09-02 15:01:25 +08:00
commit a97e43923f
7 changed files with 35 additions and 160 deletions

View File

@ -106,16 +106,16 @@ class UsersController < ApplicationController
return
end
# 当前用户查看消息,则设置消息为已读
# course_querys = @user.course_messages
# forge_querys = @user.forge_messages
# user_querys = @user.user_feedback_messages
# forum_querys = @user.memo_messages
# if User.current.id == @user.id
# course_querys.update_all(:viewed => true)
# forge_querys.update_all(:viewed => true)
# user_querys.update_all(:viewed => true)
# forum_querys.update_all(:viewed => true)
# end
course_querys = @user.course_messages
forge_querys = @user.forge_messages
user_querys = @user.user_feedback_messages
forum_querys = @user.memo_messages
if User.current.id == @user.id
course_querys.update_all(:viewed => true)
forge_querys.update_all(:viewed => true)
user_querys.update_all(:viewed => true)
forum_querys.update_all(:viewed => true)
end
# @new_message_count = forge_querys.count + forum_querys.count + course_querys.count + user_querys.count
case params[:type]
when nil

View File

@ -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|%>
<%= 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>
<% 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">取&nbsp;&nbsp;消</a>
<a href="javascript:void(0)" onclick='$("#leave_message_form").submit();' class="blue_btn fr mt10">
<%= l(:button_leave_meassge)%>
</a>
<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' %>
<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>
<% 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>

View File

@ -61,4 +61,7 @@
<% end %>
<% end %>
<input type="hidden" value="<%= page%>"/>
<%= link_to "点击展开更多",user_activities_path(@user.id,:type => type),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%>
<% if user_activities.count == 10%>
<%= link_to "点击展开更多",user_activities_path(@user.id,:type => type,:page => page),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%>
<% end%>

View File

@ -54,4 +54,4 @@
<% end%>
<input type="hidden" value="<%= page%>" />
<%= link_to "加载更多",user_homeworks_user_path(User.current.id),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
<%= link_to "加载更多",user_homeworks_user_path(User.current.id, :page=> page),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>

View File

@ -1,4 +1,2 @@
$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'users/user_activities',:locals => {:user_activities => @user_activities, :page => @page,:type => @type} )%>");
<% if @user_activities.count < 10%>
$("#show_more_activities").hide();
<% end%>

View File

@ -1,7 +1,7 @@
//个人动态
$(function(){
KindEditor.ready(function(K){
$("a[nhname='reply_btn']").on('click',function(){
$("a[nhname='reply_btn']").live('click',function(){
var params = {};
params.kindutil = K;
params.container = $(this).parent().parent('div');
@ -35,7 +35,7 @@ $(function(){
},300);
});
$("a[nhname='sub_reply_btn']").on('click',function(){
$("a[nhname='sub_reply_btn']").live('click',function(){
var params = {};
params.kindutil = K;
params.container = $(this).parent().parent('div');

View File

@ -502,7 +502,7 @@ blockquote {
}
a.member_search_edit {width: 43px;background: #15bccf;color: #fff;text-align: center;text-decoration: none;padding: 2px;}
.min_search_edit {width: 150px;height: 20px;border: 1px solid #d0d0d0 !important;color: #666;}
.r_txt_tit{max-width:510px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color:#15bccf; float:left; color:#09658c; font-size:14px;}
.r_txt_tit{max-width:450px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color:#15bccf; float:left; color:#09658c; font-size:14px;}
/*日历选择图*/
img.ui-datepicker-trigger {
@ -769,4 +769,5 @@ a.FilesName{ max-width:540px;overflow:hidden; white-space:nowrap; text-overflow:
a.FilesName02{ max-width:665px;overflow:hidden; white-space:nowrap; text-overflow:ellipsis; display:block;}
.ProResultUl span { display:block; float:left;}
.ProResultUl li{ line-height:35px; border-bottom:1px solid #dddddd; }
.DateBorder{border:1px solid #d9d9d9; border-left:none; padding:7px 6px 6px 6px;}
.DateBorder{border:1px solid #d9d9d9; border-left:none; padding:7px 6px 6px 6px;}
.mb50{margin-bottom: 50px;}