Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for single-document collections #762

Merged
merged 6 commits into from
Aug 8, 2019

Conversation

ohmoses
Copy link
Contributor

@ohmoses ohmoses commented Aug 4, 2019

Closes #584

If settings.publish.isSingleDocument is set to true in the collection schema, Publish will show the document editor (instead of the document list) on route /collectionName (or /groupName/collectionName). If there are multiple documents in the collection, Publish will operate on the first one.

I made a small change to enable connectRedux to accept a mapState function, so that in ReferenceSelectView, DocumentListView, and DocumentEditView, I could move the logic for creating contentKeys, documentId, etc., to mapState and pass them to the components.

@ohmoses
Copy link
Contributor Author

ohmoses commented Aug 5, 2019

A point for discussion: I removed the "Delete" button, because it didn't make much sense here, but maybe there should be something like "clear all fields" button?

@ohmoses ohmoses requested a review from eduardoboucas August 5, 2019 18:01
return collection.slug === params.collection
})

const isNewDocument = /\/new(\/|$)/.test(path) && !params.documentId
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ohmoses is there ever a case where checking for params.documentId is not enough to determine whether we're creating a new document?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Single document collections
3 participants