Fix singular file skip screen and add back link modification
This commit is contained in:
parent
279e7e154d
commit
6823744acf
@ -106,6 +106,38 @@ collections: # A list of collections the CMS should be able to edit
|
||||
- { label: 'Name', name: 'name', widget: 'string', hint: 'First and Last' }
|
||||
- { label: 'Description', name: 'description', widget: 'markdown' }
|
||||
|
||||
- name: 'settings-singular'
|
||||
label: 'Settings Singular'
|
||||
icon: 'settings'
|
||||
delete: false # Prevent users from deleting documents in this collection
|
||||
editor:
|
||||
preview: false
|
||||
files:
|
||||
- name: 'general'
|
||||
label: 'Site Settings'
|
||||
file: '_data/settings.json'
|
||||
description: 'General Site Settings'
|
||||
fields:
|
||||
- { label: 'Global title', name: 'site_title', widget: 'string' }
|
||||
- label: 'Post Settings'
|
||||
name: posts
|
||||
widget: 'object'
|
||||
fields:
|
||||
- {
|
||||
label: 'Number of posts on frontpage',
|
||||
name: front_limit,
|
||||
widget: number,
|
||||
min: 1,
|
||||
max: 10,
|
||||
}
|
||||
- { label: 'Default Author', name: author, widget: string }
|
||||
- {
|
||||
label: 'Default Thumbnail',
|
||||
name: thumb,
|
||||
widget: image,
|
||||
class: 'thumb',
|
||||
required: false,
|
||||
}
|
||||
- name: 'kitchenSink' # all the things in one entry, for documentation and quick testing
|
||||
label: 'Kitchen Sink'
|
||||
folder: '_sink'
|
||||
|
@ -74,13 +74,16 @@ function getDefaultPath(collections) {
|
||||
|
||||
/**
|
||||
* Returns default collection name if only one collection
|
||||
*
|
||||
*
|
||||
* @param {Collection} collection
|
||||
* @returns {string}
|
||||
*/
|
||||
function getDefaultCollectionPath(collection) {
|
||||
if (collection.has('files') && collection.get('files').size === 1) {
|
||||
return `/collections/${collection.get('name')}/entries/${collection.get('files').first().get('name')}`;
|
||||
return `/collections/${collection.get('name')}/entries/${collection
|
||||
.get('files')
|
||||
.first()
|
||||
.get('name')}`;
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -97,7 +100,7 @@ function RouteInCollectionDefault({ collections, render, ...props }) {
|
||||
return <Redirect to={defaultPath} />;
|
||||
}
|
||||
|
||||
const defaultCollectionPath = getDefaultCollectionPath(collections);
|
||||
const defaultCollectionPath = getDefaultCollectionPath(collectionExists);
|
||||
if (defaultCollectionPath !== null) {
|
||||
return <Redirect to={defaultCollectionPath} />;
|
||||
}
|
||||
|
@ -447,6 +447,10 @@ function mapStateToProps(state, ownProps) {
|
||||
editorBackLink = `/workflow`;
|
||||
}
|
||||
|
||||
if (collection.has('files') && collection.get('files').size === 1) {
|
||||
editorBackLink = '/';
|
||||
}
|
||||
|
||||
if (collection.has('nested') && slug) {
|
||||
const pathParts = slug.split('/');
|
||||
if (pathParts.length > 2) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user