mirror of
https://github.com/vale981/Vulcan
synced 2025-03-04 17:21:37 -05:00
Add explicit formProps prop to edit/new buttons
This commit is contained in:
parent
5790411861
commit
66fd1aedaf
2 changed files with 8 additions and 8 deletions
|
@ -2,7 +2,7 @@ import { Components, registerComponent } from 'meteor/vulcan:lib';
|
|||
import React from 'react';
|
||||
import { FormattedMessage, intlShape } from 'meteor/vulcan:i18n';
|
||||
|
||||
const EditButton = ({ style = 'primary', label, size, showId, modalProps, ...props }, { intl }) => (
|
||||
const EditButton = ({ style = 'primary', label, size, showId, modalProps, formProps, ...props }, { intl }) => (
|
||||
<Components.ModalTrigger
|
||||
label={label || intl.formatMessage({ id: 'datatable.edit' })}
|
||||
component={
|
||||
|
@ -12,7 +12,7 @@ const EditButton = ({ style = 'primary', label, size, showId, modalProps, ...pro
|
|||
}
|
||||
modalProps={modalProps}
|
||||
>
|
||||
<Components.EditForm {...props} />
|
||||
<Components.EditForm {...props} formProps={formProps}/>
|
||||
</Components.ModalTrigger>
|
||||
);
|
||||
|
||||
|
@ -29,7 +29,7 @@ registerComponent('EditButton', EditButton);
|
|||
EditForm Component
|
||||
|
||||
*/
|
||||
const EditForm = ({ closeModal, successCallback, removeSuccessCallback, ...props }) => {
|
||||
const EditForm = ({ closeModal, successCallback, removeSuccessCallback, formProps, ...props }) => {
|
||||
|
||||
const success = successCallback
|
||||
? document => {
|
||||
|
@ -46,7 +46,7 @@ const EditForm = ({ closeModal, successCallback, removeSuccessCallback, ...props
|
|||
: closeModal;
|
||||
|
||||
return (
|
||||
<Components.SmartForm successCallback={success} removeSuccessCallback={remove} {...props} />
|
||||
<Components.SmartForm successCallback={success} removeSuccessCallback={remove} {...formProps} {...props} />
|
||||
);
|
||||
};
|
||||
registerComponent('EditForm', EditForm);
|
||||
|
|
|
@ -2,7 +2,7 @@ import { Components, registerComponent } from 'meteor/vulcan:lib';
|
|||
import React from 'react';
|
||||
import { FormattedMessage, intlShape } from 'meteor/vulcan:i18n';
|
||||
|
||||
const NewButton = ({ collection, size, label, style = 'primary', ...props }, { intl }) => (
|
||||
const NewButton = ({ collection, size, label, style = 'primary', formProps, ...props }, { intl }) => (
|
||||
<Components.ModalTrigger
|
||||
label={label || intl.formatMessage({ id: 'datatable.new' })}
|
||||
component={
|
||||
|
@ -11,7 +11,7 @@ const NewButton = ({ collection, size, label, style = 'primary', ...props }, { i
|
|||
</Components.Button>
|
||||
}
|
||||
>
|
||||
<Components.NewForm collection={collection} {...props} />
|
||||
<Components.NewForm collection={collection} formProps={formProps} {...props} />
|
||||
</Components.ModalTrigger>
|
||||
);
|
||||
|
||||
|
@ -28,7 +28,7 @@ registerComponent('NewButton', NewButton);
|
|||
NewForm Component
|
||||
|
||||
*/
|
||||
const NewForm = ({ closeModal, successCallback, ...props }) => {
|
||||
const NewForm = ({ closeModal, successCallback, formProps, ...props }) => {
|
||||
|
||||
const success = successCallback
|
||||
? document => {
|
||||
|
@ -37,6 +37,6 @@ const NewForm = ({ closeModal, successCallback, ...props }) => {
|
|||
}
|
||||
: closeModal;
|
||||
|
||||
return <Components.SmartForm successCallback={success} {...props} />;
|
||||
return <Components.SmartForm successCallback={success} {...formProps} {...props} />;
|
||||
};
|
||||
registerComponent('NewForm', NewForm);
|
||||
|
|
Loading…
Add table
Reference in a new issue