| * use the default google options * default to nil title and alt tag instead of … | |
| Log | |
| Files | |
| Refs | |
| README | |
| --- | |
| commit cfb13be3fe3d6acdfb1d50ae49701bac363278fc | |
| parent 0bf0c988885cd667f6bc6c71b9ab2a5bc73d8967 | |
| Author: Marco Otte-Witte <[email protected]> | |
| Date: Wed, 21 Apr 2010 17:15:31 +0200 | |
| * use the default google options | |
| * default to nil title and alt tag instead of blank | |
| Diffstat: | |
| M lib/saulabs/reportable/report_tag_… | 4 ++-- | |
| M spec/other/report_tag_helper_spec.… | 10 +++++----- | |
| 2 files changed, 7 insertions(+), 7 deletions(-) | |
| --- | |
| diff --git a/lib/saulabs/reportable/report_tag_helper.rb b/lib/saulabs/reportab… | |
| @@ -36,7 +36,7 @@ module Saulabs | |
| # <%= report_tag(User.registrations_report, :width => 200, :height => … | |
| # | |
| def google_report_tag(data, options = {}) | |
| - options.reverse_merge!({ :width => 300, :height => 34, :line_color => … | |
| + options.reverse_merge!(Config.google_options) | |
| data = data.collect { |d| d[1] } | |
| labels = '' | |
| unless options[:labels].empty? | |
| @@ -47,7 +47,7 @@ module Saulabs | |
| labels = "&chxt=#{options[:labels].map(&:to_s).join(',')}&chxr=#{opt… | |
| end | |
| title = '' | |
| - unless options[:title].empty? | |
| + unless options[:title].blank? | |
| title = "&chtt=#{options[:title]}" | |
| end | |
| image_tag( | |
| diff --git a/spec/other/report_tag_helper_spec.rb b/spec/other/report_tag_helpe… | |
| @@ -35,7 +35,7 @@ describe Saulabs::Reportable::ReportTagHelper 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.… | |
| - { :title => '', :alt => '' } | |
| + { :title => nil, :alt => nil } | |
| ) | |
| @helper.google_report_tag([[DateTime.now, 1.0], [DateTime.now, 2.0], [Da… | |
| @@ -44,7 +44,7 @@ describe Saulabs::Reportable::ReportTagHelper do | |
| it 'should add parameters for labels to the source of the image if renderi… | |
| @helper.should_receive(:image_tag).once.with( | |
| 'http://chart.apis.google.com/chart?cht=ls&chs=300x34&chd=t:1.0,2.0,3.… | |
| - { :title => '', :alt => '' } | |
| + { :title => nil, :alt => nil } | |
| ) | |
| @helper.google_report_tag([[DateTime.now, 1.0], [DateTime.now, 2.0], [Da… | |
| @@ -53,7 +53,7 @@ describe Saulabs::Reportable::ReportTagHelper do | |
| it 'should set the parameters for custom colors if custom colors are speci… | |
| @helper.should_receive(:image_tag).once.with( | |
| 'http://chart.apis.google.com/chart?cht=ls&chs=300x34&chd=t:1.0,2.0,3.… | |
| - { :title => '', :alt => '' } | |
| + { :title => nil, :alt => nil } | |
| ) | |
| @helper.google_report_tag([[DateTime.now, 1.0], [DateTime.now, 2.0], [Da… | |
| @@ -62,7 +62,7 @@ describe Saulabs::Reportable::ReportTagHelper do | |
| it 'should set the parameters for a custom title if a title specified' 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.… | |
| - { :title => 'title', :alt => '' } | |
| + { :title => 'title', :alt => nil } | |
| ) | |
| @helper.google_report_tag([[DateTime.now, 1.0], [DateTime.now, 2.0], [Da… | |
| @@ -71,7 +71,7 @@ describe Saulabs::Reportable::ReportTagHelper do | |
| it 'should use a specified alt text as alt text for the image' 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.… | |
| - { :title => '', :alt => 'alt' } | |
| + { :title => nil, :alt => 'alt' } | |
| ) | |
| @helper.google_report_tag([[DateTime.now, 1.0], [DateTime.now, 2.0], [Da… |