feat(core): allow custom summary on entry cards (#2140)

This commit is contained in:
Austin Devine
2019-03-29 18:30:38 +00:00
committed by Shawn Erquhart
parent 228271194b
commit 573ad8816d
7 changed files with 146 additions and 83 deletions

View File

@ -115,7 +115,7 @@ export const selectTemplateName = (collection, slug) =>
export const selectIdentifier = collection => {
const identifier = collection.get('identifier_field');
const identifierFields = identifier ? [identifier, ...IDENTIFIER_FIELDS] : IDENTIFIER_FIELDS;
const fieldNames = collection.get('fields').map(field => field.get('name'));
const fieldNames = collection.get('fields', []).map(field => field.get('name'));
return identifierFields.find(id =>
fieldNames.find(name => name.toLowerCase().trim() === id.toLowerCase().trim()),
);
@ -128,7 +128,7 @@ export const selectInferedField = (collection, fieldName) => {
const fields = collection.get('fields');
let field;
// If colllection has no fields or fieldName is not defined within inferables list, return null
// If collection has no fields or fieldName is not defined within inferables list, return null
if (!fields || !inferableField) return null;
// Try to return a field of the specified type with one of the synonyms
const mainTypeFields = fields