jekyll-spree-client 0.1.9 → 0.1.10
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 +4 -4
- data/README.md +12 -0
- data/lib/jekyll-spree-client.rb +14 -11
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 716e8e0f2ab2c09b987a10a760ed2e4bf36ebb142ff09b1331a03caaa824c57a
|
4
|
+
data.tar.gz: 7f5048e01435bde67988e5d4690e3026aed28ffbe75684cfd3b4526febe0d1af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2824a7951b2c4e9affb55ba9bee0bc249f4e728db341b2704181a16130ec49274d248110a2c8d072921018ab2f807fc870978fd874891bced7925971560f92aa
|
7
|
+
data.tar.gz: 61cdaaca089e6fdbeeae9dc3be9d904730e0ba322fd653b36fa9b4d979cccda4c0aa618a7e21e46c7b62157c781e6d37f8035bb05f4f35cbb8a5f39d3ed8b370
|
data/README.md
CHANGED
@@ -82,6 +82,18 @@ depth: 100
|
|
82
82
|
The layout doesn't matter, but we recommend to use a layout for
|
83
83
|
products.
|
84
84
|
|
85
|
+
### Layouts
|
86
|
+
|
87
|
+
You'll need four layouts and at least a corresponding post, one for each
|
88
|
+
step of the buying process.
|
89
|
+
|
90
|
+
* `cart` the cart, shows the order details
|
91
|
+
* `shipment` shipping and billing addresses, shipping rates apply here
|
92
|
+
* `payment` select payment methods
|
93
|
+
* `confirmation` order confirmation page
|
94
|
+
|
95
|
+
They'll be available on Liquid under the `site.STEP` keys.
|
96
|
+
|
85
97
|
### Hooks
|
86
98
|
|
87
99
|
If you need to do some data manipulation before and after
|
data/lib/jekyll-spree-client.rb
CHANGED
@@ -6,7 +6,20 @@ require_relative 'jekyll/spree_client'
|
|
6
6
|
# matter. The SKU needs to be unique, but this plugin doesn't ensure
|
7
7
|
# that. Duplicated SKUs will be silently ignored for now.
|
8
8
|
Jekyll::Hooks.register :site, :post_read do |site|
|
9
|
-
|
9
|
+
# Ordered articles
|
10
|
+
posts = site.site_payload['site']['posts']
|
11
|
+
|
12
|
+
# Make steps available to other articles
|
13
|
+
%w[cart shipment payment confirmation].each do |step|
|
14
|
+
site.config[step] = posts.find do |doc|
|
15
|
+
doc.data['layout'] == step
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
unless ENV['SPREE_API_KEY']
|
20
|
+
Jekyll.logger.warn "SPREE_API_KEY environment variable missing, skipping syncrhonization"
|
21
|
+
next
|
22
|
+
end
|
10
23
|
|
11
24
|
config = site.config['spree']&.transform_keys(&:to_sym) || {}
|
12
25
|
config.merge!(site: site, api_key: ENV['SPREE_API_KEY'], spree_url: ENV['SPREE_URL'])
|
@@ -18,14 +31,4 @@ Jekyll::Hooks.register :site, :post_read do |site|
|
|
18
31
|
if ENV['JEKYLL_ENV'] == 'production' && site.respond_to?(:repository)
|
19
32
|
site.repository.commit site.data.dig(site.config['locale'], 'spree', 'commit') || 'Spree synchronization'
|
20
33
|
end
|
21
|
-
|
22
|
-
# Ordered articles
|
23
|
-
posts = site.site_payload['site']['posts']
|
24
|
-
|
25
|
-
# Make steps available to other articles
|
26
|
-
%w[cart shipment payment confirmation].each do |step|
|
27
|
-
site.config[step] = posts.find do |doc|
|
28
|
-
doc.data['layout'] == step
|
29
|
-
end
|
30
|
-
end
|
31
34
|
end
|