Author: assaf
Date: Fri Jun 6 20:26:58 2008
New Revision: 664263
URL: http://svn.apache.org/viewvc?rev=664263&view=rev
Log:
I can has sparklines?
Added:
ode/sandbox/singleshot/app/controllers/sparklines_controller.rb
Modified:
ode/sandbox/singleshot/app/helpers/application_helper.rb
ode/sandbox/singleshot/app/views/activity/index.html.erb
ode/sandbox/singleshot/app/views/tasks/completed.html.erb
ode/sandbox/singleshot/config/environment.rb
ode/sandbox/singleshot/config/routes.rb
ode/sandbox/singleshot/public/stylesheets/default.css
Added: ode/sandbox/singleshot/app/controllers/sparklines_controller.rb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/controllers/sparklines_controller.rb?rev=664263&view=auto
==============================================================================
--- ode/sandbox/singleshot/app/controllers/sparklines_controller.rb (added)
+++ ode/sandbox/singleshot/app/controllers/sparklines_controller.rb Fri Jun 6
20:26:58 2008
@@ -0,0 +1,8 @@
+class SparklinesController < ApplicationController
+
+ def index
+ options = { :type=>'bar', :step=>4, :above_color=>'#65a0e4',
:below_color=>'#a8c0d8', :target=>50, :target_color=>'#ffffd0' }
+ render :text=>Sparklines.plot(params[:results].split(',').map(&:to_f),
options.merge(params)), :content_type=>'image/png'
+ end
+
+end
Modified: ode/sandbox/singleshot/app/helpers/application_helper.rb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/helpers/application_helper.rb?rev=664263&r1=664262&r2=664263&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/helpers/application_helper.rb (original)
+++ ode/sandbox/singleshot/app/helpers/application_helper.rb Fri Jun 6
20:26:58 2008
@@ -1,6 +1,8 @@
# Methods added to this helper will be available to all templates in the
application.
module ApplicationHelper
+ include SparklinesHelper
+
# Returns a link to a person using their full name as the link text and site
URL
# (or profile, if unspecified) as the reference.
def link_to_person(person, options = {})
Modified: ode/sandbox/singleshot/app/views/activity/index.html.erb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/views/activity/index.html.erb?rev=664263&r1=664262&r2=664263&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/views/activity/index.html.erb (original)
+++ ode/sandbox/singleshot/app/views/activity/index.html.erb Fri Jun 6
20:26:58 2008
@@ -1,9 +1,10 @@
<% by_date = group_by_dates(@activities, :created_at) %>
+<div style='float:right; margin-right: 3em'><%= sparkline_tag((0..30).map {
rand(100) }) %></div>
<ol class='dates hfeed'>
<% for date, activities in by_date %>
<li class='date'>
<h2><%= date.humanize %></h2>
- <%= render :partial=>'activities', :locals=>{ :activities=>activities }
%>
+ <%= render :partial=>'activities', :locals=>{ :activities=>activities,
:today=>nil } %>
</li>
<% end %>
</ol>
Modified: ode/sandbox/singleshot/app/views/tasks/completed.html.erb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/views/tasks/completed.html.erb?rev=664263&r1=664262&r2=664263&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/views/tasks/completed.html.erb (original)
+++ ode/sandbox/singleshot/app/views/tasks/completed.html.erb Fri Jun 6
20:26:58 2008
@@ -1,4 +1,5 @@
<% by_date = group_by_dates(@tasks, :updated_at) %>
+<div class='right'><%= sparkline_tag @tasks.group_by { |task|
task.updated_at.to_date }.map { |date, tasks| tasks.size } %></div>
<ol class='dates hfeed'>
<% for date, tasks in by_date %>
<li class='date'>
Modified: ode/sandbox/singleshot/config/environment.rb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/config/environment.rb?rev=664263&r1=664262&r2=664263&view=diff
==============================================================================
--- ode/sandbox/singleshot/config/environment.rb (original)
+++ ode/sandbox/singleshot/config/environment.rb Fri Jun 6 20:26:58 2008
@@ -25,6 +25,7 @@
# config.gem "bj"
# config.gem "hpricot", :version => '0.6', :source =>
"http://code.whytheluckystiff.net"
# config.gem "aws-s3", :lib => "aws/s3"
+ config.gem 'sparklines'
# Only load the plugins named here, in the order given. By default, all
plugins
# in vendor/plugins are loaded in alphabetical order.
Modified: ode/sandbox/singleshot/config/routes.rb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/config/routes.rb?rev=664263&r1=664262&r2=664263&view=diff
==============================================================================
--- ode/sandbox/singleshot/config/routes.rb (original)
+++ ode/sandbox/singleshot/config/routes.rb Fri Jun 6 20:26:58 2008
@@ -16,7 +16,9 @@
opts.activity '/activity'
opts.formatted_activity '/activity.:format'
end
+ map.sparklines '/sparklines', :controller=>'sparklines'
map.root :controller=>'application'
+
map.resource 'sandwich'
map.resource 'survey', :controller=>'survey'
Modified: ode/sandbox/singleshot/public/stylesheets/default.css
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/public/stylesheets/default.css?rev=664263&r1=664262&r2=664263&view=diff
==============================================================================
--- ode/sandbox/singleshot/public/stylesheets/default.css (original)
+++ ode/sandbox/singleshot/public/stylesheets/default.css Fri Jun 6 20:26:58
2008
@@ -397,6 +397,12 @@
}
+div.right {
+ float: right;
+ margin-right: 3em;
+}
+
+
/** Login **/
form.login {
width: 30em;