aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-03-06 15:14:08 -0800
committerLouise Crow <louise.crow@gmail.com>2013-03-06 15:14:08 -0800
commit455a1f07f3099d1d94fff2a7efcf99fb8fd6841d (patch)
treed2b6603b99104a99443d230f01115b0626050c91 /app/controllers
parentbda2645de69bfee361280c4bfe3dc1bef8aa330d (diff)
parentb8388eeb637476cfc2e9ec9ee791cab341e76f95 (diff)
Merge remote-tracking branch 'openaustralia_github/merge_adminbootstrap_theme' into develop
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/admin_general_controller.rb18
-rw-r--r--app/controllers/admin_track_controller.rb1
-rw-r--r--app/controllers/general_controller.rb2
3 files changed, 19 insertions, 2 deletions
diff --git a/app/controllers/admin_general_controller.rb b/app/controllers/admin_general_controller.rb
index 9f4c398c1..800678787 100644
--- a/app/controllers/admin_general_controller.rb
+++ b/app/controllers/admin_general_controller.rb
@@ -5,6 +5,8 @@
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
class AdminGeneralController < AdminController
+ skip_before_filter :authenticate, :only => :admin_js
+
def index
# ensure we have a trailing slash
current_uri = request.env['REQUEST_URI']
@@ -115,6 +117,17 @@ class AdminGeneralController < AdminController
end
def stats
+ # Overview counts of things
+ @public_body_count = PublicBody.count
+
+ @info_request_count = InfoRequest.count
+ @outgoing_message_count = OutgoingMessage.count
+ @incoming_message_count = IncomingMessage.count
+
+ @user_count = User.count
+ @track_thing_count = TrackThing.count
+
+ @comment_count = Comment.count
@request_by_state = InfoRequest.count(:group => 'described_state')
@tracks_by_type = TrackThing.count(:group => 'track_type')
end
@@ -128,5 +141,10 @@ class AdminGeneralController < AdminController
@github_origin = "https://github.com/#{repo}/tree/"
@request_env = request.env
end
+
+ # TODO: Remove this when support for proxy admin interface is removed
+ def admin_js
+ render :layout => false, :content_type => "application/javascript"
+ end
end
diff --git a/app/controllers/admin_track_controller.rb b/app/controllers/admin_track_controller.rb
index 03217da45..525c96782 100644
--- a/app/controllers/admin_track_controller.rb
+++ b/app/controllers/admin_track_controller.rb
@@ -9,6 +9,7 @@ class AdminTrackController < AdminController
@query = params[:query]
@admin_tracks = TrackThing.paginate :order => "created_at desc", :page => params[:page], :per_page => 100,
:conditions => @query.nil? ? nil : ["lower(track_query) like lower('%'||?||'%')", @query ]
+ @popular = ActiveRecord::Base.connection.select_all("select count(*) as count, title, info_request_id from track_things join info_requests on info_request_id = info_requests.id where info_request_id is not null group by info_request_id, title order by count desc limit 10;")
end
private
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index a8bbc22ff..f6a46458e 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -229,7 +229,5 @@ class GeneralController < ApplicationController
@locale = self.locale_from_params()
render(:layout => false, :content_type => 'text/css')
end
-
-
end