From a71ff944c0ba89dfed7ad74e29730adac8143945 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 17 Aug 2015 10:42:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 12 ++++++------ app/views/users/user_messages.html.erb | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index bc155dbbe..969d2d366 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -109,19 +109,19 @@ class UsersController < ApplicationController end if @user.course_messages if params[:type].nil? - @user_course_messages = @user.course_messages - @user_project_messges = @user.forge_messages + @user_course_messages = @user.course_messages.reverse + @user_project_messges = @user.forge_messages.reverse else case params[:type] when 'homework' - @user_course_messages = @user.course_messages.select{|x| x.course_message_type == "HomeworkCommon"} + @user_course_messages = @user.course_messages.reverse.select{|x| x.course_message_type == "HomeworkCommon"} #@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_messages.select{|x| x.course_message_type == "Message"} + @user_course_messages = @user.course_messages.reverse.select{|x| x.course_message_type == "Message"} when 'news' - @user_course_messages = @user.course_messages.select{|x| x.course_message_type == "News"} + @user_course_messages = @user.course_messages.reverse.select{|x| x.course_message_type == "News"} when 'poll' - @user_course_messages = @user.course_messages.select{|x| x.course_message_type == "Poll"} + @user_course_messages = @user.course_messages.reverse.select{|x| x.course_message_type == "Poll"} end end respond_to do |format| diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index a61342cc6..cf3e13ff9 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -26,7 +26,7 @@
  • <%= image_tag(url_to_avatar(ucm.course_message.author), :width => "30", :height => "30") %>
  • <%= ucm.course_message.author %>
  • 发布通知
  • -
  • +
  • <%= link_to format_activity_title(" #{ucm.course_message.title}"), {:controller => 'news', :action => 'show', :id => ucm.course_message.id} %>
  • <%= time_tag(ucm.course_message.created_on).html_safe %>