caboose-cms 0.5.128 → 0.5.129

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTYzZmIxYmYwNDlhNGJjYjA4MWIzZTRlN2IwNzdkMGE3OTY0ZWE0OQ==
4
+ YWFmMTA2YWM3Yzc0Nzc2MDBkOTQzMzVkMGQ4MjcwOGY3Y2QzMzM5Nw==
5
5
  data.tar.gz: !binary |-
6
- ZGU4MDhkMTZjMTE0ZGUxZWU2NzhiNWI4MzVlMjhkZjNlNjZjNzg2Zg==
6
+ ODY1M2FjNWY0ZDhjOWQzODEyZThlNjk4NjE2OGNmOTM1Mjk3NTQzMw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OGYxZDhmM2Y4NTk4ZDFmOTJiNDU5NDAxN2EyNTQ0ODk3ZjZiMWQ4OTllMDhl
10
- OTA3M2ViNzgzMGZlMmE3YTE2YWYyYmZmOWM2ZTUxODE3OWM3NmJmMDlhZWU2
11
- ZTczMDNlM2JjNmQzZjliNjFiMDk5N2M4YjU1ZDEzMjVmZmFkYTE=
9
+ NDBjNDU3Y2VmN2M3YzJhZTU2NjlkMzZkMDQ2OWZkYjQ5ZGJhYzEzNGI0ZWUy
10
+ YmU2NDBlNTAxNzFkMDFlZGUzY2U4N2Q2NjFlZWNmOWI1ODNhOWJhM2IwZGM3
11
+ OWJhYjdjNjk2ZGZkOTU4NGY5M2E1ZjZlNzJmYzY2ZGU2NTQyZjU=
12
12
  data.tar.gz: !binary |-
