This commit is contained in:
cxt 2015-08-18 09:18:10 +08:00
commit bc993e3b5c
2 changed files with 7 additions and 7 deletions

View File

@ -109,19 +109,19 @@ class UsersController < ApplicationController
end end
if @user.course_messages if @user.course_messages
if params[:type].nil? if params[:type].nil?
@user_course_messages = @user.course_messages @user_course_messages = @user.course_messages.reverse
@user_project_messges = @user.forge_messages @user_project_messges = @user.forge_messages.reverse
else else
case params[:type] case params[:type]
when 'homework' 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;") #@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' 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' 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' 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
end end
respond_to do |format| respond_to do |format|

View File

@ -26,7 +26,7 @@
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.author), :width => "30", :height => "30") %></a></li> <li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.author), :width => "30", :height => "30") %></a></li>
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.author %></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="homepageNewsType fl">发布通知</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey"> <li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to format_activity_title(" #{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> <li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_on).html_safe %> </li>
</ul> </ul>