-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for field grouping and annotations management (#1062)
Co-authored-by: Rebecca Koenig <[email protected]>
- Loading branch information
Showing
71 changed files
with
6,435 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module.exports = function (migration) { | ||
const page = migration.createContentType('page').name('Page') | ||
page.createField('name').name('Internal name').type('Symbol') | ||
page.createField('title').name('Page title').type('Symbol') | ||
|
||
// an editor layout can be created empty but not saved without adding at least one tab | ||
const editorLayout = page.createEditorLayout() | ||
|
||
editorLayout.createFieldGroup('content', { | ||
name: 'Content' | ||
}) | ||
|
||
editorLayout.changeFieldGroupControl('content', 'builtin', 'topLevelTab', { | ||
helpText: 'Main content' | ||
}) | ||
|
||
editorLayout.createFieldGroup('settings').name('Settings') | ||
|
||
editorLayout.editFieldGroup('settings').createFieldGroup('seo').name('SEO') | ||
|
||
editorLayout.changeFieldGroupControl('seo', 'builtin', 'fieldset', { | ||
helpText: 'Search related fields', | ||
collapsedByDefault: false | ||
}) | ||
|
||
editorLayout.createFieldGroup('metadata').name('Metadata') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = function (migration) { | ||
const page = migration.editContentType('page') | ||
const editorLayout = page.editEditorLayout() | ||
editorLayout.deleteFieldGroup('settings') | ||
|
||
const metadata = editorLayout.editFieldGroup('metadata') | ||
metadata.createFieldGroup('toBeDeleted', { | ||
name: 'To be deleted' | ||
}) | ||
editorLayout.deleteFieldGroup('toBeDeleted') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = function (migration) { | ||
const page = migration.editContentType('page') | ||
const editorLayout = page.editEditorLayout() | ||
|
||
editorLayout.createFieldGroup('toBeDeleted', { | ||
name: 'To be deleted' | ||
}) | ||
editorLayout.deleteFieldGroup('toBeDeleted') | ||
|
||
editorLayout.deleteFieldGroup('seo') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = function (migration) { | ||
const page = migration.editContentType('page') | ||
const editorLayout = page.editEditorLayout() | ||
editorLayout.changeFieldGroupId('metadata', 'info') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = function (migration) { | ||
const page = migration.editContentType('page') | ||
page.deleteEditorLayout() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module.exports = function (migration) { | ||
const myType = migration.createContentType('mytype').name('My type') | ||
myType.createField('fieldA').name('Field A').type('Symbol') | ||
myType.createField('fieldB').name('Field B').type('Symbol') | ||
myType.createField('fieldC').name('Field C').type('Symbol') | ||
myType.createField('fieldD').name('Field D').type('Symbol') | ||
myType.createField('fieldE').name('Field D').type('Symbol') | ||
|
||
// an editor layout can be created empty but not saved without adding at least one tab | ||
const editorLayout = myType.createEditorLayout() | ||
|
||
editorLayout.createFieldGroup('firsttab', { | ||
name: 'First Tab' | ||
}) | ||
editorLayout.createFieldGroup('secondtab', { | ||
name: 'Second Tab' | ||
}) | ||
|
||
editorLayout.editFieldGroup('secondtab').createFieldGroup('fieldset').name('Field Set') | ||
|
||
editorLayout.moveField('fieldA').toTheTopOfFieldGroup('fieldset') | ||
editorLayout.moveField('fieldB').beforeFieldGroup('fieldset') | ||
editorLayout.moveField('fieldC').afterField('fieldA') | ||
editorLayout.moveField('fieldE').beforeField('fieldC') | ||
editorLayout.moveField('fieldE').toTheBottomOfFieldGroup() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = function (migration) { | ||
const myType = migration.editContentType('mytype') | ||
const editorLayout = myType.editEditorLayout() | ||
|
||
editorLayout.moveField('fieldA').toTheTopOfFieldGroup('firsttab') | ||
editorLayout.moveField('fieldB').afterFieldGroup('fieldset') | ||
editorLayout.moveField('fieldC').afterField('fieldB') | ||
editorLayout.moveField('fieldE').beforeField('fieldC') | ||
editorLayout.moveField('fieldE').toTheBottomOfFieldGroup() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = function (migration) { | ||
const annotatedContentType = migration.createContentType('annotated').name('Blog Post') | ||
annotatedContentType.createField('name').name('Internal name').type('Symbol') | ||
annotatedContentType.createField('title').name('Title').type('Symbol') | ||
annotatedContentType.createField('body').name('Body').type('RichText') | ||
annotatedContentType.createField('sources').name('Sources').type('Link').linkType('Entry') | ||
|
||
annotatedContentType.setAnnotations(['Contentful:AggregateRoot']) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = function (migration) { | ||
const annotatedContentType = migration.editContentType('annotated') | ||
annotatedContentType.editField('sources').setAnnotations(['Contentful:AggregateComponent']) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = function (migration) { | ||
const annotatedContentType = migration.editContentType('annotated') | ||
annotatedContentType.editField('sources').clearAnnotations() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = function (migration) { | ||
const annotatedContentType = migration.editContentType('annotated') | ||
annotatedContentType.clearAnnotations() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.