13
- OTNjOGRlZWQ2NGVmMjQ5NjljMDFlNDliNzIwZjhlY2QzYTNjMDEzYjM0YmY0
14
- YTFkMjkxZDg5Y2MzMjhlYzhiYmYyN2Q0ZGMxZjBjNTc5ZDUwNDA4NTk2OWRm
15
- Y2Y0Y2IzNWExMTgwZmFhNzE1NjE0MjI4OGM4ZDdhZjI1ODRhM2M=
13
+ MzgzYTFkNzBmYjI5NDE0NmFhZjBhNjBmMzM1NmViYWJlZTRkMzYyMmU3ZTY1
14
+ MWI3ODc5ZDlhMTU3ZDRlM2Y3MDZjZTk5MzJhYTA5NmQ4YTg5ODcwNzY5NGQw
15
+ NGEzNzgyNmZmMzRjMzM5MDBlYjg2OTAzN2EyMWZlOTQ5YzAzYTQ=
@@ -17,6 +17,8 @@ Caboose.Store.Modules.Product = (function() {
17
17
  self.initialize = function() {
18
18
  self.$product = $('#product');
19
19
  self.$price = self.$product.find('#product-price');
20
+ $("<span id='percent-off'></span").insertAfter(self.$price);
21
+ $("<span id='sale-price'></span").insertBefore(self.$price);
20
22
  if (!self.$product.length) return false;
21
23
 
22
24
  $.get('/products/' + self.$product.data('id') + '/info', function(response) {
@@ -264,7 +266,35 @@ Caboose.Store.Modules.Product = (function() {
264
266
  Caboose.Store.Modules.Cart.set_variant(variant);
265
267
  if (variant) self.set_image_from_variant(variant);
266
268
  if (variant && self.$price.length) self.$price.empty().text('$' + parseFloat((variant.price * 100) / 100).toFixed(2));
269
+ if (self.variant_on_sale(variant)) {
270
+ self.$price.addClass("on-sale");
271
+ var percent = 100 - ((variant.sale_price / variant.price) * 100).toFixed(0);
272
+ $("#percent-off").text("SALE! Save " + percent + "%");
273
+ $("#sale-price").text('$' + parseFloat((variant.sale_price * 100) / 100).toFixed(2));
274
+ }
275
+ else {
276
+ self.$price.removeClass("on-sale");
277
+ $("#percent-off").text('');
278
+ $("#sale-price").text('');
279
+ }
267
280
  };
281
+
282
+ self.variant_on_sale = function(variant) {
283
+ var is_on_sale = false;
284
+ if (variant.sale_price != "" && variant.sale_price != 0) {
285
+ var d = new Date();
286
+ if (variant.date_sale_starts && d < variant.date_sale_starts) {
287
+ is_on_sale = false;
288
+ }
289
+ else if (variant.date_sale_ends && d > variant.date_sale_ends) {
290
+ is_on_sale = false;
291
+ }
292
+ else {
293
+ is_on_sale = true;
294
+ }
295
+ }
296
+ return is_on_sale;
297
+ }
268
298
 
269
299
  self.get_variant = function(id) {
270
300
  return _.find(self.product.variants, function(variant) { return variant.id == (id || self.variant.id) });
@@ -119,4 +119,3 @@ module Caboose
119
119
  end
120
120
  end
121
121
  end
122
-
@@ -78,7 +78,7 @@ module Caboose
78
78
  end
79
79
 
80
80
  respond_to do |format|
81
- format.all { render :file => "caboose/extras/error404", :layout => "caboose/error404", :formats => [:html] }
81
+ format.all { render :file => "caboose/extras/error404", :layout => "caboose/application", :formats => [:html] }
82
82
  end
83
83
  return
84
84
  end
@@ -86,7 +86,7 @@ module Caboose
86
86
  asset = Asset.where(:page_id => page.id, :filename => File.basename(uri)).first
87
87
  if (asset.nil?)
88
88
  respond_to do |format|
89
- format.all { render :file => "caboose/extras/error404", :layout => "caboose/error404", :formats => [:html] }
89
+ format.all { render :file => "caboose/extras/error404", :layout => "caboose/application", :formats => [:html] }
90
90
  end
91
91
  return
92
92
  end
@@ -1,6 +1,10 @@
1
1
  module Caboose
2
2
  class SocialController < ApplicationController
3
3
  layout 'caboose/admin'
4
+
5
+ def analytics
6
+
7
+ end
4
8
 
5
9
  # GET /admin/social
6
10
  def admin_edit
@@ -30,6 +34,7 @@ module Caboose
30
34
  when 'rss_url' then sc.rss_url = value
31
35
  when 'google_plus_url' then sc.google_plus_url = value
32
36
  when 'linkedin_url' then sc.linkedin_url = value
37
+ when 'google_analytics_id' then sc.google_analytics_id = value
33
38
  end
34
39
  end
35
40
 
@@ -582,7 +582,8 @@ class Caboose::Schema < Caboose::Utilities::Schema
582
582
  [ :vimeo_url , :string ],
583
583
  [ :rss_url , :string ],
584
584
  [ :google_plus_url , :string ],
585
- [ :linkedin_url , :string ]
585
+ [ :linkedin_url , :string ],
586
+ [ :google_analytics_id , :string ]
586
587
  ],
587
588
  Caboose::StackableGroup => [
588
589
  [ :name , :string ],
@@ -12,6 +12,7 @@ class Caboose::SocialConfig < ActiveRecord::Base
12
12
  :vimeo_url ,
13
13
  :rss_url ,
14
14
  :google_plus_url ,
15
- :linkedin_url
15
+ :linkedin_url ,
16
+ :google_analytics_id
16
17
 
17
18
  end
@@ -1 +1,5 @@
1
- <h1>Page Not Found</h1>
1
+ <div style="padding:60px 2%;text-align:center;background:#fff;">
2
+ <img src="http://cabooseit.s3.amazonaws.com/uploads/error_404.png" width="150" />
3
+ <h1 style="font-size:3em;font-weight:bold;margin-bottom:20px;margin-top:40px;color:#4b4b4b;">Oops!</h1>
4
+ <p style="color:#4b4b4b;font-size:18px;">The page you are looking for could not be found.</p>
5
+ </div>
@@ -13,6 +13,7 @@ sc = @social_config
13
13
  <p><div id="socialconfig_<%= sc.id %>_rss_url" ></div></p>
14
14
  <p><div id="socialconfig_<%= sc.id %>_google_plus_url" ></div></p>
15
15
  <p><div id="socialconfig_<%= sc.id %>_linkedin_url" ></div></p>
16
+ <p><div id="socialconfig_<%= sc.id %>_google_analytics_id" ></div></p>
16
17
 
17
18
  <div id='message'></div>
18
19
 
@@ -28,15 +29,16 @@ $(document).ready(function() {
28
29
  update_url: '/admin/social',
29
30
  authenticity_token: '<%= form_authenticity_token %>',
30
31
  attributes: [
31
- { name: 'facebook_page_id' , nice_name: 'Facebook Page ID' , type: 'text', value: <%= raw Caboose.json(sc.facebook_page_id) %>, width: 400 },
32
- { name: 'twitter_username' , nice_name: 'Twitter Username' , type: 'text', value: <%= raw Caboose.json(sc.twitter_username) %>, width: 400 },
33
- { name: 'instagram_username' , nice_name: 'Instagram Username' , type: 'text', value: <%= raw Caboose.json(sc.instagram_username) %>, width: 400 },
34
- { name: 'youtube_url' , nice_name: 'YouTube URL' , type: 'text', value: <%= raw Caboose.json(sc.youtube_url) %>, width: 400 },
35
- { name: 'pinterest_url' , nice_name: 'Pinterest URL' , type: 'text', value: <%= raw Caboose.json(sc.pinterest_url) %>, width: 400 },
36
- { name: 'vimeo_url' , nice_name: 'Vimeo URL' , type: 'text', value: <%= raw Caboose.json(sc.vimeo_url) %>, width: 400 },
37
- { name: 'rss_url' , nice_name: 'RSS Feed URL' , type: 'text', value: <%= raw Caboose.json(sc.rss_url) %>, width: 400 },
38
- { name: 'google_plus_url' , nice_name: 'Google Plus URL' , type: 'text', value: <%= raw Caboose.json(sc.google_plus_url) %>, width: 400 },
39
- { name: 'linkedin_url' , nice_name: 'LinkedIn URL' , type: 'text', value: <%= raw Caboose.json(sc.linkedin_url) %>, width: 400 }
32
+ { name: 'facebook_page_id' , nice_name: 'Facebook Page ID' , type: 'text', value: <%= raw Caboose.json(sc.facebook_page_id) %>, width: 500 },
33
+ { name: 'twitter_username' , nice_name: 'Twitter Username' , type: 'text', value: <%= raw Caboose.json(sc.twitter_username) %>, width: 500 },
34
+ { name: 'instagram_username' , nice_name: 'Instagram Username' , type: 'text', value: <%= raw Caboose.json(sc.instagram_username) %>, width: 500 },
35
+ { name: 'youtube_url' , nice_name: 'YouTube URL' , type: 'text', value: <%= raw Caboose.json(sc.youtube_url) %>, width: 500 },
36
+ { name: 'pinterest_url' , nice_name: 'Pinterest URL' , type: 'text', value: <%= raw Caboose.json(sc.pinterest_url) %>, width: 500 },
37
+ { name: 'vimeo_url' , nice_name: 'Vimeo URL' , type: 'text', value: <%= raw Caboose.json(sc.vimeo_url) %>, width: 500 },
38
+ { name: 'rss_url' , nice_name: 'RSS Feed URL' , type: 'text', value: <%= raw Caboose.json(sc.rss_url) %>, width: 500 },
39
+ { name: 'google_plus_url' , nice_name: 'Google Plus URL' , type: 'text', value: <%= raw Caboose.json(sc.google_plus_url) %>, width: 500 },
40
+ { name: 'linkedin_url' , nice_name: 'LinkedIn URL' , type: 'text', value: <%= raw Caboose.json(sc.linkedin_url) %>, width: 500 },
41
+ { name: 'google_analytics_id' , nice_name: 'Google Analytics Tracking ID' , type: 'text', value: <%= raw Caboose.json(sc.google_analytics_id) %>, width: 500 }
40
42
  ]
41
43
  });
42
44
 
@@ -0,0 +1,109 @@
1
+ <!-- Step 1: Create the containing elements. -->
2
+
3
+ <div class="constrain" style="text-align:center;">
4
+ <div id="embed-api-auth-container"></div>
5
+ <div id="chart-container"></div>
6
+ <div id="view-selector-container"></div>
7
+ </div>
8
+ <!-- Step 2: Load the library. -->
9
+
10
+ <script>
11
+ (function(w,d,s,g,js,fs){
12
+ g=w.gapi||(w.gapi={});g.analytics={q:[],ready:function(f){this.q.push(f);}};
13
+ js=d.createElement(s);fs=d.getElementsByTagName(s)[0];
14
+ js.src='https://apis.google.com/js/platform.js';
15
+ fs.parentNode.insertBefore(js,fs);js.onload=function(){g.load('analytics');};
16
+ }(window,document,'script'));
17
+ </script>
18
+
19
+
20
+
21
+ <script>
22
+
23
+ gapi.analytics.ready(function() {
24
+
25
+ /**
26
+ * Authorize the user immediately if the user has already granted access.
27
+ * If no access has been created, render an authorize button inside the
28
+ * element with the ID "embed-api-auth-container".
29
+ */
30
+ gapi.analytics.auth.authorize({
31
+ container: 'embed-api-auth-container',
32
+ clientid: '1002749199705-234hgt2c2spgkt47h8ufu4ave9neifbk.apps.googleusercontent.com',
33
+ });
34
+
35
+
36
+ /**
37
+ * Create a new ViewSelector instance to be rendered inside of an
38
+ * element with the id "view-selector-container".
39
+ */
40
+ var viewSelector = new gapi.analytics.ViewSelector({
41
+ container: 'view-selector-container'
42
+ });
43
+
44
+ // Render the view selector to the page.
45
+ viewSelector.execute();
46
+
47
+
48
+ /**
49
+ * Create a new DataChart instance with the given query parameters
50
+ * and Google chart options. It will be rendered inside an element
51
+ * with the id "chart-container".
52
+ */
53
+ var dataChart = new gapi.analytics.googleCharts.DataChart({
54
+ query: {
55
+ metrics: 'ga:sessions',
56
+ dimensions: 'ga:date',
57
+ 'start-date': '30daysAgo',
58
+ 'end-date': 'yesterday'
59
+ },
60
+ chart: {
61
+ container: 'chart-container',
62
+ type: 'LINE',
63
+ options: {
64
+ width: '100%'
65
+ }
66
+ }
67
+ });
68
+
69
+
70
+ /**
71
+ * Render the dataChart on the page whenever a new view is selected.
72
+ */
73
+ viewSelector.on('change', function(ids) {
74
+ dataChart.set({query: {ids: ids}}).execute();
75
+ });
76
+
77
+ });
78
+ </script>
79
+
80
+ <style>
81
+ #content {
82
+ padding: 10px 2%;
83
+ }
84
+ .constrain {
85
+ max-width: 1000px;
86
+ padding: 30px 2%;
87
+ margin: 0 auto;
88
+ }
89
+ #embed-api-auth-container {
90
+ margin-bottom: 40px;
91
+ }
92
+ #chart-container {
93
+ width: 80%;
94
+ margin: 0 auto;
95
+ }
96
+ #view-selector-container {
97
+ width: 80%;
98
+ margin: 0 auto;
99
+ }
100
+ #view-selector-container table {
101
+ float: left;
102
+ display: block;
103
+ width: 30% !important;
104
+ margin: 0 auto;
105
+ }
106
+ #timeline > div {
107
+ margin: 0 auto;
108
+ }
109
+ </style>
@@ -87,6 +87,7 @@ Caboose::Engine.routes.draw do
87
87
 
88
88
  get "admin/social" => "social#admin_edit"
89
89
  put "admin/social" => "social#admin_update"
90
+ get "admin/analytics" => "social#analytics"
90
91
 
91
92
 
92
93
  #=============================================================================
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.5.128'
2
+ VERSION = '0.5.129'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.128
4
+ version: 0.5.129
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
@@ -843,6 +843,7 @@ files:
843
843
  - app/views/caboose/sites/admin_new.html.erb
844
844
  - app/views/caboose/smtp/admin_edit.html.erb
845
845
  - app/views/caboose/social/admin_edit.html.erb
846
+ - app/views/caboose/social/analytics.html.erb
846
847
  - app/views/caboose/stackable_groups/admin_index.html.erb
847
848
  - app/views/caboose/station/index.html.erb
848
849
  - app/views/caboose/store/admin_edit.html.erb