wcc-contentful-app 0.4.0.pre.rc → 1.0.0.pre.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rspec +2 -2
- data/Guardfile +1 -1
- data/README.md +11 -0
- data/Rakefile +121 -0
- data/app/assets/config/manifest.js +5 -0
- data/app/assets/images/down-arrow-primary.svg +3 -0
- data/app/assets/images/up-arrow-primary.svg +3 -0
- data/app/assets/javascripts/wcc/contentful/app/contact-form.js +70 -0
- data/app/assets/javascripts/wcc/contentful/app/index.js +1 -0
- data/app/assets/stylesheets/_wcc-contentful-app.scss +7 -0
- data/app/assets/stylesheets/components/_menu-item.scss +5 -0
- data/app/assets/stylesheets/sections/_faq.scss +39 -0
- data/app/controllers/wcc/contentful/app/contact_form_controller.rb +39 -0
- data/app/controllers/wcc/contentful/app/pages_controller.rb +48 -0
- data/app/helpers/wcc/contentful/app/menu_helper.rb +85 -0
- data/app/helpers/wcc/contentful/app/section_helper.rb +135 -0
- data/app/mailers/wcc/contentful/app/contact_mailer.rb +11 -0
- data/app/models/concerns/wcc/contentful/app/preview_password.rb +19 -0
- data/app/models/wcc/contentful/app/contact_form_submission.rb +9 -0
- data/app/models/wcc/contentful/app/custom_markdown_render.rb +43 -0
- data/app/views/components/_faq_row.html.erb +21 -0
- data/app/views/components/_menu-item.html.erb +41 -0
- data/app/views/components/_other-menu-item.html.erb +4 -0
- data/app/views/components/_section.html.erb +11 -0
- data/app/views/layouts/mailer.html.erb +9 -0
- data/app/views/layouts/mailer.text.erb +1 -0
- data/app/views/pages/show.html.erb +4 -0
- data/app/views/sections/_block_text.html.erb +5 -0
- data/app/views/sections/_code_widget.html.erb +3 -0
- data/app/views/sections/_contact_form.html.erb +53 -0
- data/app/views/sections/_faq.html.erb +36 -0
- data/app/views/sections/_http_error.html.erb +13 -0
- data/app/views/sections/_marquee_text.html.erb +12 -0
- data/app/views/sections/_testimonials.html.erb +38 -0
- data/app/views/sections/_video.html.erb +12 -0
- data/app/views/sections/_video_highlight.html.erb +18 -0
- data/app/views/wcc/contentful/app/contact_mailer/contact_form_email.html.erb +7 -0
- data/bin/rails +14 -0
- data/config/routes.rb +7 -0
- data/lib/generators/wcc/model_generator.rb +16 -6
- data/lib/generators/wcc/templates/menu/migrations/generated_add_menus.ts +285 -0
- data/lib/generators/wcc/templates/menu/models/dropdown_menu.rb +19 -0
- data/lib/generators/wcc/templates/menu/models/menu.rb +0 -4
- data/lib/generators/wcc/templates/menu/models/menu_button.rb +0 -4
- data/lib/generators/wcc/templates/page/migrations/generated_add_pages.ts +147 -0
- data/lib/generators/wcc/templates/page/models/page.rb +0 -4
- data/lib/generators/wcc/templates/page/models/redirect.rb +19 -0
- data/lib/generators/wcc/templates/section-block-text/migrations/generated_add_section-block-texts.ts +40 -0
- data/lib/generators/wcc/templates/section-block-text/models/section_block_text.rb +19 -0
- data/lib/generators/wcc/templates/section-code-widget/migrations/generated_add_section-code-widget.ts +90 -0
- data/lib/generators/wcc/templates/section-code-widget/models/section_code_widget.rb +23 -0
- data/lib/generators/wcc/templates/section-contact-form/migrations/create_wcc_contentful_app_contact_form_submissions.rb +12 -0
- data/lib/generators/wcc/templates/section-contact-form/migrations/generated_add_section-contact-forms.ts +147 -0
- data/lib/generators/wcc/templates/section-contact-form/models/form_field.rb +19 -0
- data/lib/generators/wcc/templates/section-contact-form/models/section_contact_form.rb +19 -0
- data/lib/generators/wcc/templates/section-faq/migrations/generated_add_section-faqs.ts +148 -0
- data/lib/generators/wcc/templates/section-faq/models/section_faq.rb +19 -0
- data/lib/generators/wcc/templates/section-http-error/migrations/generated_add_section-http-errors.ts +87 -0
- data/lib/generators/wcc/templates/section-http-error/models/section_http_error.rb +19 -0
- data/lib/generators/wcc/templates/section-marquee-text/migrations/generated_add_section-marquee-texts.ts +64 -0
- data/lib/generators/wcc/templates/section-marquee-text/models/section_marquee_text.rb +19 -0
- data/lib/generators/wcc/templates/section-testimonial/migrations/generated_add_section-testimonials.ts +182 -0
- data/lib/generators/wcc/templates/section-testimonial/models/section_testimonial.rb +19 -0
- data/lib/generators/wcc/templates/section-video-highlight/migrations/generated_add_section-video-highlights.ts +80 -0
- data/lib/generators/wcc/templates/section-video-highlight/models/section_video_highlight.rb +19 -0
- data/lib/generators/wcc/templates/section-video/migrations/generated_add_section-videos.ts +77 -0
- data/lib/generators/wcc/templates/section-video/models/section_video.rb +19 -0
- data/lib/generators/wcc/templates/site-config/migrations/generated_add_site-configs.ts +97 -0
- data/lib/generators/wcc/templates/site-config/models/site_config.rb +19 -0
- data/lib/generators/wcc/templates/wcc_contentful.rb +1 -1
- data/lib/wcc/contentful/app.rb +46 -3
- data/lib/wcc/contentful/app/configuration.rb +60 -0
- data/lib/wcc/contentful/app/engine.rb +15 -0
- data/lib/wcc/contentful/app/exceptions.rb +9 -0
- data/lib/wcc/contentful/app/rails.rb +6 -0
- data/lib/wcc/contentful/app/version.rb +1 -1
- data/lib/wcc/contentful/model/dropdown_menu.rb +0 -3
- data/lib/wcc/contentful/model/form_field.rb +4 -0
- data/lib/wcc/contentful/model/menu.rb +0 -2
- data/lib/wcc/contentful/model/menu_button.rb +18 -5
- data/lib/wcc/contentful/model/page.rb +0 -4
- data/lib/wcc/contentful/model/redirect.rb +21 -11
- data/lib/wcc/contentful/model/section_contact_form.rb +42 -0
- data/lib/wcc/contentful/model/site_config.rb +7 -0
- data/wcc-contentful-app.gemspec +15 -15
- metadata +164 -103
- data/Gemfile +0 -8
- data/lib/generators/wcc/templates/menu/generated_add_menus.ts +0 -192
- data/lib/generators/wcc/templates/page/generated_add_pages.ts +0 -50
- data/lib/tasks/validate.rake +0 -20
- data/lib/wcc/contentful/app/model_validators.rb +0 -121
- data/lib/wcc/contentful/app/model_validators/dsl.rb +0 -166
- data/lib/wcc/contentful/ext/model.rb +0 -5
@@ -4,10 +4,6 @@
|
|
4
4
|
# entries of the 'menu' content type will be resolved as instances of this class.
|
5
5
|
# It exposes #find, #find_by, and #find_all methods to query Contentful.
|
6
6
|
class Menu < WCC::Contentful::Model::Menu
|
7
|
-
# Add custom validations to ensure that app-specific properties exist:
|
8
|
-
# validate_field :foo, :String, :required
|
9
|
-
# validate_field :bar_links, :Array, link_to: %w[bar baz]
|
10
|
-
|
11
7
|
# Override functionality or add utilities
|
12
8
|
#
|
13
9
|
# # Example: override equality
|
@@ -4,10 +4,6 @@
|
|
4
4
|
# entries of the 'menuButton' content type will be resolved as instances of this class.
|
5
5
|
# It exposes #find, #find_by, and #find_all methods to query Contentful.
|
6
6
|
class MenuButton < WCC::Contentful::Model::MenuButton
|
7
|
-
# Add custom validations to ensure that app-specific properties exist:
|
8
|
-
# validate_field :foo, :String, :required
|
9
|
-
# validate_field :bar_links, :Array, link_to: %w[bar baz]
|
10
|
-
|
11
7
|
# Override functionality or add utilities
|
12
8
|
#
|
13
9
|
# # Example: override equality
|
@@ -0,0 +1,147 @@
|
|
1
|
+
import Migration from '@watermarkchurch/contentful-migration'
|
2
|
+
|
3
|
+
export = function (migration: Migration) {
|
4
|
+
const page = migration.createContentType('page')
|
5
|
+
.name('Page')
|
6
|
+
.description('A page describes a collection of sections that correspond' +
|
7
|
+
'to a URL slug')
|
8
|
+
.displayField('internalTitle')
|
9
|
+
|
10
|
+
page.createField('internalTitle', {
|
11
|
+
name: 'Internal Title (Contentful Only)',
|
12
|
+
type: 'Symbol',
|
13
|
+
localized: false,
|
14
|
+
required: true,
|
15
|
+
validations: [],
|
16
|
+
disabled: false,
|
17
|
+
omitted: true,
|
18
|
+
})
|
19
|
+
|
20
|
+
page.createField('title')
|
21
|
+
.name('Title')
|
22
|
+
.type('Symbol')
|
23
|
+
.required(true)
|
24
|
+
|
25
|
+
page.createField('slug')
|
26
|
+
.name('Slug')
|
27
|
+
.type('Symbol')
|
28
|
+
.required(true)
|
29
|
+
.validations([
|
30
|
+
{
|
31
|
+
unique: true
|
32
|
+
},
|
33
|
+
{
|
34
|
+
regexp: { pattern: "(\\/|\\/([\w#!:.?+=&%@!\\-\\/]))?$" },
|
35
|
+
message: "The slug must look like the path part of a URL and begin with a forward slash, example: '/my-page-slug'"
|
36
|
+
}
|
37
|
+
])
|
38
|
+
|
39
|
+
page.createField('sections')
|
40
|
+
.name('Sections')
|
41
|
+
.type('Array')
|
42
|
+
.items({
|
43
|
+
type: 'Link',
|
44
|
+
linkType: 'Entry'
|
45
|
+
})
|
46
|
+
|
47
|
+
page.createField('subpages')
|
48
|
+
.name('Subpages')
|
49
|
+
.type('Array')
|
50
|
+
.items({
|
51
|
+
type: 'Link',
|
52
|
+
linkType: 'Entry',
|
53
|
+
validations: [
|
54
|
+
{
|
55
|
+
linkContentType: [ 'page' ]
|
56
|
+
}
|
57
|
+
]
|
58
|
+
})
|
59
|
+
|
60
|
+
/************ redirect ******************/
|
61
|
+
|
62
|
+
var redirect = migration.createContentType('redirect', {
|
63
|
+
displayField: 'internalTitle',
|
64
|
+
name: 'Redirect',
|
65
|
+
description: ''
|
66
|
+
})
|
67
|
+
|
68
|
+
redirect.createField('internalTitle', {
|
69
|
+
name: 'Internal Title (Contentful Only)',
|
70
|
+
type: 'Symbol',
|
71
|
+
localized: false,
|
72
|
+
required: true,
|
73
|
+
validations: [],
|
74
|
+
disabled: false,
|
75
|
+
omitted: true,
|
76
|
+
})
|
77
|
+
|
78
|
+
redirect.createField('slug', {
|
79
|
+
name: 'Slug',
|
80
|
+
type: 'Symbol',
|
81
|
+
localized: false,
|
82
|
+
required: true,
|
83
|
+
validations:
|
84
|
+
[{ unique: true },
|
85
|
+
{
|
86
|
+
regexp:
|
87
|
+
{
|
88
|
+
pattern: '\\/(?:[\\w#!:.?+=&%@!\\-]\\/?)*$',
|
89
|
+
flags: null
|
90
|
+
},
|
91
|
+
message: 'The slug must look like the path part of a URL and begin with a forward slash, example: \'/my-page-slug\''
|
92
|
+
}],
|
93
|
+
disabled: false,
|
94
|
+
omitted: false
|
95
|
+
})
|
96
|
+
|
97
|
+
redirect.createField('externalLink', {
|
98
|
+
name: 'External Link',
|
99
|
+
type: 'Symbol',
|
100
|
+
localized: false,
|
101
|
+
required: false,
|
102
|
+
validations:
|
103
|
+
[{
|
104
|
+
regexp:
|
105
|
+
{
|
106
|
+
pattern: '^([^\\s\\:]+):(\\/\\/)?(\\w+:{0,1}\\w*@)?(([^\\s\\/#]+\\.)+[^\\s\\/#]+)(:[0-9]+)?(\\/|(\\/|\\#)([\\w#!:.?+=&%@!\\-\\/]+))?$|^(\\/|(\\/|\\#)([\\w#!:.?+=&%@!\\-\\/]+))$',
|
107
|
+
flags: null
|
108
|
+
},
|
109
|
+
message: 'The external link must be a URL like \'https://www.watermark.org/\', a mailto url like \'mailto:info@watermark.org\', or a relative URL like \'#location-on-page\''
|
110
|
+
}],
|
111
|
+
disabled: false,
|
112
|
+
omitted: false
|
113
|
+
})
|
114
|
+
|
115
|
+
redirect.createField('pageLink', {
|
116
|
+
name: 'Page Link',
|
117
|
+
type: 'Link',
|
118
|
+
localized: false,
|
119
|
+
required: false,
|
120
|
+
validations: [{ linkContentType: ['page'] }],
|
121
|
+
disabled: false,
|
122
|
+
omitted: false,
|
123
|
+
linkType: 'Entry'
|
124
|
+
})
|
125
|
+
|
126
|
+
redirect.createField('sectionLink', {
|
127
|
+
name: 'Section Link',
|
128
|
+
type: 'Link',
|
129
|
+
localized: false,
|
130
|
+
required: false,
|
131
|
+
validations: [],
|
132
|
+
disabled: false,
|
133
|
+
omitted: false,
|
134
|
+
linkType: 'Entry'
|
135
|
+
})
|
136
|
+
|
137
|
+
redirect.changeEditorInterface('internalTitle', 'singleLine')
|
138
|
+
|
139
|
+
redirect.changeEditorInterface('slug', 'slugEditor')
|
140
|
+
|
141
|
+
redirect.changeEditorInterface('externalLink', 'urlEditor', { helpText: 'An external URL to send people to, that is not a page on this site. Use this OR Page Link, you can\'t use both.' })
|
142
|
+
|
143
|
+
redirect.changeEditorInterface('pageLink', 'entryCardEditor', { helpText: 'A page on this site to send people to. Use this OR External Link, you can\'t use both.' })
|
144
|
+
|
145
|
+
redirect.changeEditorInterface('sectionLink', 'entryLinkEditor', { helpText: '(Optional) If provided, this will link the user to the specific section on a page. If you use this, you must also use Page Link.' })
|
146
|
+
|
147
|
+
}
|
@@ -4,10 +4,6 @@
|
|
4
4
|
# entries of the 'page' content type will be resolved as instances of this class.
|
5
5
|
# It exposes #find, #find_by, and #find_all methods to query Contentful.
|
6
6
|
class Page < WCC::Contentful::Model::Page
|
7
|
-
# Add custom validations to ensure that app-specific properties exist:
|
8
|
-
# validate_field :foo, :String, :required
|
9
|
-
# validate_field :bar_links, :Array, link_to: %w[bar baz]
|
10
|
-
|
11
7
|
# Override functionality or add utilities
|
12
8
|
#
|
13
9
|
# # Example: override equality
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This model represents the 'redirect' content type in Contentful. Any linked
|
4
|
+
# entries of the 'redirect' content type will be resolved as instances of this class.
|
5
|
+
# It exposes .find, .find_by, and .find_all methods to query Contentful.
|
6
|
+
class Redirect < WCC::Contentful::Model::Redirect
|
7
|
+
# Override functionality or add utilities
|
8
|
+
#
|
9
|
+
# # Example: override equality
|
10
|
+
# def ===(other)
|
11
|
+
# ...
|
12
|
+
# end
|
13
|
+
#
|
14
|
+
# # Example: override "title" attribute to always be titlecase.
|
15
|
+
# # `@title` is populated by the gem in the initializer.
|
16
|
+
# def title
|
17
|
+
# @title_titlecased ||= @title.titlecase
|
18
|
+
# end
|
19
|
+
end
|
data/lib/generators/wcc/templates/section-block-text/migrations/generated_add_section-block-texts.ts
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
import Migration, { MigrationFunction } from '@watermarkchurch/contentful-migration'
|
2
|
+
|
3
|
+
// Generated by contentful-schema-diff
|
4
|
+
// from empty-export.json
|
5
|
+
// to 7yx6ovlj39n5
|
6
|
+
export = function(migration : Migration, { makeRequest, spaceId, accessToken }) {
|
7
|
+
|
8
|
+
/************ section-block-text ******************/
|
9
|
+
|
10
|
+
var sectionBlockText = migration.createContentType('section-block-text', {
|
11
|
+
displayField: 'internalTitle',
|
12
|
+
name: 'Section: Block Text',
|
13
|
+
description: 'Markdown free-text block'
|
14
|
+
})
|
15
|
+
|
16
|
+
sectionBlockText.createField('internalTitle', {
|
17
|
+
name: 'Internal Title (Contentful Only)',
|
18
|
+
type: 'Symbol',
|
19
|
+
localized: false,
|
20
|
+
required: true,
|
21
|
+
validations: [],
|
22
|
+
disabled: false,
|
23
|
+
omitted: true
|
24
|
+
})
|
25
|
+
|
26
|
+
sectionBlockText.createField('body', {
|
27
|
+
name: 'Body',
|
28
|
+
type: 'Text',
|
29
|
+
localized: false,
|
30
|
+
required: true,
|
31
|
+
validations: [],
|
32
|
+
disabled: false,
|
33
|
+
omitted: false
|
34
|
+
})
|
35
|
+
|
36
|
+
sectionBlockText.changeEditorInterface('internalTitle', 'singleLine')
|
37
|
+
|
38
|
+
sectionBlockText.changeEditorInterface('body', 'markdown')
|
39
|
+
|
40
|
+
} as MigrationFunction
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This model represents the 'section-block-text' content type in Contentful. Any linked
|
4
|
+
# entries of the 'section-block-text' content type will be resolved as instances of this class.
|
5
|
+
# It exposes .find, .find_by, and .find_all methods to query Contentful.
|
6
|
+
class SectionBlockText < WCC::Contentful::Model::SectionBlockText
|
7
|
+
# Override functionality or add utilities
|
8
|
+
#
|
9
|
+
# # Example: override equality
|
10
|
+
# def ===(other)
|
11
|
+
# ...
|
12
|
+
# end
|
13
|
+
#
|
14
|
+
# # Example: override "title" attribute to always be titlecase.
|
15
|
+
# # `@title` is populated by the gem in the initializer.
|
16
|
+
# def title
|
17
|
+
# @title_titlecased ||= @title.titlecase
|
18
|
+
# end
|
19
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
import Migration, { MigrationFunction } from '@watermarkchurch/contentful-migration'
|
2
|
+
|
3
|
+
export = function(migration: Migration, { makeRequest, spaceId, accessToken }) {
|
4
|
+
|
5
|
+
const sectionCodeWidget = migration.createContentType('section-code-widget', {
|
6
|
+
displayField:
|
7
|
+
'internalTitle',
|
8
|
+
name:
|
9
|
+
'Section: Code Widget',
|
10
|
+
description:
|
11
|
+
'Render code defined section views from JSON parameters.',
|
12
|
+
})
|
13
|
+
|
14
|
+
sectionCodeWidget.createField('internalTitle', {
|
15
|
+
name:
|
16
|
+
'Internal Title',
|
17
|
+
type:
|
18
|
+
'Symbol',
|
19
|
+
localized:
|
20
|
+
false,
|
21
|
+
required:
|
22
|
+
true,
|
23
|
+
validations:
|
24
|
+
[],
|
25
|
+
disabled:
|
26
|
+
false,
|
27
|
+
omitted:
|
28
|
+
true,
|
29
|
+
})
|
30
|
+
|
31
|
+
sectionCodeWidget.createField('view', {
|
32
|
+
name:
|
33
|
+
'View',
|
34
|
+
type:
|
35
|
+
'Symbol',
|
36
|
+
localized:
|
37
|
+
false,
|
38
|
+
required:
|
39
|
+
true,
|
40
|
+
validations:
|
41
|
+
[],
|
42
|
+
disabled:
|
43
|
+
false,
|
44
|
+
omitted:
|
45
|
+
false,
|
46
|
+
})
|
47
|
+
|
48
|
+
sectionCodeWidget.createField('parameters', {
|
49
|
+
name:
|
50
|
+
'Parameters',
|
51
|
+
type:
|
52
|
+
'Object',
|
53
|
+
localized:
|
54
|
+
false,
|
55
|
+
required:
|
56
|
+
false,
|
57
|
+
validations:
|
58
|
+
[],
|
59
|
+
disabled:
|
60
|
+
false,
|
61
|
+
omitted:
|
62
|
+
false,
|
63
|
+
})
|
64
|
+
|
65
|
+
sectionCodeWidget.createField('bookmarkTitle', {
|
66
|
+
name:
|
67
|
+
'Bookmark Title',
|
68
|
+
type:
|
69
|
+
'Symbol',
|
70
|
+
localized:
|
71
|
+
false,
|
72
|
+
required:
|
73
|
+
false,
|
74
|
+
validations:
|
75
|
+
[],
|
76
|
+
disabled:
|
77
|
+
false,
|
78
|
+
omitted:
|
79
|
+
false,
|
80
|
+
})
|
81
|
+
|
82
|
+
sectionCodeWidget.changeEditorInterface('internalTitle', 'singleLine')
|
83
|
+
|
84
|
+
sectionCodeWidget.changeEditorInterface('view', 'dropdown')
|
85
|
+
|
86
|
+
sectionCodeWidget.changeEditorInterface('parameters', 'objectEditor', { helpText: 'These parameters may or may not be required by the code widget. Inspect the ruby code to see what to put here.' })
|
87
|
+
|
88
|
+
sectionCodeWidget.changeEditorInterface('bookmarkTitle', 'singleLine')
|
89
|
+
|
90
|
+
} as MigrationFunction
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This model represents the 'section-code-widget' content type in Contentful. Any linked
|
4
|
+
# entries of the 'section-code-widget' content type will be resolved as instances of this class.
|
5
|
+
# It exposes .find, .find_by, and .find_all methods to query Contentful.
|
6
|
+
class SectionCodeWidget < WCC::Contentful::Model::SectionCodeWidget
|
7
|
+
# Add custom validations to ensure that app-specific properties exist:
|
8
|
+
# validate_field :foo, :String, :required
|
9
|
+
# validate_field :bar_links, :Array, link_to: %w[bar baz]
|
10
|
+
|
11
|
+
# Override functionality or add utilities
|
12
|
+
#
|
13
|
+
# # Example: override equality
|
14
|
+
# def ===(other)
|
15
|
+
# ...
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# # Example: override "title" attribute to always be titlecase.
|
19
|
+
# # `@title` is populated by the gem in the initializer.
|
20
|
+
# def title
|
21
|
+
# @title_titlecased ||= @title.titlecase
|
22
|
+
# end
|
23
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateWCCContentfulAppContactFormSubmissions < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
create_table :wcc_contentful_app_contact_form_submissions do |t|
|
6
|
+
t.string :form_id
|
7
|
+
t.json :data, default: {}
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,147 @@
|
|
1
|
+
import Migration, { MigrationFunction } from '@watermarkchurch/contentful-migration'
|
2
|
+
|
3
|
+
// Generated by contentful-schema-diff
|
4
|
+
// from contentful-export-4gyidsb2jx1u-rorJeremy-2018-10-18T15-41-43.json
|
5
|
+
// to 7yx6ovlj39n5/master
|
6
|
+
export = function (migration: Migration, { makeRequest, spaceId, accessToken }) {
|
7
|
+
|
8
|
+
/************ section-contact-form ******************/
|
9
|
+
|
10
|
+
var sectionContactForm = migration.createContentType('section-contact-form', {
|
11
|
+
displayField: 'internalTitle',
|
12
|
+
name: 'Section: Contact Form',
|
13
|
+
description:
|
14
|
+
'A Contact Form section contains a Form with several Form Fields. The responses to the form will be collected and provided to the appropriate administrator.'
|
15
|
+
})
|
16
|
+
|
17
|
+
sectionContactForm.createField('internalTitle', {
|
18
|
+
name: 'Internal Title (Contentful Only)',
|
19
|
+
type: 'Symbol',
|
20
|
+
localized: false,
|
21
|
+
required: true,
|
22
|
+
validations: [],
|
23
|
+
disabled: false,
|
24
|
+
omitted: false
|
25
|
+
})
|
26
|
+
|
27
|
+
sectionContactForm.createField('text', {
|
28
|
+
name: 'Text',
|
29
|
+
type: 'Text',
|
30
|
+
localized: false,
|
31
|
+
required: true,
|
32
|
+
validations: [],
|
33
|
+
disabled: false,
|
34
|
+
omitted: false
|
35
|
+
})
|
36
|
+
|
37
|
+
sectionContactForm.createField('fields', {
|
38
|
+
name: 'Fields',
|
39
|
+
type: 'Array',
|
40
|
+
localized: false,
|
41
|
+
required: true,
|
42
|
+
validations: [],
|
43
|
+
disabled: false,
|
44
|
+
omitted: false,
|
45
|
+
items: {
|
46
|
+
type: 'Link',
|
47
|
+
validations: [
|
48
|
+
{
|
49
|
+
linkContentType: ['formField']
|
50
|
+
}
|
51
|
+
],
|
52
|
+
linkType: 'Entry'
|
53
|
+
}
|
54
|
+
})
|
55
|
+
|
56
|
+
sectionContactForm.createField('submitButtonText', {
|
57
|
+
name: 'Submit Button Text',
|
58
|
+
type: 'Symbol',
|
59
|
+
localized: false,
|
60
|
+
required: false,
|
61
|
+
validations: [],
|
62
|
+
disabled: false,
|
63
|
+
omitted: false
|
64
|
+
})
|
65
|
+
|
66
|
+
sectionContactForm.createField('notificationEmail', {
|
67
|
+
name: 'NotificationEmail',
|
68
|
+
type: 'Symbol',
|
69
|
+
localized: false,
|
70
|
+
required: true,
|
71
|
+
validations: [
|
72
|
+
{
|
73
|
+
regexp: {
|
74
|
+
pattern:
|
75
|
+
'^([a-zA-Z0-9_\\-\\.]+)@([a-zA-Z0-9_\\-\\.]+)\\.([a-zA-Z]{2,5})$',
|
76
|
+
flags: null
|
77
|
+
},
|
78
|
+
message: 'Must be a valid email address.'
|
79
|
+
}
|
80
|
+
],
|
81
|
+
disabled: false,
|
82
|
+
omitted: false
|
83
|
+
})
|
84
|
+
|
85
|
+
sectionContactForm.changeEditorInterface('internalTitle', 'singleLine')
|
86
|
+
|
87
|
+
sectionContactForm.changeEditorInterface('text', 'markdown')
|
88
|
+
|
89
|
+
sectionContactForm.changeEditorInterface('fields', 'entryLinksEditor')
|
90
|
+
|
91
|
+
sectionContactForm.changeEditorInterface('submitButtonText', 'singleLine')
|
92
|
+
|
93
|
+
sectionContactForm.changeEditorInterface('notificationEmail', 'singleLine', {
|
94
|
+
helpText:
|
95
|
+
'This is the email address where the form submission notification goes.'
|
96
|
+
})
|
97
|
+
|
98
|
+
/************ formField ******************/
|
99
|
+
|
100
|
+
var formfield = migration.createContentType('formField', {
|
101
|
+
displayField: 'internalTitle',
|
102
|
+
name: 'Form Field',
|
103
|
+
description: 'A Form Field represents a piece of information you want to collect from a user via a Form.'
|
104
|
+
})
|
105
|
+
|
106
|
+
formfield.createField('internalTitle', {
|
107
|
+
name: 'Internal Title (Contentful Only)',
|
108
|
+
type: 'Symbol',
|
109
|
+
localized: false,
|
110
|
+
required: true,
|
111
|
+
validations: [],
|
112
|
+
disabled: false,
|
113
|
+
omitted: true
|
114
|
+
})
|
115
|
+
|
116
|
+
formfield.createField('title', {
|
117
|
+
name: 'Title',
|
118
|
+
type: 'Symbol',
|
119
|
+
localized: false,
|
120
|
+
required: false,
|
121
|
+
validations: [],
|
122
|
+
disabled: false,
|
123
|
+
omitted: false
|
124
|
+
})
|
125
|
+
|
126
|
+
formfield.createField('inputType', {
|
127
|
+
name: 'Input Type',
|
128
|
+
type: 'Symbol',
|
129
|
+
localized: false,
|
130
|
+
required: true,
|
131
|
+
validations:
|
132
|
+
[{
|
133
|
+
in:
|
134
|
+
['text',
|
135
|
+
'email',
|
136
|
+
'textarea']
|
137
|
+
}],
|
138
|
+
disabled: false,
|
139
|
+
omitted: false
|
140
|
+
})
|
141
|
+
|
142
|
+
formfield.changeEditorInterface('title', 'singleLine')
|
143
|
+
|
144
|
+
formfield.changeEditorInterface('inputType', 'radio')
|
145
|
+
|
146
|
+
formfield.changeEditorInterface('internalTitle', 'singleLine')
|
147
|
+
} as MigrationFunction
|