Refinements & Preview Defaults (#167)

* No need for set width for base Card anymore

* entries are not required

* Redirect from Dashboard to first collection if publish mode is simple

* collection inference: Add more synonyms to description

* Implemented a better default preview for editing entries

* Add label field in default preview for small text values

* Added margin for default preview
This commit is contained in:
Cássio Souza
2016-11-23 16:23:32 -02:00
committed by GitHub
parent fed0066ca5
commit b1a5ea95d3
22 changed files with 191 additions and 70 deletions

View File

@ -2,6 +2,7 @@ import { OrderedMap, fromJS } from 'immutable';
import consoleError from '../lib/consoleError';
import { CONFIG_SUCCESS } from '../actions/config';
import { FILES, FOLDER } from '../constants/collectionTypes';
import { INFERABLE_FIELDS } from '../constants/fieldInference';
const hasProperty = (config, property) => ({}.hasOwnProperty.call(config, property));
@ -33,30 +34,6 @@ const formatToExtension = format => ({
html: 'html',
}[format]);
const inferables = {
title: {
type: 'string',
secondaryTypes: [],
synonyms: ['title', 'name', 'label', 'headline'],
fallbackToFirstField: true,
showError: true,
},
description: {
type: 'string',
secondaryTypes: ['text', 'markdown'],
synonyms: ['shortDescription', 'short_description', 'shortdescription', 'description', 'brief', 'body', 'content', 'biography', 'bio'],
fallbackToFirstField: false,
showError: false,
},
image: {
type: 'image',
secondaryTypes: [],
synonyms: ['image', 'thumbnail', 'thumb', 'picture', 'avatar'],
fallbackToFirstField: false,
showError: false,
},
};
const selectors = {
[FOLDER]: {
entryExtension(collection) {
@ -117,7 +94,7 @@ export const selectListMethod = collection => selectors[collection.get('type')].
export const selectAllowNewEntries = collection => selectors[collection.get('type')].allowNewEntries(collection);
export const selectTemplateName = (collection, slug) => selectors[collection.get('type')].templateName(collection, slug);
export const selectInferedField = (collection, fieldName) => {
const inferableField = inferables[fieldName];
const inferableField = INFERABLE_FIELDS[fieldName];
const fields = collection.get('fields');
let field;