Class: Refinery::Admin::DashboardController

Inherits:
Refinery::AdminController
  • Object
show all
Defined in:
app/controllers/refinery/admin/dashboard_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/refinery/admin/dashboard_controller.rb', line 5

def index
  @recent_activity = []

  ::Refinery::Plugins.active.each do |plugin|
    begin
      plugin.activity.each do |activity|
        @recent_activity += activity.klass.where(activity.conditions).
                                           order(activity.order).
                                           limit(activity.limit)
      end
    rescue
      logger.warn "#{$!.class.name} raised while getting recent activity for dashboard."
      logger.warn $!.message
      logger.warn $!.backtrace.collect { |b| " > #{b}" }.join("\n")
    end
  end

  @recent_activity = @recent_activity.sort_by(&:updated_at).reverse.
                     first(Refinery::Dashboard.activity_show_limit)

  @recent_inquiries = if Refinery::Plugins.active.find_by_name("refinerycms_inquiries")
    Refinery::Inquiries::Inquiry.latest(Refinery::Dashboard.activity_show_limit)
  else
    []
  end
end