From e560a908c3eb1a05dee5e23b87070b4f7a805630 Mon Sep 17 00:00:00 2001 From: Jure Triglav <juretriglav@gmail.com> Date: Sun, 7 Jan 2018 18:09:18 +0100 Subject: [PATCH] FormGroup is self sufficient when it comes to validations. --- packages/components/packages/FormGroup/FormGroup.jsx | 6 ++++-- packages/components/packages/PostsManager/PostCreator.jsx | 6 ------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/components/packages/FormGroup/FormGroup.jsx b/packages/components/packages/FormGroup/FormGroup.jsx index 20c43e202..e0aff75f0 100644 --- a/packages/components/packages/FormGroup/FormGroup.jsx +++ b/packages/components/packages/FormGroup/FormGroup.jsx @@ -7,10 +7,12 @@ import { HelpBlock, } from 'react-bootstrap' import Joi from 'joi-browser' -import serverValidations from 'pubsweet-server/src/models/validations' + +import mergeValidations from 'pubsweet-server/src/models/validations' import config from 'config' -const validations = serverValidations(config) +const appValidationsPath = config.validations +const validations = mergeValidations(require(appValidationsPath)) class FormGroup extends React.Component { constructor(props) { diff --git a/packages/components/packages/PostsManager/PostCreator.jsx b/packages/components/packages/PostsManager/PostCreator.jsx index 604d2ee69..85ae46699 100644 --- a/packages/components/packages/PostsManager/PostCreator.jsx +++ b/packages/components/packages/PostsManager/PostCreator.jsx @@ -2,11 +2,6 @@ import React from 'react' import PropTypes from 'prop-types' import { Button } from 'react-bootstrap' import FormGroup from 'pubsweet-component-form-group/FormGroup' -import mergeValidations from 'pubsweet-server/src/models/validations' -import config from 'config' - -const appValidationsPath = config.validations -const validations = mergeValidations(require(appValidationsPath)) export default class PostCreator extends React.Component { constructor(props) { @@ -39,7 +34,6 @@ export default class PostCreator extends React.Component { label="Title" modelProperty="fragment.title" placeholder="One fine day..." - validations={validations} /> <Button aria-label="Create" -- GitLab