spree_quick_cart 0.1.2 → 0.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e864553378eec6999b99c36d5d406d2408348504
4
- data.tar.gz: 7a50820164eb2dbc55f13e89b14e7202e2fae3d0
3
+ metadata.gz: 98bf99bf695e7d1432b8b6929aeb3c42be63b913
4
+ data.tar.gz: dd71bcc808b8a9436911fbb4bbe57bfd5802d78c
5
5
  SHA512:
6
- metadata.gz: 005285203b78f4a645c598f9e2ff5de71150bca93f9afe6ed03278780a3ae3f435100155c6faf53b7b431ab3b587fb60c68aa9a659daf01505b4f8ce9319243b
7
- data.tar.gz: 42f6ef571c2d056c93d844329702aba826542d5189b23d9357229445bcc670d1fc7bb153785ab93771b7445d0b45294616919328b25fde26fa177370270533b2
6
+ metadata.gz: 330c221ed93596bb8c8b51eda12dbbbadb468168978868fb0ce4969e6b6c3cae518e8bc825e094c1beaefa4bfdae6183b7925e93cad585ca328505104f4fa75a
7
+ data.tar.gz: 7387870a91bbbc6ae911d55db1d326d46869c849a958f7b3e5a3de1bd11a256f4fc13e5fc8b34d3376e582926ded49ba320e5e28c3fdad65b6ff0a9696e59f22
@@ -14,13 +14,22 @@ function SpreeQuickCart() {
14
14
  that.replaceCartInformation();
15
15
  },
16
16
  error: function(data, textStatus, jqXHR) {
17
- console.log('error adding to cart' + data)
17
+ that.showFlashMessage('There was a problem adding the item to the cart. Please reload the page and try again.', false);
18
18
  }
19
19
  });
20
20
  return false;
21
21
  });
22
22
  };
23
23
 
24
+ this.showFlashMessage = function(message, success) {
25
+ var messageClass;
26
+ if (success == true){ messageClass = 'success'} else { messageClass = 'error' };
27
+ $('#content').prepend("<div class='flash " + messageClass + "'>" + message + "</div>");
28
+ timeoutID = window.setTimeout(function(){
29
+ $('#content').find(".flash.success").remove();
30
+ }, 3000);
31
+ };
32
+
24
33
  this.replaceCartInformation = function() {
25
34
  Spree.ajax({
26
35
  url: that.current_order_path,
@@ -31,12 +40,13 @@ function SpreeQuickCart() {
31
40
  total = data.item_total;
32
41
  items_count = data.item_count;
33
42
  $('#link-to-cart .cart-info').html("Cart: (" + items_count + ") <span class='amount'>$" + total + "</span>")
43
+ that.showFlashMessage('Item added to the cart successfully.', true);
34
44
  },
35
45
  error: function(data, textStatus, jqXHR) {
36
- console.log('error getting order info' + data)
46
+ that.showFlashMessage('There was a problem adding the item to the cart. Please reload the page and try again.', false);
37
47
  }
38
48
  });
39
- }
49
+ };
40
50
 
41
51
  }
42
52
 
@@ -2,7 +2,7 @@
2
2
  Gem::Specification.new do |s|
3
3
  s.platform = Gem::Platform::RUBY
4
4
  s.name = 'spree_quick_cart'
5
- s.version = '0.1.2'
5
+ s.version = '0.2.0'
6
6
  s.summary = 'Insert add to cart button in product index page'
7
7
  s.description = 'Adds js quick add to cart button to product catalogue'
8
8
  s.required_ruby_version = '>= 2.0.0'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_quick_cart
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francisco Trindade