rgviz-rails 0.32 → 0.34
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rgviz_rails/view_helper.rb +7 -1
- metadata +4 -4
@@ -31,6 +31,10 @@ module Rgviz
|
|
31
31
|
hidden = options[:hidden]
|
32
32
|
extensions = options[:extensions]
|
33
33
|
|
34
|
+
rgviz_events, google_events = events.partition{|x| x.to_s.start_with? 'rgviz'}
|
35
|
+
rgviz_events = rgviz_events.inject(Hash.new){|h, y| h[y[0]] = y[1]; h}
|
36
|
+
rgviz_events = rgviz_events.with_indifferent_access
|
37
|
+
|
34
38
|
html_prefix = (options[:html_prefix] || 'html').to_s
|
35
39
|
js_prefix = (options[:js_prefix] || 'js').to_s
|
36
40
|
param_prefix = (options[:param_prefix] || 'param').to_s
|
@@ -166,17 +170,19 @@ module Rgviz
|
|
166
170
|
|
167
171
|
# And define the callback
|
168
172
|
out << "function #{callback}(#{params.join(', ')}) {\n"
|
173
|
+
out << "#{rgviz_events[:rgviz_start]}('#{id}');\n" if rgviz_events[:rgviz_start]
|
169
174
|
out << "var query = new google.visualization.Query('#{url}');\n"
|
170
175
|
out << "#{query_builder}\n"
|
171
176
|
out << "alert(#{query_builder_var});\n" if debug
|
172
177
|
out << "query.setQuery(#{query_builder_var});\n"
|
173
178
|
out << "query.send(function(response) {\n"
|
174
179
|
out << "rgviz_#{id} = new google.visualization.#{kind}(document.getElementById('#{id}'));\n"
|
175
|
-
|
180
|
+
google_events.each do |name, handler|
|
176
181
|
out << "google.visualization.events.addListener(rgviz_#{id}, '#{name}', #{handler});\n"
|
177
182
|
end
|
178
183
|
out << "rgviz_#{id}_data = response.getDataTable();\n"
|
179
184
|
out << "rgviz_#{id}.draw(rgviz_#{id}_data, #{opts});\n"
|
185
|
+
out << "#{rgviz_events[:rgviz_end]}('#{id}');\n" if rgviz_events[:rgviz_end]
|
180
186
|
out << "});\n"
|
181
187
|
out << "}\n"
|
182
188
|
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rgviz-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 79
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 34
|
9
|
+
version: "0.34"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Ary Borenszweig
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-08-
|
17
|
+
date: 2010-08-23 00:00:00 +07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|