This commit is contained in:
parent
a677119ba0
commit
472254019e
|
@ -108,24 +108,25 @@ class UsersController < ApplicationController
|
|||
# querys.update_all(:viewed => true)
|
||||
# end
|
||||
if @user.course_messages
|
||||
if params[:type].nil?
|
||||
case params[:type]
|
||||
when nil
|
||||
@user_course_messages = @user.course_messages.reverse
|
||||
@user_project_messges = @user.forge_messages.reverse
|
||||
else
|
||||
case params[:type]
|
||||
when 'homework'
|
||||
@user_course_messages = CourseMessage.where(:course_message_type => "HomeworkCommon", :user_id => @user)
|
||||
@user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "HomeworkCommon", @user).order("created_at desc")
|
||||
when 'message'
|
||||
@user_course_messages = CourseMessage.where(:course_message_type => "Message", :user_id => @user)
|
||||
@user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc")
|
||||
# @user_course_messages = CourseMessage.where(:course_message_type => "Message", :user_id => @user).reverse
|
||||
when 'news'
|
||||
@user_course_messages = CourseMessage.where(:course_message_type => "News", :user_id => @user)
|
||||
@user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "News", @user).order("created_at desc")
|
||||
when 'poll'
|
||||
@user_course_messages = CourseMessage.where(:course_message_type => "Poll", :user_id => @user)
|
||||
end
|
||||
@user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc")
|
||||
when ""
|
||||
when 'issue'
|
||||
@user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "Issue", @user).order("created_at desc")
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html{render :layout=>'base_users_new'}
|
||||
format.api
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue