spree_request_store 3.1.3 → 3.1.7
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cc4c7bf36266ccc225498522157020cb8efd999276f4f010990d5840ba9a490
|
4
|
+
data.tar.gz: e3abb7abfe635a2be455847451757e1fb7b3394f6dc77f4b1c06f5e10063cb18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b9cf0d574537879bdca7737f4a03b3dd8c6f70848ed7eadd08be3b293f1caa1ab7cb8370455c051305e8ddc36cb5c56ad9b4112a7fc188d66845a926604f042
|
7
|
+
data.tar.gz: ef13544a10358bbba68269f74fa3d1f9f8754c20f2965897803d6286cd20500538ed7821e7177f1cc3feeb9dafdf9de28b179ed4994d632fb54f135f61683157
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'request_store'
|
2
|
+
|
3
|
+
Spree::BaseController.class_eval do
|
4
|
+
prepend_before_action :set_current_info
|
5
|
+
|
6
|
+
def set_current_info
|
7
|
+
RequestStore.store[:current_user] = spree_current_user || current_spree_user
|
8
|
+
RequestStore.store[:current_currency] = current_currency
|
9
|
+
RequestStore.store[:current_store] = current_store
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'request_store'
|
2
|
+
|
3
|
+
Spree::Store.class_eval do
|
4
|
+
def self.current_user
|
5
|
+
RequestStore.store[:current_user]
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.current_currency
|
9
|
+
RequestStore.store[:current_currency] || Spree::Config[:currency]
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.current_store
|
13
|
+
RequestStore.store[:current_store] || Spree::Store.current
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.with_store(store)
|
17
|
+
RequestStore.store[:current_store] = store
|
18
|
+
yield
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.with_currency(currency)
|
22
|
+
RequestStore.store[:current_currency] = currency
|
23
|
+
yield
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.with_user(user)
|
27
|
+
RequestStore.store[:current_user] = user
|
28
|
+
yield
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_request_store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charles Wong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spree_core
|
@@ -311,6 +311,8 @@ extensions: []
|
|
311
311
|
extra_rdoc_files: []
|
312
312
|
files:
|
313
313
|
- README.md
|
314
|
+
- app/controllers/spree/base_controller_decorator.rb
|
315
|
+
- app/models/spree/store_decorator.rb
|
314
316
|
- lib/generators/spree_request_store/install/install_generator.rb
|
315
317
|
- lib/spree_request_store.rb
|
316
318
|
- lib/spree_request_store/engine.rb
|