Merge branch 'cxt_course' into develop

This commit is contained in:
cxt 2016-06-21 11:18:28 +08:00
commit 53614197aa
7 changed files with 83 additions and 17 deletions

View File

@ -135,7 +135,7 @@ class UsersController < ApplicationController
unless (message_all.message_type == 'CourseMessage' && mess && mess.course && mess.course.is_delete == 1)
@message_alls << mess
end
break if @message_alls.length == 5
break if @message_alls.length == 10
end
end
end

View File

@ -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

View File

@ -91,6 +91,8 @@
</div>
<script type="text/javascript">
var onUserMessages = false;
var onNotice = false;
//搜索相关
$("#navHomepageSearch").mouseover(function(){
$("#navHomepageSearchType").show();
@ -99,13 +101,28 @@
});
$("#user_messages").mouseenter(function(){
onNotice = true;
$("#user_messages_list").show();
$.get('<%=user_messages_unviewed_users_path %>');
$("#ajax-indicator").hide();
if($("#message_list_detail").length == 0){
$.get('<%=user_messages_unviewed_users_path %>');
$("#ajax-indicator").hide();
}
var obj = $("#user_messages_list");
clearTimeout(obj.timer);
}).mouseleave(function(){
$("#user_messages_list").hide();
$("#user_messages_list").html("<%=escape_javascript(render :partial => 'layouts/message_loading') %>");
onNotice = false;
var obj = $("#user_messages_list");
setTimeout(function(){
if(!onNotice && !onUserMessages) {
obj.hide();
obj.html("<%=escape_javascript(render :partial => 'layouts/message_loading') %>");
} }, 500);
});
$("#message_list_detail").mouseenter(function(event){
event.stopPropagation();
onUserMessages = true;
}).mouseleave(function(){
onUserMessages = false;
});
$("#navHomepageProfile").mouseenter(function(){

View File

@ -1,5 +1,7 @@
<font></font>
<div id="message_list_detail">
<h4 class="shadowbox_news_title">未读消息</h4>
<p style="display: none;" id="none_message" class="shadowbox_news_p text_c">无未读消息</p>
<ul class="shadowbox_news_list">
<% messages.each do |ma| %>
<% if ma.class == SystemMessage %>
@ -123,13 +125,42 @@
<% elsif AtMessage === ma && ma.at_valid? %>
<% if ma.at_message_type == "Message" && !ma.at_message.course.nil? %>
<% href = course_boards_path(ma.at_message.course,:parent_id => ma.at_message.parent_id ? ma.at_message.parent_id : ma.at_message.id, :topic_id => ma.at_message.id) %>
<li><a href="<%=href %>" target="_blank" title="<%=ma.author.show_name %> 提到了你:<%= ma.subject.html_safe%>"><span class="shadowbox_news_user"><%=ma.author.show_name %> </span>提到了你:<%= ma.subject.html_safe%></a></li>
<% elsif ma.at_message_type == "Message" && !ma.at_message.project.nil? %>
<% href = project_boards_path(ma.at_message.project,:parent_id => ma.at_message.parent_id ? ma.at_message.parent_id : ma.at_message.id, :topic_id => ma.at_message.id) %>
<% href = project_boards_path(ma.at_message.project,:parent_id => ma.at_message.parent_id ? ma.at_message.parent_id : ma.at_message.id, :topic_id => ma.at_message.id) %>
<li><a href="<%=href %>" target="_blank" title="<%=ma.author.show_name %> 提到了你:<%= ma.subject.html_safe%>"><span class="shadowbox_news_user"><%=ma.author.show_name %> </span>提到了你:<%= ma.subject.html_safe%></a></li>
<% else %>
<% href = ma.url %>
<% content = '<span class="shadowbox_news_user">'+ma.author.show_name+' </span>提到了你:'+ma.subject.html_safe %>
<li><%=link_to content.html_safe, ma.url, :title => ma.author.show_name+' 提到了你:'+ma.subject.html_safe, :target => '_blank' %></li>
<% end %>
<li><a href="<%=href %>" target="_blank" title="<%=ma.author.show_name %> 提到了你:<%= ma.subject.html_safe%>"><span class="shadowbox_news_user"><%=ma.author.show_name %> </span>提到了你:<%= ma.subject.html_safe%></a></li>
<% end %>
<% end %>
</ul>
<%= link_to '查看全部', user_message_path(User.current), :class => "shadowbox_news_all", :target =>"_Blank" %>
<a onclick = "show_more();" id = "show_more_messages" style="display: none" class = "shadowbox_news_all">展开更多</a>
<%= link_to '查看全部', user_message_path(User.current),:id =>'show_all_messages', :class => "shadowbox_news_all", :style => "display:none", :target =>"_Blank" %>
</div>
<script type="text/javascript">
$(function(){
if($(".shadowbox_news_list li").length > 5) {
$(".shadowbox_news_list li").hide();
$(".shadowbox_news_list li").eq(0).show();
$(".shadowbox_news_list li").eq(1).show();
$(".shadowbox_news_list li").eq(2).show();
$(".shadowbox_news_list li").eq(3).show();
$(".shadowbox_news_list li").eq(4).show();
$("#show_more_messages").show();
} else if ($(".shadowbox_news_list li").length == 0) {
$("#none_message").show();
$("#show_all_messages").show();
}
else {
$("#show_all_messages").show();
}
});
function show_more() {
$(".shadowbox_news_list li").show();
$("#show_more_messages").hide();
$("#show_all_messages").show();
}
</script>

View File

@ -300,8 +300,8 @@ K.options = {
'.text-align', '.color', '.background-color', '.font-size', '.font-family', '.font-weight',
'.font-style', '.text-decoration', '.vertical-align', '.background', '.border','.border-color', '.text-overflow','.overflow','.white-space'
],
a : ['id', 'class', 'href', 'target', 'name'],
embed : ['id', 'class', 'src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', '.width', '.height', 'align', 'allowscriptaccess'],
a : ['id', 'class', 'href', 'target', 'name','data-method','data-remote','rel'],
embed : ['id', 'class', 'src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', '.width', '.height', 'align', 'allowscriptaccess'],
img : ['id', 'class', 'src', 'width', 'height', 'border', 'alt', 'title', 'align', '.width', '.height', '.border'],
'p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6' : [
'id', 'class', 'align', '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.background',

View File

@ -1620,8 +1620,9 @@ ul.wlist li a:hover{ background:#15bccf; color:#fff; text-decoration:none;}
/*消息弹框*/
.shadowbox_news{ width:305px; background-color:#fff; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); position: absolute; left: -131px; top: 45px; z-index: 9999;}
.shadowbox_news_title{ height:40px; line-height:40px;padding-left:10px; font-size:12px; color:#333;border-bottom:1px solid #eee;}
.shadowbox_news_p{ height:40px; line-height:40px; font-size:12px; color:#333;}
.shadowbox_news font{ border: 1px solid #dddddd; display: block; border-width: 8px; position: absolute; top: -15px;left: 140px; border-style:solid; border-color: transparent transparent #fff transparent;font-size: 0;line-height: 0; box-shadow:2px rgba(146, 153, 169, 0.5); }
.shadowbox_news_list{ max-height:200px; overflow:hidden;}
.shadowbox_news_list{ max-height:400px; overflow:hidden;}
.shadowbox_news_list a{ color:#999;}
.shadowbox_news_list li{ height:40px; border-bottom:1px dashed #ebebeb; line-height:40px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis; padding:0 10px;}
.shadowbox_news_list li:hover{ background-color:#eee;}

View File

@ -533,7 +533,7 @@ a.homepageSearchIcon:hover {background:url(../images/nav_icon.png) -49px 3px no-
.homepageNewsIcon {background:url(../images/nav_icon.png) -5px -85px no-repeat; width:30px; height:35px; display:block;}
.newsActive {width:16px; height:16px; border-radius:50%; background-color:#ff0000; position:absolute; left:17px; top:5px; text-align:center;font-size:12px; color:#ffffff !important;padding-bottom: 3px;padding-left: 2px;padding-right: 1px;font-weight: bold;}
.navHomepageProfile {width:65px; display:block; float:right; margin-left:33px;}
.homepageProfileMenuIcon {background:url(../images/nav_icon.png) 30px -155px no-repeat; width:65px; height:50px; position:relative; display:inline-block;}
.homepageProfileMenuIcon {background:url(../images/nav_icon.png) 30px -155px no-repeat; width:65px; height:54px; position:relative; display:inline-block;}
.homepageProfileMenuIcon:hover {background:url(../images/nav_icon.png) 30px -122px no-repeat;}
.navHomepageProfile ul li ul {display:none;}
.navHomepageProfile ul li:hover ul {display:block;}
@ -1155,8 +1155,9 @@ a.st_down{ display: block; width:8px; float:left; height:13px; background:url(..
/*消息弹框*/
.shadowbox_news{ width:305px; background-color:#fff; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); position: absolute; left: -131px; top: 45px; z-index: 9999;}
.shadowbox_news_title{ height:40px; line-height:40px;padding-left:10px; font-size:12px; color:#333;border-bottom:1px solid #eee;}
.shadowbox_news font{ border: 1px solid #dddddd; display: block; border-width: 8px; position: absolute; top: -15px;left: 140px; border-style:solid; border-color: transparent transparent #fff transparent;font-size: 0;line-height: 0; box-shadow:2px rgba(146, 153, 169, 0.5); }
.shadowbox_news_list{ max-height:200px; overflow:hidden;}
.shadowbox_news_p{ height:40px; line-height:40px; font-size:12px; color:#333;}
.shadowbox_news font{ border: 1px solid #dddddd; display: block; border-width: 8px; position: absolute; top: -15px;left: 140px; border-style:solid; border-color: transparent transparent #fff transparent;font-size: 0;line-height: 0; box-shadow:2px rgba(146, 153, 169, 0.5); }
.shadowbox_news_list{ max-height:400px; overflow:hidden;}
.shadowbox_news_list a{ color:#999;}
.shadowbox_news_list li{ height:40px; border-bottom:1px dashed #ebebeb; line-height:40px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis; padding:0 10px;}
.shadowbox_news_list li:hover{ background-color:#eee;}