sugar 0.0.37 → 0.0.38
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/sugar/actionview/stats.rb +13 -14
- data/sugar.gemspec +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.38
|
@@ -8,25 +8,21 @@ module Sugar
|
|
8
8
|
initializers = []
|
9
9
|
|
10
10
|
if piwik = options.delete(:piwik)
|
11
|
-
static_includes
|
12
|
-
initializers =
|
13
|
-
|
14
|
-
piwikTracker.trackPageView();
|
15
|
-
piwikTracker.enableLinkTracking();
|
16
|
-
}
|
17
|
-
noscript_includes << %[<img src="//#{piwik[:site]}/piwik.php?idsite=#{piwik[:id]}" alt="" style="border:0" />]
|
11
|
+
static_includes << "//#{piwik[:site]}/piwik.js"
|
12
|
+
initializers << "var piwikTracker=Piwik.getTracker('#{piwik[:site]}/piwik.php', #{piwik[:id]});piwikTracker.trackPageView();piwikTracker.enableLinkTracking();"
|
13
|
+
noscript_includes << "//#{piwik[:site]}/piwik.php?idsite=#{piwik[:id]}"
|
18
14
|
end
|
19
15
|
|
20
|
-
if options
|
21
|
-
static_includes
|
22
|
-
initializers
|
23
|
-
noscript_includes <<
|
16
|
+
if metrika = options.delete(:metrika)
|
17
|
+
static_includes << '//mc.yandex.ru/resource/watch.js'
|
18
|
+
initializers << "var yaCounter#{metrika} = new Ya.Metrika(#{metrika});"
|
19
|
+
noscript_includes << "//mc.yandex.ru/watch/#{metrika}"
|
24
20
|
end
|
25
21
|
|
26
|
-
if options
|
22
|
+
if analytics = options.delete(:analytics)
|
27
23
|
dynamic_includes << 'var gaJsHost=("https:"==document.location.protocol)?"https://ssl.":"http://www.";'
|
28
24
|
dynamic_includes << 'document.write(unescape("%3Cscript src=\'"+gaJsHost+"google-analytics.com/ga.js"\' type=\'text/javascript\'%3E%3C/script%3E));'
|
29
|
-
initializers
|
25
|
+
initializers << "var pageTracker = _gat._getTracker('#{analytics}'); pageTracker._trackPageview();"
|
30
26
|
end
|
31
27
|
|
32
28
|
returning('') do |result|
|
@@ -41,9 +37,12 @@ module Sugar
|
|
41
37
|
result << javascript_tag(initializers)
|
42
38
|
end
|
43
39
|
unless noscript_includes.empty?
|
40
|
+
includes = noscript_includes.collect do |noscript|
|
41
|
+
%(<img src="#{noscript}" style="border:0" alt="" />)
|
42
|
+
end.join("\n")
|
44
43
|
result << content_tag(:noscript,
|
45
44
|
content_tag(:div,
|
46
|
-
|
45
|
+
includes,
|
47
46
|
:style => 'position: absolute'))
|
48
47
|
end
|
49
48
|
end
|
data/sugar.gemspec
CHANGED