不同类型消息发送
This commit is contained in:
parent
2cb5292dc1
commit
ed8c4ac906
|
@ -98,12 +98,28 @@ class UsersController < ApplicationController
|
|||
|
||||
# 用户消息
|
||||
def user_messages
|
||||
@user_course_messages = @user.course_messages
|
||||
@user_project_messges = @user.forge_messages
|
||||
respond_to do |format|
|
||||
format.html{render :layout=>'base_users_new'}
|
||||
format.api
|
||||
if @user.course_messages
|
||||
if params[:type].nil?
|
||||
@user_course_messages = @user.course_messages
|
||||
@user_project_messges = @user.forge_messages
|
||||
else
|
||||
case params[:type]
|
||||
when 'homework'
|
||||
@user_course_messages = @user.course_messages
|
||||
#@user_course_messages = ForgeMessage.find_by_sql("select * from course_messages where user_id='#{@user.id}' and course_message_type = 'HomeworkCommon' order by created_at desc;")
|
||||
when 'message'
|
||||
@user_course_messages = @user.course_message_message
|
||||
when 'news'
|
||||
@user_course_messages = @user.course_message_new
|
||||
when 'poll'
|
||||
@user_course_messages = @user.course_message_poll
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html{render :layout=>'base_users_new'}
|
||||
format.api
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def user_projects_index
|
||||
|
|
|
@ -134,6 +134,10 @@ class User < Principal
|
|||
|
||||
# 虚拟转换
|
||||
has_many :new_jours, :as => :jour, :class_name => 'JournalsForMessage', :conditions => "status=1"
|
||||
has_many :course_messages_homeworks, :class_name => 'ForgeMessage', :conditions => 'forge_message_type="HomeworkCommon"'
|
||||
has_many :course_messages_polls, :class_name => 'ForgeMessage', :conditions => 'forge_message_type="Poll"'
|
||||
has_many :course_messages_messages, :class_name => 'ForgeMessage', :conditions => 'forge_message_type="Message"'
|
||||
has_many :course_messages_news, :class_name => 'ForgeMessage', :conditions => 'forge_message_type="News"'
|
||||
has_many :issue_assigns, :class_name => 'ForgeMessage', :conditions => 'viewed=0 and forge_message_type="Issue"'
|
||||
has_many :status_updates, :class_name => 'ForgeMessage', :conditions => 'viewed=0 and forge_message_type="Journal"'
|
||||
# 邮件邀请状态
|
||||
|
@ -248,6 +252,22 @@ class User < Principal
|
|||
# count = self.journals_for_messages(:conditions => ["status=? and is_readed = ? " ,1, 0]).count
|
||||
end
|
||||
|
||||
def course_message_homework user
|
||||
user.course_messages_homeworks
|
||||
end
|
||||
|
||||
def course_message_poll
|
||||
self.course_messages_polls
|
||||
end
|
||||
|
||||
def course_message_new
|
||||
self.course_messages_news
|
||||
end
|
||||
|
||||
def course_message_message
|
||||
self.course_messages_messages
|
||||
end
|
||||
|
||||
# 查询指派给我的缺陷记录
|
||||
def count_new_issue_assign_to
|
||||
self.issue_assigns
|
||||
|
|
|
@ -6,20 +6,20 @@
|
|||
<ul class="resourcesSelect">
|
||||
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||
<ul class="newsType">
|
||||
<li><a href="javascript:void(0);" class="resourcesGrey">全部</a></li>
|
||||
<li><a href="javascript:void(0);" class="resourcesGrey">@我</a></li>
|
||||
<li><a href="javascript:void(0);" class="resourcesGrey">作业消息</a></li>
|
||||
<li><a href="javascript:void(0);" class="resourcesGrey">课程通知</a></li>
|
||||
<li><a href="javascript:void(0);" class="resourcesGrey">指派给我</a></li>
|
||||
<li><a href="javascript:void(0);" class="resourcesGrey">讨论区回复</a></li>
|
||||
<li><a href="javascript:void(0);" class="resourcesGrey">留言</a></li>
|
||||
<li><a href="javascript:void(0);" class="resourcesGrey">申请消息</a></li>
|
||||
<li><a href="javascript:void(0);" class="resourcesGrey"><%= link_to "全部",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user} %></a></li>
|
||||
<!--<li><a href="javascript:void(0);" class="resourcesGrey">@我</a></li>-->
|
||||
<li><a href="javascript:void(0);" class="resourcesGrey"><%= link_to "作业消息",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'homework'} %></a></li>
|
||||
<li><a href="javascript:void(0);" class="resourcesGrey"><%= link_to "讨论区",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'message'} %></a></li>
|
||||
<li><a href="javascript:void(0);" class="resourcesGrey"><%= link_to "课程通知",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'news'} %></a></li>
|
||||
<!--<li><a href="javascript:void(0);" class="resourcesGrey">指派给我</a></li>-->
|
||||
<li><a href="javascript:void(0);" class="resourcesGrey"><%= link_to "问卷调查",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'poll'} %></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<% if !@user_course_messages.nil? %>
|
||||
<% @user_course_messages.each do |ucm| %>
|
||||
<% if ucm.course_message_type == "News" %>
|
||||
<ul class="homepageNewsList fl">
|
||||
|
@ -27,7 +27,7 @@
|
|||
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.author %></a></li>
|
||||
<li class="homepageNewsType fl">发布通知</li>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<%= link_to format_activity_title("#{l(:label_news)}: #{ucm.course_message.title}"), {:controller => 'news', :action => 'show', :id => ucm.course_message.id} %></a></li>
|
||||
<%= link_to format_activity_title(" #{ucm.course_message.title}"), {:controller => 'news', :action => 'show', :id => ucm.course_message.id} %></a></li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_on).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
@ -37,7 +37,7 @@
|
|||
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.user %></a></li>
|
||||
<li class="homepageNewsType fl">发布作业</li>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<%= link_to format_activity_title("#{ucm.course_message.name}"), {:controller => 'news', :action => 'show', :id => ucm.course_message.id} %></a></li>
|
||||
<%= link_to ("#{ucm.course_message.name}"), student_work_index_path(:homework => ucm.course_message.id) %></a></li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
@ -46,7 +46,8 @@
|
|||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><img src="images/newsPortrait.png" width="35" height="35" /></a></li>
|
||||
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.user %></a></li>
|
||||
<li class="homepageNewsType fl">发布问卷</li>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey"><%= ucm.course_message.polls_name %></a></li>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<%= link_to format_activity_title(" #{ucm.course_message.polls_name}"), poll_index_path(:polls_type => "Course", :polls_group_id => ucm.course_id) %></a></li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
@ -54,13 +55,24 @@
|
|||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><img src="images/newsPortrait.png" width="35" height="35" /></a></li>
|
||||
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.author %></a></li>
|
||||
<li class="homepageNewsType fl">发布帖子</li>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey"><%= ucm.course_message.subject %></a></li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_on).html_safe %> </li>
|
||||
<% if ucm.course_message.parent_id.nil? %>
|
||||
<li class="homepageNewsType fl">发布帖子</li>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<%=link_to ucm.course_message.subject, course_boards_path(ucm.course_message.course,:parent_id => ucm.course_message.parent_id ? ucm.course_message.parent_id : ucm.course_message.id, :topic_id => ucm.course_message.id) %></a></li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_on).html_safe %> </li>
|
||||
<% else %>
|
||||
<li class="homepageNewsType fl">回复帖子</li>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<%=link_to ucm.course_message.subject, course_boards_path(ucm.course_message.course,:parent_id => ucm.course_message.parent_id ? ucm.course_message.parent_id : ucm.course_message.id, :topic_id => ucm.course_message.id) %> </a></li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_on).html_safe %> </li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="flash notice">你没有新消息!</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -596,4 +596,49 @@ a.homepageWhite:hover {color:#a1ebff}
|
|||
a.newsGrey {color:#4b4b4b;}
|
||||
a.newsGrey:hover {color:#000000;}
|
||||
a.newsBlue {color:#15bccf;}
|
||||
a.newsBlue:hover {color:#0781b4;}
|
||||
a.newsBlue:hover {color:#0781b4;}
|
||||
|
||||
/***** Flash & error messages ****/
|
||||
#errorExplanation, div.flash, .nodata, .warning, .conflict {
|
||||
padding: 4px 4px 4px 30px;
|
||||
margin-bottom: 12px;
|
||||
font-size: 1.1em;
|
||||
border: 2px solid;
|
||||
}
|
||||
|
||||
div.flash {margin-top: 8px;}
|
||||
|
||||
div.flash.error, #errorExplanation {
|
||||
background: url(../images/exclamation.png) 8px 50% no-repeat;
|
||||
background-color: #ffe3e3;
|
||||
border-color: #dd0000;
|
||||
color: #880000;
|
||||
}
|
||||
|
||||
div.flash.notice {
|
||||
background: url(../images/true.png) 8px 5px no-repeat;
|
||||
background-color: #dfffdf;
|
||||
border-color: #9fcf9f;
|
||||
color: #005f00;
|
||||
}
|
||||
|
||||
div.flash.warning, .conflict {
|
||||
background: url(../images/warning.png) 8px 5px no-repeat;
|
||||
background-color: #FFEBC1;
|
||||
border-color: #FDBF3B;
|
||||
color: #A6750C;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.nodata, .warning {
|
||||
text-align: center;
|
||||
background-color: #FFEBC1;
|
||||
border-color: #FDBF3B;
|
||||
color: #A6750C;
|
||||
}
|
||||
|
||||
#errorExplanation ul { font-size: 0.9em;}
|
||||
#errorExplanation h2, #errorExplanation p { display: none; }
|
||||
|
||||
.conflict-details {font-size:80%;}
|
||||
/***** end Flash & error messages ****/
|
Loading…
Reference in New Issue