X-Git-Url: https://projects.mako.cc/source/selectricity-live/blobdiff_plain/05ebed925ae2b5e7bf2a599536ba7d7ac15ffbf7..ad088c1324d08a65f6f5336bedf7a88a8a8950e7:/vendor/plugins/sparklines/generators/sparklines/templates/controller.rb diff --git a/vendor/plugins/sparklines/generators/sparklines/templates/controller.rb b/vendor/plugins/sparklines/generators/sparklines/templates/controller.rb deleted file mode 100644 index 1c69f29..0000000 --- a/vendor/plugins/sparklines/generators/sparklines/templates/controller.rb +++ /dev/null @@ -1,40 +0,0 @@ -class SparklinesController < ApplicationController - - # Handles requests for sparkline graphs from views. - # - # Params are generated by the sparkline_tag helper method. - # - def index - # Make array from comma-delimited list of data values - ary = [] - if params.has_key?('results') && !params['results'].nil? - params['results'].split(',').each do |s| - ary << s.to_i - end - end - - send_data( Sparklines.plot( ary, params ), - :disposition => 'inline', - :type => 'image/png', - :filename => "spark_#{params[:type]}.png" ) - end - - - # Use this type of method for sparklines that can be cached. (Doesn't work with the helper.) - # - # To make caching easier, add a line like this to config/routes.rb: - # map.sparklines "sparklines/:action/:id/image.png", :controller => "sparklines" - # - # Then reference it with the named route: - # image_tag sparklines_url(:action => 'show', :id => 42) - def show - send_data(Sparklines.plot( - [42, 37, 89, 74, 70, 50, 40, 30, 40, 50], - :type => 'bar', :above_color => 'orange' - ), - :disposition => 'inline', - :type => 'image/png', - :filename => "sparkline.png") - end - -end