Skip to content

Commit

Permalink
Recent viewed are available at initial load.
Browse files Browse the repository at this point in the history
  • Loading branch information
martini committed Aug 26, 2014
1 parent 202f052 commit 87c9115
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/controllers/recent_viewed_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class RecentViewedController < ApplicationController
=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
Expand Down
3 changes: 3 additions & 0 deletions app/controllers/sessions/collection_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ def session( collections, assets, user )
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)
Expand Down
8 changes: 4 additions & 4 deletions app/models/recent_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@ def self.list( user, limit = 10 )
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,
{
Expand Down

0 comments on commit 87c9115

Please sign in to comment.