Commit 140f058d

mo khan <mo@mokhan.ca>
2014-01-19 06:26:44
add an admin page to view activity.
1 parent 5909a73
Changed files (4)
app/controllers/admin/activities_controller.rb
@@ -0,0 +1,8 @@
+module Admin
+  class ActivitiesController < AdminController
+    def index
+      @recent_activities = Activity.order(:created_at => :desc).limit(100)
+      expires_in(10.minutes)
+    end
+  end
+end
app/controllers/admin/users_controller.rb
@@ -4,6 +4,7 @@ module Admin
       @users = User.includes(:avatar).order(:created_at => :desc)
       @recent_users = @users.limit(10)
       @active_users = @users.order(:updated_at).limit(10)
+      @recent_activities = Activity.order(:created_at => :desc).limit(10)
       expires_in(10.minutes)
     end
   end
app/views/admin/activities/index.html.erb
@@ -0,0 +1,9 @@
+<div class="row-fluid">
+  <div class="span12">
+    <dl class="dl-horizontal">
+      <% @recent_activities.each do |activity| %>
+        <%= render "dashboard/#{activity.subject.class.to_s.downcase}", subject: activity.subject %>
+      <% end %>
+    </dl>
+  </div>
+</div>
config/routes.rb
@@ -64,5 +64,6 @@ Cake::Application.routes.draw do
     root :to => "users#index"
     resources :users, only: [:index]
     resources :jobs, only: [:index, :show]
+    resources :activities, only: [:index]
   end
 end