diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index f677bc4d4..22aab5435 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -122,57 +122,62 @@ class UsersController < ApplicationController
@new_message_count = @user.forge_messages.count + @user.memo_messages.count + @user.course_messages.count + @user.user_feedback_messages.count
case params[:type]
when nil
- @all_message = MessageAll.where("user_id =?",@user).order("created_at desc")
- @user_course_messages = CourseMessage.where("user_id =?",@user).order("created_at desc")
- @user_forge_messages = ForgeMessage.where("user_id =?",@user).order("created_at desc")
- @user_memo_messages = MemoMessage.where("user_id =?",@user).order("created_at desc")
- @user_feedback_messages = UserFeedbackMessage.where("user_id =?",@user).order("created_at desc")
- @user_course_messages_count = @user_course_messages.count
- @user_forge_messages_count = @user_forge_messages.count
- @user_memo_messages_count = @user_memo_messages.count
- @user_feedback_messages_count = @user_feedback_messages.count
+ @message_alls = []
+ messages = MessageAll.where("user_id =?",@user).order("created_at desc")
+ messages.each do |message_all|
+ @message_alls << message_all.message
+ end
+
+ # @user_course_messages = MessageAll.where("user_id =? and message_type=?",@user,"CourseMessage").order("created_at desc")
+ # @user_forge_messages = MessageAll.where("user_id =? and message_type=?",@user,"ForgeMessage").order("created_at desc")
+ # @user_memo_messages = MessageAll.where("user_id =? and message_type=?",@user,"MemoMessage").order("created_at desc")
+ # @user_feedback_messages = MessageAll.where("user_id =? and message_type=?",@user,"UserFeedbackMessage").order("created_at desc")
+ # @user_course_messages_count = @user_course_messages.count
+ # @user_forge_messages_count = @user_forge_messages.count
+ # @user_memo_messages_count = @user_memo_messages.count
+ # @user_feedback_messages_count = @user_feedback_messages.count
when 'homework'
- @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "HomeworkCommon", @user).order("created_at desc")
- @user_course_messages_count = @user_course_messages.count
+ @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "HomeworkCommon", @user).order("created_at desc")
+ #@user_course_messages_count = @user_course_messages.count
when 'course_message'
- @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc")
- @user_course_messages_count = @user_course_messages.count
+ @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc")
+ #@user_course_messages_count = @user_course_messages.count
when 'forge_message'
- @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user).order("created_at desc")
- @user_forge_messages_count = @user_forge_messages.count
+ @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user).order("created_at desc")
+ #@user_forge_messages_count = @user_forge_messages.count
when 'course_news'
- @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "News", @user).order("created_at desc")
- @user_course_messages_count = @user_course_messages.count
+ @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "News", @user).order("created_at desc")
+ #@user_course_messages_count = @user_course_messages.count
when 'forge_news'
- @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "News", @user).order("created_at desc")
- @user_forge_messages_count = @user_forge_messages.count
+ @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "News", @user).order("created_at desc")
+ #@user_forge_messages_count = @user_forge_messages.count
when 'course_news_reply'
- @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "Comment", @user).order("created_at desc")
- @user_course_messages_count = @user_course_messages.count
+ @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Comment", @user).order("created_at desc")
+ #@user_course_messages_count = @user_course_messages.count
when 'forge_news_reply'
- @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Comment", @user).order("created_at desc")
- @user_forge_messagess_count = @user_forge_messages.count
+ @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Comment", @user).order("created_at desc")
+ #@user_forge_messagess_count = @user_forge_messages.count
when 'poll'
- @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc")
- @user_course_messages_count = @user_course_messages.count
+ @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc")
+ #@user_course_messages_count = @user_course_messages.count
when 'works_reviewers'
- @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "StudentWorksScore", @user).order("created_at desc")
- @user_course_messages_count = @user_course_messages.count
+ @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "StudentWorksScore", @user).order("created_at desc")
+ #@user_course_messages_count = @user_course_messages.count
when 'works_reply'
- @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc")
- @user_course_messages_count = @user_course_messages.count
+ @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc")
+ #@user_course_messages_count = @user_course_messages.count
when 'issue'
- @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Issue", @user).order("created_at desc")
- @user_forge_messages_count = @user_forge_messages.count
+ @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Issue", @user).order("created_at desc")
+ #@user_forge_messages_count = @user_forge_messages.count
when 'issue_update' # 缺陷状态更新、留言
- @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Journal", @user).order("created_at desc")
- @user_forge_messages_count = @user_forge_messages.count
+ @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Journal", @user).order("created_at desc")
+ #@user_forge_messages_count = @user_forge_messages.count
when 'forum'
- @user_memo_messages = MemoMessage.where("memo_type =? and user_id =?", "Memo", @user).order("created_at desc")
- @user_memo_messages_count = @user_memo_messages.count
+ @message_alls = MemoMessage.where("memo_type =? and user_id =?", "Memo", @user).order("created_at desc")
+ #@user_memo_messages_count = @user_memo_messages.count
when 'user_feedback'
- @user_feedback_messages = UserFeedbackMessage.where("journals_for_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc")
- @user_feedback_messages_count = @user_feedback_messages.count
+ @message_alls = UserFeedbackMessage.where("journals_for_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc")
+ #@user_feedback_messages_count = @user_feedback_messages.count
else
render_404
return
@@ -201,50 +206,62 @@ class UsersController < ApplicationController
@new_message_count = @user.forge_messages.count + @user.memo_messages.count + @user.course_messages.count + @user.user_feedback_messages.count
case params[:type]
when nil
- @user_message_all = MessageAll.where("user_id =?", @user).order("created_at desc")
- @user_message_all_count = @user_message_all.count
+ @message_alls = []
+ messages = MessageAll.where("user_id =?",@user).order("created_at desc")
+ messages.each do |message_all|
+ @message_alls << message_all.message
+ end
+
+ # @user_course_messages = MessageAll.where("user_id =? and message_type=?",@user,"CourseMessage").order("created_at desc")
+ # @user_forge_messages = MessageAll.where("user_id =? and message_type=?",@user,"ForgeMessage").order("created_at desc")
+ # @user_memo_messages = MessageAll.where("user_id =? and message_type=?",@user,"MemoMessage").order("created_at desc")
+ # @user_feedback_messages = MessageAll.where("user_id =? and message_type=?",@user,"UserFeedbackMessage").order("created_at desc")
+ # @user_course_messages_count = @user_course_messages.count
+ # @user_forge_messages_count = @user_forge_messages.count
+ # @user_memo_messages_count = @user_memo_messages.count
+ # @user_feedback_messages_count = @user_feedback_messages.count
when 'homework'
- @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "HomeworkCommon", @user).order("created_at desc")
- @user_course_messages_count = @user_course_messages.count
+ @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "HomeworkCommon", @user).order("created_at desc")
+ #@user_course_messages_count = @user_course_messages.count
when 'course_message'
- @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc")
- @user_course_messages_count = @user_course_messages.count
+ @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc")
+ #@user_course_messages_count = @user_course_messages.count
when 'forge_message'
- @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user).order("created_at desc")
- @user_forge_messages_count = @user_forge_messages.count
+ @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user).order("created_at desc")
+ #@user_forge_messages_count = @user_forge_messages.count
when 'course_news'
- @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "News", @user).order("created_at desc")
- @user_course_messages_count = @user_course_messages.count
+ @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "News", @user).order("created_at desc")
+ #@user_course_messages_count = @user_course_messages.count
when 'forge_news'
- @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "News", @user).order("created_at desc")
- @user_forge_messages_count = @user_forge_messages.count
+ @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "News", @user).order("created_at desc")
+ #@user_forge_messages_count = @user_forge_messages.count
when 'course_news_reply'
- @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "Comment", @user).order("created_at desc")
- @user_course_messages_count = @user_course_messages.count
+ @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Comment", @user).order("created_at desc")
+ #@user_course_messages_count = @user_course_messages.count
when 'forge_news_reply'
- @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Comment", @user).order("created_at desc")
- @user_forge_messagess_count = @user_forge_messages.count
+ @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Comment", @user).order("created_at desc")
+ #@user_forge_messagess_count = @user_forge_messages.count
when 'poll'
- @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc")
- @user_course_messages_count = @user_course_messages.count
+ @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc")
+ #@user_course_messages_count = @user_course_messages.count
when 'works_reviewers'
- @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "StudentWorksScore", @user).order("created_at desc")
- @user_course_messages_count = @user_course_messages.count
+ @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "StudentWorksScore", @user).order("created_at desc")
+ #@user_course_messages_count = @user_course_messages.count
when 'works_reply'
- @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc")
- @user_course_messages_count = @user_course_messages.count
+ @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc")
+ #@user_course_messages_count = @user_course_messages.count
when 'issue'
- @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Issue", @user).order("created_at desc")
- @user_forge_messages_count = @user_forge_messages.count
+ @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Issue", @user).order("created_at desc")
+ #@user_forge_messages_count = @user_forge_messages.count
when 'issue_update' # 缺陷状态更新、留言
- @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Journal", @user).order("created_at desc")
- @user_forge_messages_count = @user_forge_messages.count
+ @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Journal", @user).order("created_at desc")
+ #@user_forge_messages_count = @user_forge_messages.count
when 'forum'
- @user_memo_messages = MemoMessage.where("memo_type =? and user_id =?", "Memo", @user).order("created_at desc")
- @user_memo_messages_count = @user_memo_messages.count
+ @message_alls = MemoMessage.where("memo_type =? and user_id =?", "Memo", @user).order("created_at desc")
+ #@user_memo_messages_count = @user_memo_messages.count
when 'user_feedback'
- @user_feedback_messages = UserFeedbackMessage.where("journals_for_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc")
- @user_feedback_messages_count = @user_feedback_messages.count
+ @message_alls = UserFeedbackMessage.where("journals_for_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc")
+ #@user_feedback_messages_count = @user_feedback_messages.count
else
render_404
return
diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb
index e8bfac941..16a1bdf4b 100644
--- a/app/views/users/user_messages.html.erb
+++ b/app/views/users/user_messages.html.erb
@@ -37,217 +37,213 @@
<% if @new_message_count >0 %>
<%# 课程消息 %>
- <% unless @user_course_messages.nil? %>
- <% @user_course_messages.each do |ucm| %>
- <% if ucm.course_message_type == "News" %>
-
- - <%= image_tag(url_to_avatar(ucm.course_message.author), :width => "30", :height => "30") %>
- - <%=link_to ucm.course_message.author, user_path(ucm.course_message.author), :class => "newsBlue" %>
- - ">发布通知
- -
- <%= link_to ucm.course_message.title, {:controller => 'news', :action => 'show', :id => ucm.course_message.id },
- :class =>"#{ucm.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :title => "#{ucm.course_message.title}" %>
- - <%= time_tag(ucm.course_message.created_on).html_safe %>
-
- <% end %>
- <% if ucm.course_message_type == "Comment" %>
-
- - <%= image_tag(url_to_avatar(ucm.course_message.author), :width => "30", :height => "30") %>
- - <%=link_to ucm.course_message.author, user_path(ucm.course_message.author), :class => "newsBlue" %>
- - ">回复了通知
- -
- <%= link_to ucm.course_message.comments.html_safe, {:controller => 'news', :action => 'show', :id => ucm.course_message.commented.id },
- :class =>"#{ucm.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :title => "#{ucm.course_message.comments.html_safe}" %>
- - <%= time_tag(ucm.course_message.created_on).html_safe %>
-
- <% end %>
- <% if ucm.course_message_type == "HomeworkCommon" %>
-
- <% end %>
- <% if ucm.course_message_type == "Poll" %>
-
- <% end %>
- <% if ucm.course_message_type == "Message" %>
-
- - <%= image_tag(url_to_avatar(ucm.course_message.author), :width => "30", :height => "30") %>
- - <%=link_to ucm.course_message.author, user_path(ucm.course_message.author), :class => "newsBlue" %>
- <% if ucm.course_message.parent_id.nil? %>
- - ">发布帖子
+ <% unless @message_alls.nil? %>
+ <% @message_alls.each do |ma| %>
+ <% if ma.class == CourseMessage %>
+ <% if ma.course_message_type == "News" %>
+
+ - <%= image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30") %>
+ - <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue" %>
+ - ">发布通知
+ -
+ <%= link_to ma.course_message.title, {:controller => 'news', :action => 'show', :id => ma.course_message.id },
+ :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :title => "#{ma.course_message.title}" %>
+ - <%= time_tag(ma.course_message.created_on).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "Comment" %>
+
+ - <%= image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30") %>
+ - <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue" %>
+ - ">回复了通知
+ -
+ <%= link_to ma.course_message.comments.html_safe, {:controller => 'news', :action => 'show', :id => ma.course_message.commented.id },
+ :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :title => "#{ma.course_message.comments.html_safe}" %>
+ - <%= time_tag(ma.course_message.created_on).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "HomeworkCommon" %>
+
+ - <%= image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30") %>
+ - <%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue" %>
+ - 发布作业
-
- <%=link_to ucm.course_message.subject.html_safe, 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),:class=>"#{ucm.viewed==0?"newsBlack":"newsGrey"}",
- :title => "#{ucm.course_message.subject.html_safe}" %>
- - <%= time_tag(ucm.course_message.created_on).html_safe %>
- <% else %>
- - ">回复帖子
+ <%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),:class => "newsGrey", :title => "#{ma.course_message.name}" %>
+ - <%= time_tag(ma.course_message.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "Poll" %>
+
- <% end %>
- <% if ucm.course_message_type == "StudentWorksScore" %>
-
- <% end %>
- <% if ucm.course_message_type == "JournalsForMessage" %>
-
+ <%= link_to format_activity_title(" #{ma.course_message.polls_name.nil? ? "未命名问卷" : ma.course_message.polls_name}"), poll_index_path(:polls_type => "Course", :polls_group_id => ma.course_id),
+ :class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}",
+ :title => "#{ma.course_message.polls_name}" %>
+ - <%= time_tag(ma.course_message.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "Message" %>
+
+ - <%= image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30") %>
+ - <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue" %>
+ <% if ma.course_message.parent_id.nil? %>
+ - ">发布帖子
+ -
+ <%=link_to ma.course_message.subject.html_safe, course_boards_path(ma.course_message.course,:parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id,
+ :topic_id => ma.course_message.id),:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}",
+ :title => "#{ma.course_message.subject.html_safe}" %>
+ - <%= time_tag(ma.course_message.created_on).html_safe %>
+ <% else %>
+ - ">回复帖子
+ -
+ <%=link_to ma.course_message.subject.html_safe, course_boards_path(ma.course_message.course,:parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id,
+ :topic_id => ma.course_message.id),:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}",
+ :title => "#{ma.course_message.subject.html_safe}" %>
+ - <%= time_tag(ma.course_message.created_on).html_safe %>
+ <% end %>
+
+ <% end %>
+ <% if ma.course_message_type == "StudentWorksScore" %>
+
+ <% end %>
+ <% if ma.course_message_type == "JournalsForMessage" %>
+
+ <% end %>
<% end %>
+
+ <% if ma.class == ForgeMessage %>
+ <% if ma.forge_message_type == "Issue" %>
+
+ <% end %>
+ <% if ma.forge_message_type == "Journal" %>
+
+ <% end %>
+ <% if ma.forge_message_type == "Message" %>
+
+ <% end %>
+ <% if ma.forge_message_type == "News" %>
+
+ <% end %>
+ <% if ma.forge_message_type == "Comment" %>
+
+ - <%= image_tag(url_to_avatar(ma.forge_message.author), :width => "30", :height => "30") %>
+ - <%=link_to ma.forge_message.author, user_path(ma.forge_message.author), :class => "newsBlue" %>
+ - 回复了新闻
+ -
+ <%= link_to "#{ma.forge_message.comments.html_safe}",
+ {:controller => 'news', :action => 'show', :id => ma.forge_message.commented.id },:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.forge_message.comments.html_safe}"%>
+ - <%= time_tag(ma.forge_message.created_on).html_safe %>
+
+ <% end %>
+ <% end %>
+
+ <% if ma.class == MemoMessage %>
+ <% if ma.memo_type == "Memo" %>
+
+ <% end %>
+ <% end %>
+
+ <% if ma.class == UserFeedbackMessage %>
+ <% if ma.journals_for_message_type == "JournalsForMessage" %>
+
+ <% end %>
+ <% end %>
<% end %>
<% end %>
- <% unless @user_forge_messages.nil? %>
- <% @user_forge_messages.each do |ufm| %>
- <% if ufm.forge_message_type == "Issue" %>
-
- <% end %>
- <% if ufm.forge_message_type == "Journal" %>
-
- <% end %>
- <% if ufm.forge_message_type == "Message" %>
-
- <% end %>
- <% if ufm.forge_message_type == "News" %>
-
- <% end %>
- <% if ufm.forge_message_type == "Comment" %>
-
- - <%= image_tag(url_to_avatar(ufm.forge_message.author), :width => "30", :height => "30") %>
- - <%=link_to ufm.forge_message.author, user_path(ufm.forge_message.author), :class => "newsBlue" %>
- - 回复了新闻
- -
- <%= link_to "#{ufm.forge_message.comments.html_safe}",
- {:controller => 'news', :action => 'show', :id => ufm.forge_message.commented.id },:class =>"#{ufm.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ufm.forge_message.comments.html_safe}"%>
- - <%= time_tag(ufm.forge_message.created_on).html_safe %>
-
- <% end %>
- <% end %>
- <% end %>
- <%# 公共贴吧 %>
- <% unless @user_memo_messages.nil? %>
- <% @user_memo_messages.each do |urm| %>
- <% if urm.memo_type == "Memo" %>
-
- <% end %>
- <% end %>
- <% end %>
- <%# 用户留言消息 %>
- <% unless @user_feedback_messages.nil? %>
- <% @user_feedback_messages.each do |ufm| %>
- <% if ufm.journals_for_message_type == "JournalsForMessage" %>
-
- <% end %>
- <% end %>
- <% end %>
<% else %>
暂无消息!
<% end %>
diff --git a/app/views/users/user_messages_new.html.erb b/app/views/users/user_messages_new.html.erb
index d861f867d..4f612b8b6 100644
--- a/app/views/users/user_messages_new.html.erb
+++ b/app/views/users/user_messages_new.html.erb
@@ -37,180 +37,214 @@
<% if @new_message_count >0 %>
<%# 课程消息 %>
- <% unless @user_message_all.nil? %>
- <% @user_message_all.each do |uma| %>
- <% if uma.message.course_message_type == "News" %>
-
- - <%= image_tag(url_to_avatar(uma.message.course_message.author), :width => "30", :height => "30") %>
- - <%=link_to uma.message.course_message.author, user_path(uma.message.course_message.author), :class => "newsBlue" %>
- - ">发布通知
- -
- <%= link_to uma.message.course_message.title, {:controller => 'news', :action => 'show', :id => uma.message.course_message.id },
- :class =>"#{uma.message.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :title => "#{uma.message.course_message.title}" %>
- - <%= time_tag(uma.message.course_message.created_on).html_safe %>
-
- <% end %>
- <% if uma.message.course_message_type == "Comment" %>
-
- - <%= image_tag(url_to_avatar(uma.message.course_message.author), :width => "30", :height => "30") %>
- - <%=link_to uma.message.course_message.author, user_path(uma.message.course_message.author), :class => "newsBlue" %>
- - ">回复了通知
- -
- <%= link_to uma.message.course_message.comments.html_safe, {:controller => 'news', :action => 'show', :id => uma.message.course_message.commented.id },
- :class =>"#{uma.message.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :title => "#{uma.message.course_message.comments.html_safe}" %>
- - <%= time_tag(uma.message.course_message.created_on).html_safe %>
-
- <% end %>
- <% if uma.message.course_message_type == "HomeworkCommon" %>
-
- <% end %>
- <% if uma.message.course_message_type == "Poll" %>
-
- <% end %>
- <% if uma.message.course_message_type == "Message" %>
-
- - <%= image_tag(url_to_avatar(uma.message.course_message.author), :width => "30", :height => "30") %>
- - <%=link_to uma.message.course_message.author, user_path(uma.message.course_message.author), :class => "newsBlue" %>
- <% if uma.message.course_message.parent_id.nil? %>
- - ">发布帖子
+ <% unless @message_alls.nil? %>
+ <% @message_alls.each do |ma| %>
+ <% if ma.class == CourseMessage %>
+ <% if ma.course_message_type == "News" %>
+
+ - <%= image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30") %>
+ - <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue" %>
+ - ">发布通知
+ -
+ <%= link_to ma.course_message.title, {:controller => 'news', :action => 'show', :id => ma.course_message.id },
+ :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :title => "#{ma.course_message.title}" %>
+ - <%= time_tag(ma.course_message.created_on).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "Comment" %>
+
+ - <%= image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30") %>
+ - <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue" %>
+ - ">回复了通知
+ -
+ <%= link_to ma.course_message.comments.html_safe, {:controller => 'news', :action => 'show', :id => ma.course_message.commented.id },
+ :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :title => "#{ma.course_message.comments.html_safe}" %>
+ - <%= time_tag(ma.course_message.created_on).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "HomeworkCommon" %>
+
+ - <%= image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30") %>
+ - <%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue" %>
+ - 发布作业
-
- <%=link_to uma.message.course_message.subject.html_safe, course_boards_path(uma.message.course_message.course,:parent_id => uma.message.course_message.parent_id ? uma.message.course_message.parent_id : uma.message.course_message.id,
- :topic_id => uma.message.course_message.id),:class=>"#{uma.message.viewed==0?"newsBlack":"newsGrey"}",
- :title => "#{uma.message.course_message.subject.html_safe}" %>
- - <%= time_tag(uma.message.course_message.created_on).html_safe %>
- <% else %>
- - ">回复帖子
+ <%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),:class => "newsGrey", :title => "#{ma.course_message.name}" %>
+ - <%= time_tag(ma.course_message.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "Poll" %>
+
- <% end %>
- <% if uma.message.course_message_type == "StudentWorksScore" %>
-
- <% end %>
- <% if uma.message.course_message_type == "JournalsForMessage" %>
-
+ <%= link_to format_activity_title(" #{ma.course_message.polls_name.nil? ? "未命名问卷" : ma.course_message.polls_name}"), poll_index_path(:polls_type => "Course", :polls_group_id => ma.course_id),
+ :class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}",
+ :title => "#{ma.course_message.polls_name}" %>
+ - <%= time_tag(ma.course_message.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "Message" %>
+
+ - <%= image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30") %>
+ - <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue" %>
+ <% if ma.course_message.parent_id.nil? %>
+ - ">发布帖子
+ -
+ <%=link_to ma.course_message.subject.html_safe, course_boards_path(ma.course_message.course,:parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id,
+ :topic_id => ma.course_message.id),:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}",
+ :title => "#{ma.course_message.subject.html_safe}" %>
+ - <%= time_tag(ma.course_message.created_on).html_safe %>
+ <% else %>
+ - ">回复帖子
+ -
+ <%=link_to ma.course_message.subject.html_safe, course_boards_path(ma.course_message.course,:parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id,
+ :topic_id => ma.course_message.id),:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}",
+ :title => "#{ma.course_message.subject.html_safe}" %>
+ - <%= time_tag(ma.course_message.created_on).html_safe %>
+ <% end %>
+
+ <% end %>
+ <% if ma.course_message_type == "StudentWorksScore" %>
+
+ <% end %>
+ <% if ma.course_message_type == "JournalsForMessage" %>
+
+ <% end %>
<% end %>
+
+ <% if ma.class == ForgeMessage %>
+ <% if ma.forge_message_type == "Issue" %>
+
+ <% end %>
+ <% if ma.forge_message_type == "Journal" %>
+
+ <% end %>
+ <% if ma.forge_message_type == "Message" %>
+
+ <% end %>
+ <% if ma.forge_message_type == "News" %>
+
+ <% end %>
+ <% if ma.forge_message_type == "Comment" %>
+
+ - <%= image_tag(url_to_avatar(ma.forge_message.author), :width => "30", :height => "30") %>
+ - <%=link_to ma.forge_message.author, user_path(ma.forge_message.author), :class => "newsBlue" %>
+ - 回复了新闻
+ -
+ <%= link_to "#{ma.forge_message.comments.html_safe}",
+ {:controller => 'news', :action => 'show', :id => ma.forge_message.commented.id },:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.forge_message.comments.html_safe}"%>
+ - <%= time_tag(ma.forge_message.created_on).html_safe %>
+
+ <% end %>
<% end %>
- <% if uma.message.forge_message_type == "Journal" %>
-
+
+ <% if ma.class == MemoMessage %>
+ <% if ma.memo_type == "Memo" %>
+
+ <% end %>
<% end %>
- <% if uma.message.forge_message_type == "Message" %>
-
+
+ <% if ma.class == UserFeedbackMessage %>
+ <% if ma.journals_for_message_type == "JournalsForMessage" %>
+
+ <% end %>
<% end %>
- <% if uma.message.forge_message_type == "News" %>
-
- <% end %>
- <% if uma.message.forge_message_type == "Comment" %>
-
- - <%= image_tag(url_to_avatar(uma.message.forge_message.author), :width => "30", :height => "30") %>
- - <%=link_to uma.message.forge_message.author, user_path(uma.message.forge_message.author), :class => "newsBlue" %>
- - 回复了新闻
- -
- <%= link_to "#{uma.message.forge_message.comments.html_safe}",
- {:controller => 'news', :action => 'show', :id => uma.message.forge_message.commented.id },:class =>"#{uma.message.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{uma.message.forge_message.comments.html_safe}"%>
- - <%= time_tag(uma.message.forge_message.created_on).html_safe %>
-
- <% end %>
-
-
<% end %>
<% end %>
- <%# 公共贴吧 %>
-
- <%# 用户留言消息 %>
<% else %>
暂无消息!
diff --git a/db/schema.rb b/db/schema.rb
index 0bd96d52d..791c5b14d 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -14,11 +14,12 @@
ActiveRecord::Schema.define(:version => 20150824133916) do
create_table "activities", :force => true do |t|
- t.integer "act_id", :null => false
- t.string "act_type", :null => false
- t.integer "user_id", :null => false
- t.integer "activity_container_id"
- t.string "activity_container_type", :default => ""
+ t.integer "act_id", :null => false
+ t.string "act_type", :null => false
+ t.integer "user_id", :null => false
+ t.integer "activity_container_id"
+ t.string "activity_container_type", :default => ""
+ t.datetime "created_at"
end
add_index "activities", ["act_id", "act_type"], :name => "index_activities_on_act_id_and_act_type"
@@ -881,14 +882,6 @@ ActiveRecord::Schema.define(:version => 20150824133916) do
t.datetime "updated_at", :null => false
end
- create_table "message_publics", :force => true do |t|
- t.integer "message_id"
- t.string "massage_type"
- t.integer "user_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
create_table "messages", :force => true do |t|
t.integer "board_id", :null => false
t.integer "parent_id"
@@ -1539,6 +1532,7 @@ ActiveRecord::Schema.define(:version => 20150824133916) do
t.string "identity_url"
t.string "mail_notification", :default => "", :null => false
t.string "salt", :limit => 64
+ t.integer "gid"
end
add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id"