Skip to content

Commit

Permalink
claim publication form to be disabled while submitting [#144832653]
Browse files Browse the repository at this point in the history
  • Loading branch information
jannakha committed Aug 14, 2017
1 parent 367170d commit 13f95b1
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 25 deletions.
16 changes: 0 additions & 16 deletions src/config/locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -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?',
Expand Down
9 changes: 5 additions & 4 deletions src/modules/AddRecord/components/AddRecord.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,17 @@ export default class AddRecord extends React.Component {
}

render() {
const txt = locale.pages.addRecord;
return (
<StandardPage title={locale.pages.addRecord.title}>
<StandardPage title={txt.title}>
<ConfirmDialogBox onRef={ref => (this.confirmationBox = ref)}
onAction={this._navigateToDashboard}
locale={locale.pages.addRecord.confirmationDialog}/>
locale={txt.confirmationDialog}/>

<div className="Stepper">
<Stepper activeStep={this.state.stepperIndex} style={{padding: '0', margin: '-10px auto'}}>
{
locale.pages.addRecord.stepper.map((step, index) => {
txt.stepper.map((step, index) => {
return (<Step key={index}>
<StepLabel
style={{textOverflow: 'ellipsis', overflow: 'hidden'}}>{step.label}</StepLabel>
Expand All @@ -175,7 +176,7 @@ export default class AddRecord extends React.Component {
{
this.state.stepperIndex === 0 &&
<PublicationSearchForm
locale={locale.pages.addRecord.step1}
locale={txt.step1}
onSubmit={this._performSearch}/>
}
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
Expand All @@ -57,15 +71,16 @@ export default class ClaimPublicationForm extends Component {
}
return (
<StandardPage title={txt.title}>
<form>
<form onKeyDown={this._handleKeyboardFormSubmit}>
<ConfirmDialogBox
onRef={ref => (this.cancelConfirmationBox = ref)}
onAction={this._navigateToPreviousPage}
locale={txt.cancelWorkflowConfirmation}/>

<ConfirmDialogBox
onRef={ref => (this.successConfirmationBox = ref)}
onAction={this._navigateToPreviousPage}
onAction={this._navigateToDashboard}
onCancelAction={this._navigateToPreviousPage}
locale={txt.successWorkflowConfirmation}/>

<StandardCard title={txt.claimingInformation.title} help={txt.claimingInformation.help}>
Expand All @@ -75,13 +90,14 @@ export default class ClaimPublicationForm extends Component {
{
!author &&
<StandardCard title={txt.authorLinking.title} help={txt.authorLinking.help}>
<AuthorLinking dataSource={[]}/>
<AuthorLinking disabled={this.props.submitting} dataSource={[]}/>
</StandardCard>
}

<StandardCard title={txt.comments.title} help={txt.comments.help}>
<Field
component={TextField}
disabled={this.props.submitting}
name="comments"
type="text"
fullWidth
Expand All @@ -91,6 +107,7 @@ export default class ClaimPublicationForm extends Component {

<Field
component={TextField}
disabled={this.props.submitting}
name="rek_link"
type="text"
fullWidth
Expand All @@ -99,14 +116,14 @@ export default class ClaimPublicationForm extends Component {
</StandardCard>

<StandardCard title={txt.fileUpload.title} help={txt.fileUpload.help}>
<FileUploader />
<FileUploader disabled={this.props.submitting} />
</StandardCard>
{
this.props.submitFailed && this.props.error &&
<Alert type="error_outline" title="Error" message={this.props.error} outsideLayout/>
}
{
this.props.dirty && this.props.invalid && !this.props.submitFailed &&
this.props.dirty && this.props.invalid &&
<Alert type="warning" title="Validation"
message={'Form cannot be submitted until all fields are valid...'} outsideLayout/>
}
Expand All @@ -127,6 +144,7 @@ export default class ClaimPublicationForm extends Component {
<RaisedButton
fullWidth
label={txt.cancel}
disabled={this.props.submitting}
onTouchTap={this._showConfirmation}/>
</div>
<div className="column is-narrow-desktop">
Expand Down

0 comments on commit 13f95b1

Please sign in to comment.