renamed AssetTagHelper to SparklineTagHelper - reportable - Fork of reportable required by WarVox, from hdm/reportable.
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
 (DIR) commit 811195e44a63b61df0a806e8f53c927a42ea6751
 (DIR) parent 683b03c8ae82c2ad348e5a6490aeafa5365c9cdb
 (HTM) Author: Marco Otte-Witte <marco.otte-witte@simplabs.com>
       Date:   Thu, 15 Jan 2009 15:34:59 +0100
       
       renamed AssetTagHelper to SparklineTagHelper
       
       Diffstat:
         M init.rb                             |       2 +-
         D lib/kvlr/reports_as_sparkline/asse… |      33 -------------------------------
         M lib/kvlr/reports_as_sparkline/repo… |       3 +--
         A lib/kvlr/reports_as_sparkline/spar… |      33 +++++++++++++++++++++++++++++++
         D spec/other/asset_tag_helper_spec.rb |      27 ---------------------------
         A spec/other/sparkline_tag_helper_sp… |      27 +++++++++++++++++++++++++++
       
       6 files changed, 62 insertions(+), 63 deletions(-)
       ---
 (DIR) diff --git a/init.rb b/init.rb
       @@ -5,5 +5,5 @@ ActiveRecord::Base.class_eval do
        end
        
        ActionView::Base.class_eval do
       -  include Kvlr::ReportsAsSparkline::AssetTagHelper
       +  include Kvlr::ReportsAsSparkline::SparklineTagHelper
        end
 (DIR) diff --git a/lib/kvlr/reports_as_sparkline/asset_tag_helper.rb b/lib/kvlr/reports_as_sparkline/asset_tag_helper.rb
       @@ -1,33 +0,0 @@
       -module Kvlr #:nodoc:
       -
       -  module ReportsAsSparkline #:nodoc:
       -
       -    module AssetTagHelper
       -
       -      # Renders a sparkline with the given data.
       -      #
       -      # ==== Parameters
       -      #
       -      # * <tt>data</tt> - The data to render the sparkline for
       -      #
       -      # ==== Options
       -      #
       -      # * <tt>width</tt> - The width of the generated image
       -      # * <tt>height</tt> - The height of the generated image
       -      # * <tt>color</tt> - The base color of the generated image (hex code)
       -      #
       -      # ==== Example
       -      # <%= sparkline_tag(User.registrations_report, :width => 200, :height => 100, :color => '000') %>
       -      def sparkline_tag(data, options = {})
       -        options.reverse_merge!({:width => 300, :height => 34, :color => '0077cc'})
       -        data.collect! { |d| d[1] }
       -        image_tag(
       -          "http://chart.apis.google.com/chart?cht=ls&chs=#{options[:width]}x#{options[:height]}&chd=t:#{data.join(',')}&chco=#{options[:color]}&chm=B,E6F2FA,0,0,0&chls=1,0,0&chds=#{data.min},#{data.max}"
       -        )
       -      end
       -
       -    end
       -
       -  end
       -
       -end
 (DIR) diff --git a/lib/kvlr/reports_as_sparkline/report.rb b/lib/kvlr/reports_as_sparkline/report.rb
       @@ -29,8 +29,7 @@ module Kvlr #:nodoc:
                @options = {
                  :limit      => options[:limit] || 100,
                  :conditions => options[:conditions] || [],
       -          :grouping   => Grouping.new(options[:grouping] || :day),
       -          :live_data  => options[:live_data] || false
       +          :grouping   => Grouping.new(options[:grouping] || :day)
                }
                @options.merge!(options)
                @options.freeze
 (DIR) diff --git a/lib/kvlr/reports_as_sparkline/sparkline_tag_helper.rb b/lib/kvlr/reports_as_sparkline/sparkline_tag_helper.rb
       @@ -0,0 +1,33 @@
       +module Kvlr #:nodoc:
       +
       +  module ReportsAsSparkline #:nodoc:
       +
       +    module SparklineTagHelper
       +
       +      # Renders a sparkline with the given data.
       +      #
       +      # ==== Parameters
       +      #
       +      # * <tt>data</tt> - The data to render the sparkline for
       +      #
       +      # ==== Options
       +      #
       +      # * <tt>width</tt> - The width of the generated image
       +      # * <tt>height</tt> - The height of the generated image
       +      # * <tt>color</tt> - The base color of the generated image (hex code)
       +      #
       +      # ==== Example
       +      # <%= sparkline_tag(User.registrations_report, :width => 200, :height => 100, :color => '000') %>
       +      def sparkline_tag(data, options = {})
       +        options.reverse_merge!({:width => 300, :height => 34, :color => '0077cc'})
       +        data.collect! { |d| d[1] }
       +        image_tag(
       +          "http://chart.apis.google.com/chart?cht=ls&chs=#{options[:width]}x#{options[:height]}&chd=t:#{data.join(',')}&chco=#{options[:color]}&chm=B,E6F2FA,0,0,0&chls=1,0,0&chds=#{data.min},#{data.max}"
       +        )
       +      end
       +
       +    end
       +
       +  end
       +
       +end
 (DIR) diff --git a/spec/other/asset_tag_helper_spec.rb b/spec/other/asset_tag_helper_spec.rb
       @@ -1,27 +0,0 @@
       -require File.join(File.dirname(__FILE__), '..', 'spec_helper')
       -
       -describe Kvlr::ReportsAsSparkline::AssetTagHelper do
       -
       -  before do
       -    @helper = TestHelper.new
       -  end
       -
       -  describe '#sparkline_tag' do
       -
       -    it 'should render an image with the correct source' do
       -      @helper.should_receive(:image_tag).once.with(
       -        'http://chart.apis.google.com/chart?cht=ls&chs=300x34&chd=t:1.0,2.0,3.0&chco=0077cc&chm=B,E6F2FA,0,0,0&chls=1,0,0&chds=1.0,3.0'
       -      )
       -
       -      @helper.sparkline_tag([[DateTime.now, 1.0], [DateTime.now, 2.0], [DateTime.now, 3.0]])
       -    end
       -
       -  end
       -
       -end
       -
       -class TestHelper
       -
       -  include Kvlr::ReportsAsSparkline::AssetTagHelper
       -
       -end
 (DIR) diff --git a/spec/other/sparkline_tag_helper_spec.rb b/spec/other/sparkline_tag_helper_spec.rb
       @@ -0,0 +1,27 @@
       +require File.join(File.dirname(__FILE__), '..', 'spec_helper')
       +
       +describe Kvlr::ReportsAsSparkline::SparklineTagHelper do
       +
       +  before do
       +    @helper = TestHelper.new
       +  end
       +
       +  describe '#sparkline_tag' do
       +
       +    it 'should render an image with the correct source' do
       +      @helper.should_receive(:image_tag).once.with(
       +        'http://chart.apis.google.com/chart?cht=ls&chs=300x34&chd=t:1.0,2.0,3.0&chco=0077cc&chm=B,E6F2FA,0,0,0&chls=1,0,0&chds=1.0,3.0'
       +      )
       +
       +      @helper.sparkline_tag([[DateTime.now, 1.0], [DateTime.now, 2.0], [DateTime.now, 3.0]])
       +    end
       +
       +  end
       +
       +end
       +
       +class TestHelper
       +
       +  include Kvlr::ReportsAsSparkline::SparklineTagHelper
       +
       +end