workarea-cart_sharing 1.0.1.pre → 1.0.2.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a4ba3d216ce9bf1d7af95162a75dcfd962c386a76b17a2078645cc6a52d63315
4
- data.tar.gz: cd0d2215153750fef71738302811f7d4251cb39dfc0e8c6a94aaa16a29389f20
3
+ metadata.gz: 3c1628fac480d3931ff6ff80c9f2755d5a2b672c07ba5dbdf2eecd3e89433ae7
4
+ data.tar.gz: 20711544742c0d14666115daf97ee62ed1b869dc55ad71aeefb9d2e20713b905
5
5
  SHA512:
6
- metadata.gz: 053bb7c79ec1a2065455337a43d13ca4566b9c05e1903fad9ac66aefd71dbafcf7b09576f71ea7f54e56fd930559fb5046061787ac5cdcc51ac01ed9adf5077c
7
- data.tar.gz: 611e36e00ba7a8d13e210c17aeb4eec6a7e6a73025ba4cbd50a34e599bbe2fe7ef188c867e133fb2b734b0f87e1cb315c09277a3acb5e63e53b654de4a387a9e
6
+ metadata.gz: 9e49648cd2a3da89cf5062a625f5cddaf7231a98da1403c30b0876b83ba7d3e8a0c822e5afdbdf4f24d9bf25675bb69a6cf61dd1c858044c09b028e675701a7d
7
+ data.tar.gz: 4786fa5ad6cafe397f05c9212e407bd8c887b4de5b4c9141092c1377f435ff008883d94ef2e3f430fa6ec6b714e98654ca331e128457a15c43e82cf2bc23b341
@@ -2,7 +2,8 @@ module Workarea
2
2
  decorate Storefront::CartsController, with: :cart_sharing do
3
3
  def from
4
4
  if order = Order.find_by(sharable_token: params[:token]) rescue nil
5
- self.current_order = order
5
+
6
+ add_sharable_items(order.items)
6
7
  flash[:success] = t('workarea.storefront.cart_sharing.success')
7
8
  else
8
9
  flash[:error] = t('workarea.storefront.cart_sharing.failure')
@@ -10,5 +11,13 @@ module Workarea
10
11
 
11
12
  redirect_to cart_path
12
13
  end
14
+
15
+ private
16
+ def add_sharable_items(items)
17
+ this_order = self.current_order
18
+ this_order.items = this_order.items + items
19
+ this_order.save
20
+ end
13
21
  end
22
+
14
23
  end
@@ -5,7 +5,7 @@ module Workarea::SharableToken
5
5
 
6
6
  included do
7
7
  field :sharable_token, type: String
8
- index({ sharable_token: 1 }, { unique: true })
8
+ index({ sharable_token: 1 })
9
9
  has_secure_token
10
10
  before_validation :ensure_token_exists
11
11
  end
@@ -6,4 +6,4 @@ en:
6
6
  title: Share Cart Items
7
7
  success: New items added to your cart
8
8
  failure: Sorry, unable to add items to your cart
9
- message: "Visit the link to add my cart item(s) into your Valken account."
9
+ message: "Visit the link to add my cart item(s) into your shopping cart."
@@ -1,5 +1,5 @@
1
1
  module Workarea
2
2
  module CartSharing
3
- VERSION = "1.0.1.pre".freeze
3
+ VERSION = "1.0.2.pre".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workarea-cart_sharing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1.pre
4
+ version: 1.0.2.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - gunasekaran.r
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-17 00:00:00.000000000 Z
11
+ date: 2020-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: workarea