Major update of Selectricity to work with Rails 2.2.2 from 1.2!
[selectricity] / app / helpers / sparklines_helper.rb
similarity index 55%
rename from vendor/plugins/sparklines/lib/sparklines_helper.rb
rename to app/helpers/sparklines_helper.rb
index c8958d3399504f525de4d389c132ba564ea6356e..9376e89b9e86fc60f5b5021897df8d8d8cb6d957 100644 (file)
@@ -1,18 +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.
-  #
-  #  sparkline_tag [42, 37, 43, 182], :type => 'bar', :line_color => 'black'
-  #
        # 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)
                
-               %(<img src="#{ url_for options }" class="#{options[:class] || 'sparkline'}" alt="Sparkline Graph" />)
+               "<img src=\"#{ url_for options }\" class=\"#{options[:class] || 'sparkline'}\" alt=\"Sparkline Graph\" />"
        end
 
 end

Benjamin Mako Hill || Want to submit a patch?