1
0
mirror of https://github.com/ascribe/onion.git synced 2025-02-14 21:10:27 +01:00

other_data : delete without cascade and show acl

This commit is contained in:
diminator 2015-06-30 17:12:51 +02:00
parent 5ecd1368f0
commit c6528d8999
2 changed files with 49 additions and 42 deletions

View File

@ -345,10 +345,10 @@ var ReactS3FineUploader = React.createClass({
let newState = React.addons.update(this.state, {filesToUpload: {$set: updatedFilesToUpload}}); let newState = React.addons.update(this.state, {filesToUpload: {$set: updatedFilesToUpload}});
this.setState(newState); this.setState(newState);
} else { } else {
let notification = new GlobalNotificationModel('Could not load attached files (Further data)', 'danger', 10000); //let notification = new GlobalNotificationModel('Could not load attached files (Further data)', 'danger', 10000);
GlobalNotificationActions.appendGlobalNotification(notification); //GlobalNotificationActions.appendGlobalNotification(notification);
//
throw new Error('The session request failed', response); //throw new Error('The session request failed', response);
} }
}, },

View File

@ -120,7 +120,9 @@ let Edition = React.createClass({
<CollapsibleParagraph <CollapsibleParagraph
title="Further Details" title="Further Details"
show={this.props.edition.acl.indexOf('edit') > -1 || Object.keys(this.props.edition.extra_data).length > 0}> show={this.props.edition.acl.indexOf('edit') > -1
|| Object.keys(this.props.edition.extra_data).length > 0
|| this.props.edition.other_data !== null}>
<EditionFurtherDetails <EditionFurtherDetails
handleSuccess={this.props.loadEdition} handleSuccess={this.props.loadEdition}
edition={this.props.edition}/> edition={this.props.edition}/>
@ -493,16 +495,12 @@ let EditionFurtherDetails = React.createClass({
handleSuccess={this.showNotification} handleSuccess={this.showNotification}
editable={editable} editable={editable}
edition={this.props.edition} /> edition={this.props.edition} />
<Property <FileUploader
label="Additional files" submitKey={this.submitKey}
editable={editable}> setIsUploadReady={this.setIsUploadReady}
<FileUploader isReadyForFormSubmission={this.isReadyForFormSubmission}
submitKey={this.submitKey} editable={editable}
setIsUploadReady={this.setIsUploadReady} edition={this.props.edition}/>
isReadyForFormSubmission={this.isReadyForFormSubmission}
edition={this.props.edition}/>
</Property>
</Col> </Col>
</Row> </Row>
); );
@ -518,34 +516,43 @@ let FileUploader = React.createClass({
}, },
render() { render() {
if (!this.props.editable && this.props.edition.other_data === null){
return null;
}
return ( return (
<ReactS3FineUploader <Form>
keyRoutine={{ <Property
url: AppConstants.serverUrl + 's3/key/', label="Additional files">
fileClass: 'otherdata', <ReactS3FineUploader
bitcoinId: this.props.edition.bitcoin_id keyRoutine={{
}} url: AppConstants.serverUrl + 's3/key/',
createBlobRoutine={{ fileClass: 'otherdata',
url: apiUrls.blob_otherdatas, bitcoinId: this.props.edition.bitcoin_id
bitcoinId: this.props.edition.bitcoin_id }}
}} createBlobRoutine={{
validation={{ url: apiUrls.blob_otherdatas,
itemLimit: 100000, bitcoinId: this.props.edition.bitcoin_id
sizeLimit: '10000000' }}
}} validation={{
submitKey={this.props.submitKey} itemLimit: 100000,
setIsUploadReady={this.props.setIsUploadReady} sizeLimit: '10000000'
isReadyForFormSubmission={this.props.isReadyForFormSubmission} }}
session={{ submitKey={this.props.submitKey}
endpoint: AppConstants.serverUrl + 'api/blob/otherdatas/fineuploader_session/', setIsUploadReady={this.props.setIsUploadReady}
customHeaders: { isReadyForFormSubmission={this.props.isReadyForFormSubmission}
'X-CSRFToken': getCookie('csrftoken') session={{
}, endpoint: AppConstants.serverUrl + 'api/blob/otherdatas/fineuploader_session/',
params: { customHeaders: {
'pk': this.props.edition.other_data ? this.props.edition.other_data.id : null 'X-CSRFToken': getCookie('csrftoken')
} },
}} params: {
areAssetsDownloadable={true}/> 'pk': this.props.edition.other_data ? this.props.edition.other_data.id : null
}
}}
areAssetsDownloadable={true}/>
</Property>
<hr />
</Form>
); );
} }
}); });