From 13f95b1bc3bb35c8e7c12b98494e00c7d5ee1dc9 Mon Sep 17 00:00:00 2001 From: jannakha Date: Mon, 14 Aug 2017 14:36:38 +1000 Subject: [PATCH] claim publication form to be disabled while submitting [#144832653] --- src/config/locale.js | 16 ----------- src/modules/AddRecord/components/AddRecord.js | 9 +++--- .../components/ClaimPublicationForm.js | 28 +++++++++++++++---- 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/src/config/locale.js b/src/config/locale.js index fe9a9e355d..957154995e 100644 --- a/src/config/locale.js +++ b/src/config/locale.js @@ -361,22 +361,6 @@ export default { buttonLabel: 'OK' } }, - dialog: { - success: { - title: 'Your record has been submitted', - content: 'Your item will be referred to a UQ eSpace Staging staff member for editing, prior to being moved into a publicly viewable collection. Please note that our current processing priority is for publications between 2008 and 2014 to meet the requirements of ERA 2015, HERDC 2015 and Q-index.', - primaryButtonLabel: 'Ok', - primaryLink: '/dashboard', - secondaryButtonLabel: 'Add another missing record' - }, - cancel: { - title: 'Cancel adding a missing record', - content: 'Are you sure you want to cancel adding this record?', - primaryButtonLabel: 'Yes', - primaryLink: '/dashboard', - secondaryButtonLabel: 'No' - } - }, cancelWorkflowConfirmation: { confirmationTitle: 'Abandon workflow', confirmationMessage: 'Are you sure you want to abandon workflow?', diff --git a/src/modules/AddRecord/components/AddRecord.js b/src/modules/AddRecord/components/AddRecord.js index 21c806b8c6..b79ca72626 100644 --- a/src/modules/AddRecord/components/AddRecord.js +++ b/src/modules/AddRecord/components/AddRecord.js @@ -153,16 +153,17 @@ export default class AddRecord extends React.Component { } render() { + const txt = locale.pages.addRecord; return ( - + (this.confirmationBox = ref)} onAction={this._navigateToDashboard} - locale={locale.pages.addRecord.confirmationDialog}/> + locale={txt.confirmationDialog}/>
{ - locale.pages.addRecord.stepper.map((step, index) => { + txt.stepper.map((step, index) => { return ( {step.label} @@ -175,7 +176,7 @@ export default class AddRecord extends React.Component { { this.state.stepperIndex === 0 && } { diff --git a/src/modules/ClaimPublicationForm/components/ClaimPublicationForm.js b/src/modules/ClaimPublicationForm/components/ClaimPublicationForm.js index 45c8496b45..9d8040e27d 100644 --- a/src/modules/ClaimPublicationForm/components/ClaimPublicationForm.js +++ b/src/modules/ClaimPublicationForm/components/ClaimPublicationForm.js @@ -35,6 +35,13 @@ export default class ClaimPublicationForm extends Component { this.props.history.go(-1); } + _navigateToDashboard = () => { + // TODO: route should not be hardcoded, should come from config/menu + // TODO: should navigation be handled by top-level container only, eg pass on as props: + // TODO: this.props.navigateToDashboard() and this.props.navigateToClaimForm(item) <- fixes issue of linking item + this.props.history.push('/dashboard'); + }; + _showConfirmation = () => { if (this.props.pristine) { this._navigateToPreviousPage(); @@ -43,6 +50,13 @@ export default class ClaimPublicationForm extends Component { } } + _handleKeyboardFormSubmit = (event) => { + if (event.key === 'Enter' && !event.shiftKey) { + event.preventDefault(); + this.props.handleSubmit(); + } + }; + render() { const txt = locale.components.claimPublicationForm; const publication = this.props.initialValues.get('publication') ? this.props.initialValues.get('publication').toJS() : null; @@ -57,7 +71,7 @@ export default class ClaimPublicationForm extends Component { } return ( -
+ (this.cancelConfirmationBox = ref)} onAction={this._navigateToPreviousPage} @@ -65,7 +79,8 @@ export default class ClaimPublicationForm extends Component { (this.successConfirmationBox = ref)} - onAction={this._navigateToPreviousPage} + onAction={this._navigateToDashboard} + onCancelAction={this._navigateToPreviousPage} locale={txt.successWorkflowConfirmation}/> @@ -75,13 +90,14 @@ export default class ClaimPublicationForm extends Component { { !author && - + } - + { this.props.submitFailed && this.props.error && } { - this.props.dirty && this.props.invalid && !this.props.submitFailed && + this.props.dirty && this.props.invalid && } @@ -127,6 +144,7 @@ export default class ClaimPublicationForm extends Component {