mirror of
https://github.com/ascribe/onion.git
synced 2024-12-23 01:39:36 +01:00
Integrate hashing setting in uploader
This commit is contained in:
parent
60ad72aabb
commit
828d24044b
@ -63,7 +63,6 @@ let Form = React.createClass({
|
|||||||
if ('getFormData' in this.props){
|
if ('getFormData' in this.props){
|
||||||
data = mergeOptionsWithDuplicates(data, this.props.getFormData());
|
data = mergeOptionsWithDuplicates(data, this.props.getFormData());
|
||||||
}
|
}
|
||||||
console.log(data)
|
|
||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -2,18 +2,21 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import AppConstants from '../../constants/application_constants';
|
import UserStore from '../../stores/user_store';
|
||||||
|
import UserActions from '../../actions/user_actions';
|
||||||
|
|
||||||
import Form from './form';
|
import Form from './form';
|
||||||
import Property from './property';
|
import Property from './property';
|
||||||
import FormPropertyHeader from './form_property_header';
|
import FormPropertyHeader from './form_property_header';
|
||||||
|
|
||||||
import apiUrls from '../../constants/api_urls';
|
|
||||||
|
|
||||||
import ReactS3FineUploader from '../ascribe_uploader/react_s3_fine_uploader';
|
import ReactS3FineUploader from '../ascribe_uploader/react_s3_fine_uploader';
|
||||||
|
|
||||||
|
import AppConstants from '../../constants/application_constants';
|
||||||
|
import apiUrls from '../../constants/api_urls';
|
||||||
|
|
||||||
import { getCookie } from '../../utils/fetch_api_utils';
|
import { getCookie } from '../../utils/fetch_api_utils';
|
||||||
import { getLangText } from '../../utils/lang_utils';
|
import { getLangText } from '../../utils/lang_utils';
|
||||||
|
import { mergeOptions } from '../../utils/general_utils';
|
||||||
|
|
||||||
|
|
||||||
let RegisterPieceForm = React.createClass({
|
let RegisterPieceForm = React.createClass({
|
||||||
@ -33,10 +36,26 @@ let RegisterPieceForm = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
getInitialState(){
|
getInitialState(){
|
||||||
return {
|
return mergeOptions(
|
||||||
digitalWorkKey: null,
|
{
|
||||||
isUploadReady: false
|
digitalWorkKey: null,
|
||||||
};
|
isUploadReady: false
|
||||||
|
},
|
||||||
|
UserStore.getState()
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
UserStore.listen(this.onChange);
|
||||||
|
UserActions.fetchCurrentUser();
|
||||||
|
},
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
UserStore.unlisten(this.onChange);
|
||||||
|
},
|
||||||
|
|
||||||
|
onChange(state) {
|
||||||
|
this.setState(state);
|
||||||
},
|
},
|
||||||
|
|
||||||
getFormData(){
|
getFormData(){
|
||||||
@ -67,6 +86,9 @@ let RegisterPieceForm = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
let currentUser = this.state.currentUser;
|
||||||
|
let enableLocalHashing = currentUser && currentUser.profile ? currentUser.profile.hash_locally : false;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form
|
<Form
|
||||||
className="ascribe-form-bordered"
|
className="ascribe-form-bordered"
|
||||||
@ -94,7 +116,8 @@ let RegisterPieceForm = React.createClass({
|
|||||||
submitKey={this.submitKey}
|
submitKey={this.submitKey}
|
||||||
setIsUploadReady={this.setIsUploadReady}
|
setIsUploadReady={this.setIsUploadReady}
|
||||||
isReadyForFormSubmission={this.isReadyForFormSubmission}
|
isReadyForFormSubmission={this.isReadyForFormSubmission}
|
||||||
editable={this.props.isFineUploaderEditable}/>
|
editable={this.props.isFineUploaderEditable}
|
||||||
|
enableLocalHashing={enableLocalHashing}/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property
|
<Property
|
||||||
name='artist_name'
|
name='artist_name'
|
||||||
@ -136,7 +159,8 @@ let FileUploader = React.createClass({
|
|||||||
// editable is used to lock react fine uploader in case
|
// editable is used to lock react fine uploader in case
|
||||||
// a user is actually not logged in already to prevent him from droping files
|
// a user is actually not logged in already to prevent him from droping files
|
||||||
// before login in
|
// before login in
|
||||||
editable: React.PropTypes.bool
|
editable: React.PropTypes.bool,
|
||||||
|
enableLocalHashing: React.PropTypes.bool
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -174,7 +198,7 @@ let FileUploader = React.createClass({
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
multiple={false}
|
multiple={false}
|
||||||
enableLocalHashing={true} />
|
enableLocalHashing={this.props.enableLocalHashing} />
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user