add basic graph to stats view
This commit is contained in:
parent
2d9b9270cb
commit
5c6441f6db
2 changed files with 34 additions and 5 deletions
|
|
@ -36,8 +36,12 @@ class AdminsController < ApplicationController
|
|||
create_hash(model)
|
||||
end
|
||||
|
||||
@posts[:new_public] = Post.where(:type => ['StatusMessage','ActivityStreams::Photo'],
|
||||
:public => true).order('created_at DESC').limit(15).all
|
||||
@posts_per_day = Post.count(:group => "DATE(created_at)", :conditions => ["created_at >= ?", Date.today - 21.days], :order => "DATE(created_at) ASC")
|
||||
@most_posts_within = @posts_per_day.values.max.to_f
|
||||
|
||||
#@posts[:new_public] = Post.where(:type => ['StatusMessage','ActivityStreams::Photo'],
|
||||
# :public => true).order('created_at DESC').limit(15).all
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -35,9 +35,34 @@
|
|||
%br
|
||||
%br
|
||||
%br
|
||||
%hr
|
||||
%hr
|
||||
|
||||
%br
|
||||
%br
|
||||
|
||||
%h3
|
||||
Posts over time
|
||||
|
||||
#stats_graph{:style => "text-align:right;position:relative;vertical-align:bottom;background-color:#eee;"}
|
||||
- @posts_per_day.each do |key, val|
|
||||
.asdo{:style => "display:inline-block;width:35px;vertical-align:bottom;background-color:#666;height:#{(val/@most_posts_within)*200}px;"}
|
||||
|
||||
|
||||
%br
|
||||
%br
|
||||
%br
|
||||
%br
|
||||
|
||||
|
||||
|
||||
%br
|
||||
%br
|
||||
%br
|
||||
%br
|
||||
%br
|
||||
%br
|
||||
%br
|
||||
%br
|
||||
%br
|
||||
%br
|
||||
%br
|
||||
|
|
@ -66,8 +91,8 @@
|
|||
.span-12
|
||||
%h3
|
||||
New public posts
|
||||
.stream
|
||||
= render 'shared/stream', :posts => @new_public_posts
|
||||
/.stream
|
||||
/ /= render 'shared/stream', :posts => @new_public_posts
|
||||
|
||||
.span-12.last
|
||||
%h3
|
||||
|
|
|
|||
Loading…
Reference in a new issue