diff options
| author | mo khan <mo@mokhan.ca> | 2014-01-18 23:26:44 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-01-18 23:26:44 -0700 |
| commit | 140f058d047efda322490f3910f486bb49ab1445 (patch) | |
| tree | e18facd235b2e32f6ed9494661d1941c3dfe6482 | |
| parent | 5909a73e78b1b2501c6f732f0c76279c7b1c7f1e (diff) | |
add an admin page to view activity.
| -rw-r--r-- | app/controllers/admin/activities_controller.rb | 8 | ||||
| -rw-r--r-- | app/controllers/admin/users_controller.rb | 1 | ||||
| -rw-r--r-- | app/views/admin/activities/index.html.erb | 9 | ||||
| -rw-r--r-- | config/routes.rb | 1 |
4 files changed, 19 insertions, 0 deletions
diff --git a/app/controllers/admin/activities_controller.rb b/app/controllers/admin/activities_controller.rb new file mode 100644 index 00000000..43dece54 --- /dev/null +++ b/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 diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 03f0aef6..bd2da01a 100644 --- a/app/controllers/admin/users_controller.rb +++ b/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 diff --git a/app/views/admin/activities/index.html.erb b/app/views/admin/activities/index.html.erb new file mode 100644 index 00000000..73538029 --- /dev/null +++ b/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> diff --git a/config/routes.rb b/config/routes.rb index b6fdd84e..20e0eaba 100644 --- a/config/routes.rb +++ b/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 |
