|
|
@ -215,18 +215,48 @@ class UsersController < ApplicationController
|
|
|
|
# @activity_pages = Paginator.new @activity_count, @limit, params['page']
|
|
|
|
# @activity_pages = Paginator.new @activity_count, @limit, params['page']
|
|
|
|
# @offset ||= @activity_pages.offset
|
|
|
|
# @offset ||= @activity_pages.offset
|
|
|
|
# @events_by_day_ = @events.slice(@offset,@limit)
|
|
|
|
# @events_by_day_ = @events.slice(@offset,@limit)
|
|
|
|
if @user == User.current
|
|
|
|
case params[:type]
|
|
|
|
|
|
|
|
when "1"
|
|
|
|
|
|
|
|
if @user == User.current
|
|
|
|
|
|
|
|
activity = Activity.where('user_id = ?', User.current.id).order('id desc')
|
|
|
|
|
|
|
|
@offset, @limit = api_offset_and_limit({:limit => 10})
|
|
|
|
|
|
|
|
@activity_count = activity.count
|
|
|
|
|
|
|
|
@activity_pages = Paginator.new @activity_count, @limit, params['page']
|
|
|
|
|
|
|
|
@offset ||= @activity_pages.offset
|
|
|
|
|
|
|
|
@activity = activity.offset(@offset).limit(@limit)
|
|
|
|
|
|
|
|
@state = 1
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
when "2"
|
|
|
|
|
|
|
|
message = []
|
|
|
|
|
|
|
|
if @user == User.current
|
|
|
|
|
|
|
|
message = JournalsForMessage.reference_message(@user.id)
|
|
|
|
|
|
|
|
message += Journal.reference_message(@user.id)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
@offset, @limit = api_offset_and_limit({:limit => 10})
|
|
|
|
|
|
|
|
@activity_count = message.size
|
|
|
|
|
|
|
|
@info_pages = Paginator.new @activity_count, @limit, params['page']
|
|
|
|
|
|
|
|
@offset ||= @info_pages.offset
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
messages = message.sort {|x,y| y.created_on <=> x.created_on }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@message = messages[@offset, @limit]
|
|
|
|
|
|
|
|
@state = 2
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
if @user == User.current
|
|
|
|
watcher = User.watched_by(@user)
|
|
|
|
watcher = User.watched_by(@user)
|
|
|
|
watcher.push(User.current)
|
|
|
|
watcher.push(User.current)
|
|
|
|
activity = Activity.where('user_id in (?)', watcher).order('id desc')
|
|
|
|
activity = Activity.where('user_id in (?)', watcher).order('id desc')
|
|
|
|
else
|
|
|
|
else
|
|
|
|
activity = Activity.where('user_id = ?', @user.id).order('id desc')
|
|
|
|
activity = Activity.where('user_id = ?', @user.id).order('id desc')
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
@offset, @limit = api_offset_and_limit({:limit => 10})
|
|
|
|
|
|
|
|
@activity_count = activity.count
|
|
|
|
|
|
|
|
@activity_pages = Paginator.new @activity_count, @limit, params['page']
|
|
|
|
|
|
|
|
@offset ||= @activity_pages.offset
|
|
|
|
|
|
|
|
@activity = activity.offset(@offset).limit(@limit)
|
|
|
|
|
|
|
|
@state = 0
|
|
|
|
end
|
|
|
|
end
|
|
|
|
@offset, @limit = api_offset_and_limit({:limit => 10})
|
|
|
|
|
|
|
|
@activity_count = activity.count
|
|
|
|
|
|
|
|
@activity_pages = Paginator.new @activity_count, @limit, params['page']
|
|
|
|
|
|
|
|
@offset ||= @activity_pages.offset
|
|
|
|
|
|
|
|
@activity = activity.offset(@offset).limit(@limit)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Modified by nie
|
|
|
|
#Modified by nie
|
|
|
|
unless User.current.admin?
|
|
|
|
unless User.current.admin?
|
|
|
@ -249,10 +279,10 @@ class UsersController < ApplicationController
|
|
|
|
def info
|
|
|
|
def info
|
|
|
|
|
|
|
|
|
|
|
|
message = []
|
|
|
|
message = []
|
|
|
|
if @user == User.current
|
|
|
|
if @user == User.current
|
|
|
|
|
|
|
|
|
|
|
|
message = JournalsForMessage.reference_message(@user.id)
|
|
|
|
message = JournalsForMessage.reference_message(@user.id)
|
|
|
|
message += Journal.reference_message(@user.id) end
|
|
|
|
message += Journal.reference_message(@user.id)
|
|
|
|
|
|
|
|
end
|
|
|
|
@offset, @limit = api_offset_and_limit({:limit => 10})
|
|
|
|
@offset, @limit = api_offset_and_limit({:limit => 10})
|
|
|
|
@info_count = message.size
|
|
|
|
@info_count = message.size
|
|
|
|
@info_pages = Paginator.new @info_count, @limit, params['page']
|
|
|
|
@info_pages = Paginator.new @info_count, @limit, params['page']
|
|
|
|