contentful_bootstrap 1.5.1 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile +2 -0
- data/lib/contentful/bootstrap/templates/base.rb +15 -4
- data/lib/contentful/bootstrap/templates/json_template.rb +6 -2
- data/lib/contentful/bootstrap/templates/links/asset.rb +3 -2
- data/lib/contentful/bootstrap/templates/links/base.rb +17 -1
- data/lib/contentful/bootstrap/templates/links/entry.rb +3 -2
- data/lib/contentful/bootstrap/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 350dcf7465b5d8ccd0efcdbb8351e6504bf653c0
|
4
|
+
data.tar.gz: 1c554d4d7ec3606eb026d671660dae89aad58b28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 623d664fcd58c48df3b1067c18ae757d5e831c827f24acc4f01c59a5b7926af1f5681b4b85f9d764c66700043862af4d940620a4c52520f398c189a0e39d3358
|
7
|
+
data.tar.gz: 4fba258364e79b46261f7ef7e5584c6b64090678c5725e9ad0720b5d671cb96704abbfed658d2db94c27ea3a223708248893eb0357c9f960cf89cd0690247fd8
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "contentful/management"
|
2
|
+
require "contentful/bootstrap/templates/links/base"
|
2
3
|
|
3
4
|
module Contentful
|
4
5
|
module Bootstrap
|
@@ -94,8 +95,11 @@ module Contentful
|
|
94
95
|
end
|
95
96
|
|
96
97
|
def create_entries
|
98
|
+
content_types = []
|
97
99
|
entries.each do |content_type_id, entry_list|
|
98
100
|
content_type = space.content_types.find(content_type_id)
|
101
|
+
content_types << content_type
|
102
|
+
|
99
103
|
entry_list.each_with_index do |e, index|
|
100
104
|
puts "Creating Entry #{index} for #{content_type_id.capitalize}"
|
101
105
|
|
@@ -111,8 +115,12 @@ module Contentful
|
|
111
115
|
end
|
112
116
|
|
113
117
|
array_fields.each do |af|
|
114
|
-
e[af].map! do |
|
115
|
-
|
118
|
+
e[af].map! do |item|
|
119
|
+
if item.is_a? Links::Base
|
120
|
+
item.to_management_object
|
121
|
+
else
|
122
|
+
item
|
123
|
+
end
|
116
124
|
end
|
117
125
|
e[af.to_sym] = e.delete(af)
|
118
126
|
end
|
@@ -121,11 +129,14 @@ module Contentful
|
|
121
129
|
e[rf.to_sym] = e.delete(rf)
|
122
130
|
end
|
123
131
|
|
124
|
-
entry = content_type.entries.create(e)
|
132
|
+
entry = content_type.entries.create(e.clone)
|
125
133
|
entry.save
|
126
|
-
entry.publish
|
127
134
|
end
|
128
135
|
end
|
136
|
+
|
137
|
+
content_types.each do |content_type|
|
138
|
+
content_type.entries.all.map(&:publish)
|
139
|
+
end
|
129
140
|
end
|
130
141
|
end
|
131
142
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require "contentful/management"
|
1
2
|
require "contentful/bootstrap/templates/links/base"
|
2
3
|
|
3
4
|
module Contentful
|
@@ -5,8 +6,8 @@ module Contentful
|
|
5
6
|
module Templates
|
6
7
|
module Links
|
7
8
|
class Asset < Base
|
8
|
-
def
|
9
|
-
|
9
|
+
def management_class
|
10
|
+
Contentful::Management::Asset
|
10
11
|
end
|
11
12
|
end
|
12
13
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "contentful/management"
|
2
|
+
|
1
3
|
module Contentful
|
2
4
|
module Bootstrap
|
3
5
|
module Templates
|
@@ -8,7 +10,21 @@ module Contentful
|
|
8
10
|
@id = id
|
9
11
|
end
|
10
12
|
|
11
|
-
def
|
13
|
+
def link_type
|
14
|
+
self.class.name.split("::").last
|
15
|
+
end
|
16
|
+
|
17
|
+
def type
|
18
|
+
Contentful::Management::ContentType::LINK
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_management_object
|
22
|
+
object = management_class.new
|
23
|
+
object.id = id
|
24
|
+
object
|
25
|
+
end
|
26
|
+
|
27
|
+
def management_class
|
12
28
|
raise "must implement"
|
13
29
|
end
|
14
30
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require "contentful/management"
|
1
2
|
require "contentful/bootstrap/templates/links/base"
|
2
3
|
|
3
4
|
module Contentful
|
@@ -5,8 +6,8 @@ module Contentful
|
|
5
6
|
module Templates
|
6
7
|
module Links
|
7
8
|
class Entry < Base
|
8
|
-
def
|
9
|
-
|
9
|
+
def management_class
|
10
|
+
Contentful::Management::Entry
|
10
11
|
end
|
11
12
|
end
|
12
13
|
end
|