X-Git-Url: https://projects.mako.cc/source/selectricity/blobdiff_plain/05ebed925ae2b5e7bf2a599536ba7d7ac15ffbf7..ad088c1324d08a65f6f5336bedf7a88a8a8950e7:/app/helpers/sparklines_helper.rb diff --git a/app/helpers/sparklines_helper.rb b/app/helpers/sparklines_helper.rb new file mode 100644 index 0000000..9376e89 --- /dev/null +++ b/app/helpers/sparklines_helper.rb @@ -0,0 +1,30 @@ + +# Provides a tag for embedding sparklines graphs into your Rails app. +# +# To use, load it in your controller with +# +# helper :sparklines +# +# AUTHOR +# +# Geoffrey Grosenbach[mailto:boss@topfunky.com] +# +# http://topfunky.com +# +# License +# +# This code is licensed under the MIT license. +# +module SparklinesHelper + + # Call with an array of data and a hash of params for the Sparklines module. + # You can also pass :class => 'some_css_class' ('sparkline' by default). + def sparkline_tag(results=[], options={}) + url = { :controller => 'sparklines', + :results => results.join(',') } + options = url.merge(options) + + "\"Sparkline" + end + +end