Add impressionist

This commit is contained in:
Christophe Vilayphiou committed 2012-05-15 21:26:09 +08:00
1 parent 53a0fbddf0
commit e54f4409fb
21 files changed
+212 -83

No files matched your search

@@ -7,6 +7,7 @@ class Admin::DashboardsController < ApplicationController
def index
@module_app_contents, @module_app_contents_total = get_module_app_count('bulletin', 'news_bulletin', 'page_context', 'web_link')
@recent_updated = get_recently_updated('bulletin', 'news_bulletin', 'page_context', 'web_link')
@most_visited = get_most_visited('bulletin', 'news_bulletin', 'page_context')
end
protected
@@ -35,5 +36,18 @@ class Admin::DashboardsController < ApplicationController
sorted_objects = a.sort {|a,b| b[1]<=>a[1]}
sorted_objects[0..9]
end
def get_most_visited(*args)
a = {}
args.each do |module_app|
module_app_class = module_app.classify.constantize
objects = module_app_class.order_by(:view_count, :desc).limit(10)
objects.each do |object|
a.merge!(object => object.view_count) if object.view_count > 0
end
end
sorted_objects = a.sort {|a,b| b[1]<=>a[1]}
sorted_objects[0..9]
end
end
@@ -1,9 +1,7 @@
class Admin::ObjectAuthsNewInterfaceController < OrbitBackendController
include OrbitCoreLib::PermissionUnility
layout "new_admin"
before_filter :force_order
layout "new_admin"
before_filter :force_order
def setting