dato 0.6.15 → 0.6.16
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/lib/dato/local/item.rb +7 -3
- data/lib/dato/local/items_repo.rb +1 -1
- data/lib/dato/local/json_api_entity.rb +1 -1
- data/lib/dato/local/site.rb +2 -2
- data/lib/dato/utils/meta_tags/base.rb +2 -2
- data/lib/dato/utils/meta_tags/image.rb +1 -1
- data/lib/dato/utils/meta_tags/title.rb +1 -1
- data/lib/dato/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0313587907c1cc2e822ad7f92aac1284cbfdb9f451758bc3388c9b5a28d6306b'
|
4
|
+
data.tar.gz: e042db396497a20f4fe597665f8fd839c637b4a615d92b011ac06d33a07b5b94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e59fd529748e518483c0d7769059c1a7ec9df4e2991a9dcfa2d71aeb980340fcc724144106249668e92bfd311e18f16f97f118cc210f701d74a9fb46ed46a44b
|
7
|
+
data.tar.gz: 8b6c5ed1246ebf78c176dff63d64ca26a3e0d7f004ed73a1e8761beb4c9c503b9a7d6c31064bad3db9ada82e1cb50d206612879e249197c8d25709138fd3a3f3
|
data/lib/dato/local/item.rb
CHANGED
@@ -47,7 +47,7 @@ module Dato
|
|
47
47
|
fields.each_with_object(
|
48
48
|
ActiveSupport::HashWithIndifferentAccess.new
|
49
49
|
) do |field, acc|
|
50
|
-
acc[field.api_key.to_sym] =
|
50
|
+
acc[field.api_key.to_sym] = read_attribute(field.api_key, field)
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -77,6 +77,10 @@ module Dato
|
|
77
77
|
end
|
78
78
|
alias inspect to_s
|
79
79
|
|
80
|
+
def [](key)
|
81
|
+
attributes[key.to_sym]
|
82
|
+
end
|
83
|
+
|
80
84
|
def to_hash(max_depth = 3, current_depth = 0)
|
81
85
|
return id if current_depth >= max_depth
|
82
86
|
|
@@ -121,10 +125,10 @@ module Dato
|
|
121
125
|
type_klass = type_klass_name.safe_constantize
|
122
126
|
|
123
127
|
value = if field.localized
|
124
|
-
obj = entity
|
128
|
+
obj = entity[method] || {}
|
125
129
|
Utils::LocaleValue.find(obj)
|
126
130
|
else
|
127
|
-
entity
|
131
|
+
entity[method]
|
128
132
|
end
|
129
133
|
|
130
134
|
if type_klass
|
@@ -137,7 +137,7 @@ module Dato
|
|
137
137
|
@collections_by_type[method].sort_by!(&:position)
|
138
138
|
elsif item_type.ordering_field
|
139
139
|
@collections_by_type[method].sort_by! do |item|
|
140
|
-
item
|
140
|
+
item[item_type.ordering_field.api_key]
|
141
141
|
end
|
142
142
|
if item_type.ordering_direction == 'desc'
|
143
143
|
@collections_by_type[method].reverse!
|
data/lib/dato/local/site.rb
CHANGED
@@ -60,11 +60,11 @@ module Dato
|
|
60
60
|
|
61
61
|
def read_attribute(method, type_klass, localized)
|
62
62
|
value = if localized
|
63
|
-
obj = entity
|
63
|
+
obj = entity[method] || {}
|
64
64
|
|
65
65
|
Utils::LocaleValue.find(obj)
|
66
66
|
else
|
67
|
-
entity
|
67
|
+
entity[method]
|
68
68
|
end
|
69
69
|
|
70
70
|
type_klass.parse(value, @items_repo)
|
@@ -22,8 +22,8 @@ module Dato
|
|
22
22
|
item.fields.detect { |f| f.field_type == 'seo' }
|
23
23
|
|
24
24
|
item_seo_value = seo_field &&
|
25
|
-
item
|
26
|
-
item
|
25
|
+
item[seo_field.api_key] &&
|
26
|
+
item[seo_field.api_key].send(attribute)
|
27
27
|
|
28
28
|
fallback_seo_value = fallback_seo &&
|
29
29
|
fallback_seo.send(attribute)
|
data/lib/dato/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dato
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefano Verna
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|