lazy_high_charts 1.3.3.beta.2 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,11 +1,13 @@
1
1
  # VERSION 1.3.3
2
- * Dec 17, 2012
2
+ * Fri Jan 18, 2013
3
3
  1. rails 4 feature turbolinks supported.
4
4
  [#95](https://github.com/michelson/lazy_high_charts/isues/95)
5
5
  2. Can be used without rails, such as sinatra web framework.
6
6
  [#94](https://github.com/michelson/lazy_high_charts/isues/96)
7
7
  3. You shouldn't be forced to override the default chart text
8
8
  [#93](https://github.com/michelson/lazy_high_charts/issues/93)
9
+ 4. Add chart to window scope for dynamic series addition
10
+ [#99](https://github.com/michelson/lazy_high_charts/pull/99)
9
11
 
10
12
  # VERSION 1.3.2
11
13
  * Nov 22, 2012
data/GEM_VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.3.beta.2
1
+ 1.3.3
data/README.md CHANGED
@@ -8,13 +8,13 @@ Current
8
8
  [VERSION](https://github.com/xiaods/lazy_high_charts/blob/master/GEM_VERSION)
9
9
  [ChangeLog](https://github.com/xiaods/lazy_high_charts/blob/master/CHANGELOG.md)
10
10
 
11
- ### Installation instructions for Rails 3
11
+ ## Installation
12
12
 
13
13
  ### Installing it by rubygems
14
14
  To install it, you just need to add it to your Gemfile:
15
15
  gem 'lazy_high_charts'
16
16
 
17
- And then run this to install the javascript files:
17
+ You do not need to run this unless you are using the older rails versions 3.0 or 3.1:
18
18
  rails g lazy_high_charts:install
19
19
 
20
20
  ### Installing it as a plugin for rails 2.3.x
@@ -28,10 +28,9 @@ module LazyHighCharts
28
28
  options_collection << %|"series": [#{generate_json_from_array(object.data)}]|
29
29
 
30
30
  core_js =<<-EOJS
31
- var options, chart;
32
- options = { #{options_collection.join(',')} };
31
+ var options = { #{options_collection.join(',')} };
33
32
  #{capture(&block) if block_given?}
34
- chart = new Highcharts.#{type}(options);
33
+ window.chart_#{placeholder} = new Highcharts.#{type}(options);
35
34
  EOJS
36
35
 
37
36
  if defined?(request) && request.respond_to?(:xhr?) && request.xhr?
@@ -52,6 +51,16 @@ module LazyHighCharts
52
51
  })()
53
52
  </script>
54
53
  EOJS
54
+ elsif defined?(Turbolinks) && request.headers["X-XHR-Referer"]
55
+ graph =<<-EOJS
56
+ <script type="text/javascript">
57
+ (function() {
58
+ $(window).bind('page:load', function() {
59
+ #{core_js}
60
+ });
61
+ })()
62
+ </script>
63
+ EOJS
55
64
  else
56
65
  graph =<<-EOJS
57
66
  <script type="text/javascript">
@@ -40,10 +40,11 @@ describe HighChartsHelper do
40
40
  end
41
41
  describe "initialize HighChart" do
42
42
  it "should set variables `chart` `options`" do
43
- high_chart(@placeholder, @chart).should include('var options, chart;')
43
+ high_chart(@placeholder, @chart).should match(/var\s+options\s+=/)
44
+ high_chart(@placeholder, @chart).should match(/window.chart_placeholder\s=/)
44
45
  end
45
46
  it "should set Chart data" do
46
- high_chart(@placeholder, @chart).should match(/chart\s+=\s+new\s+Highcharts.Chart/)
47
+ high_chart(@placeholder, @chart).should match(/window\.chart_placeholder\s=\snew\sHighcharts.Chart/)
47
48
  end
48
49
 
49
50
  it "should set chart renderTo" do
@@ -51,7 +52,7 @@ describe HighChartsHelper do
51
52
  end
52
53
 
53
54
  it "should set Chart Stock" do
54
- high_stock(@placeholder, @chart).should match(/chart\s+=\s+new\s+Highcharts.StockChart/)
55
+ high_stock(@placeholder, @chart).should match(/window\.chart_placeholder\s+=\s+new\s+Highcharts.StockChart/)
55
56
  end
56
57
  end
57
58
 
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lazy_high_charts
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3.beta.2
5
- prerelease: 6
4
+ version: 1.3.3
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Miguel Michelson Martinez
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-12-17 00:00:00.000000000 Z
13
+ date: 2013-01-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler