Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

handling misconfigured spree sites

  • Loading branch information...
commit dda89bf1ede348df81a8bb3da5aed3039efb59a7 1 parent e00c671
@cmar cmar authored
View
49 app/views/admin/overview/index.html.erb
@@ -3,25 +3,30 @@
<script type="text/javascript" src="https://api.jirafe.com/dashboard/js/magento_ui.js"></script>
<% end %>
-<div id="jirafe"></div>
-<script type="text/javascript">
- <!--
- if (typeof jQuery != 'undefined') {
- (function($) {
- $('#jirafe').jirafe({
- api_url: '<%= SpreeAnalytics.api_url %>',
- api_token: '<%= SpreeAnalytics.token %>',
- app_id: '<%= SpreeAnalytics.app_id %>',
- version: 'magento-v0.3.0'
- });
- })(jQuery);
- }
- -->
- <!--
- setTimeout(function() {
- if ($('mod-jirafe') == undefined){
- $('messages').insert ("<ul class=\"messages\"><li class=\"error-msg\">We're unable to connect with the Jirafe service for the moment. Please wait a few minutes and refresh this page later.</li></ul>");
- }
- }, 2000);
- -->
-</script>
+<% if SpreeAnalytics.configured? %>
+ <div id="jirafe"></div>
+ <script type="text/javascript">
+ <!--
+ if (typeof jQuery != 'undefined') {
+ (function($) {
+ $('#jirafe').jirafe({
+ api_url: '<%= SpreeAnalytics.api_url %>',
+ api_token: '<%= SpreeAnalytics.token %>',
+ app_id: '<%= SpreeAnalytics.app_id %>',
+ version: 'magento-v0.3.0'
+ });
+ })(jQuery);
+ }
+ -->
+ <!--
+ setTimeout(function() {
+ if ($('mod-jirafe') == undefined){
+ $('messages').insert ("<ul class=\"messages\"><li class=\"error-msg\">We're unable to connect with the Jirafe service for the moment. Please wait a few minutes and refresh this page later.</li></ul>");
+ }
+ }, 2000);
+ -->
+ </script>
+<% else %>
+ <p>Spree Analytics has not been configured correctly. Make sure you add the initializer file</p>
+<% end %>
+
View
21 app/views/analytics/_header.html.erb
@@ -1,8 +1,13 @@
-<script type='text/javascript'>
-var jirafe = <%= raw analytics_tags.to_json %>;
-(function(){
-var d=document,g=d.createElement('script'),s=d.getElementsByTagName('script')[0];
-g.type='text/javascript',g.defer=g.async=true;g.src=d.location.protocol+'//c.jirafe.com/jirafe.js';
-s.parentNode.insertBefore(g, s);
-})();
-</script>
+<% if SpreeAnalytics.configured? %>
+ <script type='text/javascript'>
+ var jirafe= <%= raw analytics_tags.to_json %>;
+ (function(){
+ var d=document,g=d.createElement('script'),s=d.getElementsByTagName('script')[0];
+ g.type='text/javascript',g.defer=g.async=true;g.src=d.location.protocol+'//c.jirafe.com/jirafe.js';
+ s.parentNode.insertBefore(g, s);
+ })();
+ </script>
+<% else %>
+ <!-- Spree Analytics has not been initialized correctly -->
+<% end %>
+
Please sign in to comment.
Something went wrong with that request. Please try again.