diff --git a/app/models/user.rb b/app/models/user.rb index 258fe2ea5..3d491c8ab 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -248,7 +248,7 @@ class User < Principal before_save :update_hashed_password before_destroy :remove_references_before_destroy,:delete_user_ealasticsearch_index # added by fq - after_create :act_as_activity, :add_onclick_time, :act_as_principal_activity,:create_user_ealasticsearch_index + after_create :act_as_activity, :add_onclick_time, :act_as_principal_activity,:create_user_ealasticsearch_index,:add_new_jour # end # 更新邮箱用户或用户名的同事,同步更新邀请信息 after_update :update_invite_list,:update_user_ealasticsearch_index @@ -1145,6 +1145,22 @@ class User < Principal end end + #为新注册用户发送留言 + def add_new_jour + if Message.where("id=19278").any? and Message.where("id=19291").any? and Message.where("id=19292").any? + lead_message1 = Message.find(19278) + notes1 = lead_message1.content + # lead_message2 = Message.find(19292) + # notes2 = lead_message2.content + # lead_message3 = Message.find(19291) + # notes3 = lead_message3.content + # # user_id 默认为课程使者创建 + self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes1, :reply_id => 0, :status => true, :is_readed => false, :private => 0) + # self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes2, :reply_id => 0, :status => true, :is_readed => false, :private => 0) + # self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0) + end + end + # 更新邮箱的同事,更新invite_lists表中的邮箱信息 def update_invite_list invite_lists = InviteList.where("user_id =?",self.id).all diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index da22cce7a..d8adece15 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -112,21 +112,17 @@ }).mouseleave(function(){ onNotice = false; var obj = $("#user_messages_list"); - obj.timer = setTimeout(function(){ - if(!onNotice && !onUserMessages) - obj.hide(0); - obj.html("<%=escape_javascript(render :partial => 'layouts/message_loading') %>"); - }, 500); + setTimeout(function(){ + if(!onNotice && !onUserMessages) { + obj.hide(); + obj.html("<%=escape_javascript(render :partial => 'layouts/message_loading') %>"); + } }, 500); }); - - $("#user_messages_list").mouseenter(function(event){ + $("#message_list_detail").mouseenter(function(event){ event.stopPropagation(); onUserMessages = true; - $(this).show(); }).mouseleave(function(){ onUserMessages = false; - $(this).hide(); - $(this).html("<%=escape_javascript(render :partial => 'layouts/message_loading') %>"); }); $("#navHomepageProfile").mouseenter(function(){ diff --git a/app/views/layouts/_show_messages_list.html.erb b/app/views/layouts/_show_messages_list.html.erb index 423011e3c..f67250e46 100644 --- a/app/views/layouts/_show_messages_list.html.erb +++ b/app/views/layouts/_show_messages_list.html.erb @@ -1,6 +1,7 @@

未读消息

+ - 展开更多 -<%= link_to '查看全部', user_message_path(User.current),:id =>'show_all_messages', :class => "shadowbox_news_all undis", :target =>"_Blank" %> + +<%= link_to '查看全部', user_message_path(User.current),:id =>'show_all_messages', :class => "shadowbox_news_all", :style => "display:none", :target =>"_Blank" %>