1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-23 01:39:36 +01:00

Clean up FurtherDetails component

This commit is contained in:
Brett Sun 2016-07-08 15:34:31 +02:00
parent 0d751d5986
commit 8a4243ffab

View File

@ -1,5 +1,3 @@
'use strict';
import React from 'react'; import React from 'react';
import Row from 'react-bootstrap/lib/Row'; import Row from 'react-bootstrap/lib/Row';
@ -18,7 +16,7 @@ import { formSubmissionValidation } from '../ascribe_uploader/react_s3_fine_uplo
import { getLangText } from '../../utils/lang'; import { getLangText } from '../../utils/lang';
let FurtherDetails = React.createClass({ const FurtherDetails = React.createClass({
propTypes: { propTypes: {
pieceId: React.PropTypes.number.isRequired, pieceId: React.PropTypes.number.isRequired,
@ -34,6 +32,7 @@ let FurtherDetails = React.createClass({
}; };
}, },
// FIXME: add this to the uploader too
showNotification() { showNotification() {
const { handleSuccess } = this.props; const { handleSuccess } = this.props;
@ -45,56 +44,42 @@ let FurtherDetails = React.createClass({
GlobalNotificationActions.appendGlobalNotification(notification); GlobalNotificationActions.appendGlobalNotification(notification);
}, },
submitFile(file) {
this.setState({
otherDataKey: file.key
});
},
setIsUploadReady(isReady) {
this.setState({
isUploadReady: isReady
});
},
render() { render() {
const { editable, extraData, otherData, pieceId } = this.props; const { editable, extraData, otherData, pieceId } = this.props;
return ( return (
<Row> <Row>
<Col md={12} className="ascribe-edition-personal-note"> <Col className="ascribe-edition-personal-note" md={12}>
<PieceExtraDataForm <PieceExtraDataForm
name='artist_contact_info'
title={getLangText('Artist Contact Info')}
convertLinks convertLinks
editable={editable} editable={editable}
extraData={extraData} extraData={extraData}
handleSuccess={this.showNotification} handleSuccess={this.showNotification}
pieceId={pieceId} /> name='artist_contact_info'
pieceId={pieceId}
title={getLangText('Artist Contact Info')} />
<PieceExtraDataForm <PieceExtraDataForm
editable={editable}
extraData={extraData}
handleSuccess={this.showNotification}
name='display_instructions' name='display_instructions'
title={getLangText('Display Instructions')} pieceId={pieceId}
editable={editable} title={getLangText('Display Instructions')} />
extraData={extraData}
handleSuccess={this.showNotification}
pieceId={pieceId} />
<PieceExtraDataForm <PieceExtraDataForm
name='technology_details'
title={getLangText('Technology Details')}
editable={editable} editable={editable}
extraData={extraData} extraData={extraData}
handleSuccess={this.showNotification} handleSuccess={this.showNotification}
pieceId={pieceId} /> name='technology_details'
pieceId={pieceId}
title={getLangText('Technology Details')} />
<Form> <Form>
<FurtherDetailsFileuploader <FurtherDetailsFileuploader
submitFile={this.submitFile} multiple
setIsUploadReady={this.setIsUploadReady} overrideForm
isReadyForFormSubmission={formSubmissionValidation.atLeastOneUploadedFile}
editable={editable} editable={editable}
overrideForm={true} isReadyForFormSubmission={formSubmissionValidation.atLeastOneUploadedFile}
pieceId={pieceId}
otherData={otherData} otherData={otherData}
multiple={true} /> pieceId={pieceId} />
</Form> </Form>
</Col> </Col>
</Row> </Row>
@ -103,5 +88,4 @@ let FurtherDetails = React.createClass({
}); });
export default FurtherDetails; export default FurtherDetails;