sugar 0.0.35 → 0.0.36
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/VERSION +1 -1
- data/lib/sugar/actionview/stats.rb +12 -13
- data/sugar.gemspec +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.36
|
@@ -7,14 +7,14 @@ module Sugar
|
|
7
7
|
noscript_includes = []
|
8
8
|
initializers = []
|
9
9
|
|
10
|
-
if options
|
11
|
-
static_includes << "//#{
|
12
|
-
initializers
|
13
|
-
var piwikTracker = Piwik.getTracker("#{
|
10
|
+
if piwik = options.delete(:piwik)
|
11
|
+
static_includes << "//#{piwik[:site]}/piwik.js"
|
12
|
+
initializers = %{
|
13
|
+
var piwikTracker = Piwik.getTracker("#{piwik[:site]}/piwik.php", #{piwik[:id]});
|
14
14
|
piwikTracker.trackPageView();
|
15
15
|
piwikTracker.enableLinkTracking();
|
16
|
-
|
17
|
-
noscript_includes << %
|
16
|
+
}
|
17
|
+
noscript_includes << %[<img src="//#{piwik[:site]}/piwik.php?idsite=#{piwik[:id]}" alt="" style="border:0" />]
|
18
18
|
end
|
19
19
|
|
20
20
|
if options[:metrika]
|
@@ -29,17 +29,17 @@ module Sugar
|
|
29
29
|
initializers << "var pageTracker = _gat._getTracker('#{options}'); pageTracker._trackPageview();"
|
30
30
|
end
|
31
31
|
|
32
|
-
returning
|
32
|
+
returning('') do |result|
|
33
33
|
unless dynamic_includes.empty?
|
34
34
|
result << javascript_tag(dynamic_includes)
|
35
35
|
end
|
36
36
|
result << javascript_include_tag(static_includes) unless static_includes.empty?
|
37
37
|
unless initializers.empty?
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
initializers = initializers.inject('') do |pack, initializer|
|
39
|
+
pack << "try {#{initializer}} catch(e) {}"
|
40
|
+
pack
|
41
|
+
end.join("\n")
|
42
|
+
result << javascript_tag(initializers)
|
43
43
|
end
|
44
44
|
unless noscript_includes.empty?
|
45
45
|
result << content_tag(:noscript,
|
@@ -49,7 +49,6 @@ module Sugar
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
52
|
-
|
53
52
|
end
|
54
53
|
end
|
55
54
|
end
|
data/sugar.gemspec
CHANGED