Recent viewed are available at initial load.
This commit is contained in:
parent
202f0529f9
commit
87c91152a7
3 changed files with 8 additions and 5 deletions
|
@ -19,7 +19,7 @@ curl http://localhost/api/v1/recent_viewed -v -u #{login}:#{password} -H "Conten
|
|||
=end
|
||||
|
||||
def index
|
||||
recent_viewed = RecentView.list_fulldata( current_user, 10 )
|
||||
recent_viewed = RecentView.list_full( current_user, 10 )
|
||||
|
||||
# return result
|
||||
render :json => recent_viewed
|
||||
|
|
|
@ -13,6 +13,9 @@ module ExtraCollection
|
|||
collections[ OnlineNotification.to_app_model ] = OnlineNotification.list(user, 20)
|
||||
assets = ApplicationModel.assets_of_object_list(collections[ OnlineNotification.to_app_model ], assets)
|
||||
|
||||
collections[ RecentView.to_app_model ] = RecentView.list(user, 10)
|
||||
assets = RecentView.assets_of_object_list(collections[ RecentView.to_app_model ], assets)
|
||||
|
||||
collections[ Role.to_app_model ] = []
|
||||
Role.all.each {|item|
|
||||
assets = item.assets(assets)
|
||||
|
|
|
@ -46,20 +46,20 @@ class RecentView < ApplicationModel
|
|||
list
|
||||
end
|
||||
|
||||
def self.list_fulldata( user, limit = 10 )
|
||||
def self.list_full( user, limit = 10 )
|
||||
recent_viewed = self.list( user, limit )
|
||||
|
||||
# get related object
|
||||
assets = ApplicationModel.assets_of_object_list(recent_viewed)
|
||||
|
||||
return {
|
||||
:recent_viewed => recent_viewed,
|
||||
:assets => assets,
|
||||
:stream => recent_viewed,
|
||||
:assets => assets,
|
||||
}
|
||||
end
|
||||
|
||||
def notify_clients
|
||||
data = RecentView.list_fulldata( User.find(self.created_by_id), 10 )
|
||||
data = RecentView.list_full( User.find(self.created_by_id), 10 )
|
||||
Sessions.send_to(
|
||||
self.created_by_id,
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue