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

Remove all occurrences of inactivity mgmt of ReactS3Fineuploader

This commit is contained in:
Tim Daubenschütz 2015-12-02 12:37:21 +01:00
parent 8b3060d613
commit fe24a5e15a
8 changed files with 15 additions and 80 deletions

View File

@ -26,7 +26,6 @@ let RegisterPieceForm = React.createClass({
isFineUploaderActive: React.PropTypes.bool,
isFineUploaderEditable: React.PropTypes.bool,
enableLocalHashing: React.PropTypes.bool,
onLoggedOut: React.PropTypes.func,
// For this form to work with SlideContainer, we sometimes have to disable it
disabled: React.PropTypes.bool,
@ -116,7 +115,6 @@ let RegisterPieceForm = React.createClass({
setIsUploadReady={this.setIsUploadReady}
isReadyForFormSubmission={formSubmissionValidation.atLeastOneUploadedFile}
isFineUploaderActive={this.props.isFineUploaderActive}
onLoggedOut={this.props.onLoggedOut}
disabled={!this.props.isFineUploaderEditable}
enableLocalHashing={enableLocalHashing}
uploadMethod={this.props.location.query.method} />

View File

@ -38,7 +38,6 @@ const InputFineUploader = React.createClass({
// a user is actually not logged in already to prevent him from droping files
// before login in
isFineUploaderActive: bool,
onLoggedOut: func,
enableLocalHashing: bool,
uploadMethod: string,
@ -51,7 +50,10 @@ const InputFineUploader = React.createClass({
fileClassToUpload: shape({
singular: string,
plural: string
})
}),
// Provided by `Property`
onChange: React.PropTypes.func
},
getDefaultProps() {
@ -101,16 +103,16 @@ const InputFineUploader = React.createClass({
setIsUploadReady,
isReadyForFormSubmission,
areAssetsDownloadable,
onLoggedOut,
enableLocalHashing,
uploadMethod,
fileClassToUpload,
location } = this.props;
disabled } = this.props;
let editable = this.props.isFineUploaderActive;
// if disabled is actually set by property, we want to override
// isFineUploaderActive
if(typeof this.props.disabled !== 'undefined') {
editable = !this.props.disabled;
if(typeof disabled !== 'undefined') {
editable = !disabled;
}
return (
@ -139,10 +141,9 @@ const InputFineUploader = React.createClass({
'X-CSRFToken': getCookie(AppConstants.csrftoken)
}
}}
onInactive={this.props.onLoggedOut}
enableLocalHashing={this.props.enableLocalHashing}
uploadMethod={this.props.uploadMethod}
fileClassToUpload={this.props.fileClassToUpload} />
enableLocalHashing={enableLocalHashing}
uploadMethod={uploadMethod}
fileClassToUpload={fileClassToUpload} />
);
}
});

View File

@ -15,7 +15,6 @@ let FileDragAndDrop = React.createClass({
className: React.PropTypes.string,
onDrop: React.PropTypes.func.isRequired,
onDragOver: React.PropTypes.func,
onInactive: React.PropTypes.func,
filesToUpload: React.PropTypes.array,
handleDeleteFile: React.PropTypes.func,
handleCancelFile: React.PropTypes.func,
@ -63,11 +62,6 @@ let FileDragAndDrop = React.createClass({
let files;
if(this.props.dropzoneInactive) {
// if there is a handle function for doing stuff
// when the dropzone is inactive, then call it
if(this.props.onInactive) {
this.props.onInactive();
}
return;
}
@ -119,9 +113,6 @@ let FileDragAndDrop = React.createClass({
if(this.props.dropzoneInactive) {
// if there is a handle function for doing stuff
// when the dropzone is inactive, then call it
if(this.props.onInactive) {
this.props.onInactive();
}
return;
}

View File

@ -99,7 +99,6 @@ let ReactS3FineUploader = React.createClass({
areAssetsDownloadable: React.PropTypes.bool,
areAssetsEditable: React.PropTypes.bool,
defaultErrorMessage: React.PropTypes.string,
onInactive: React.PropTypes.func,
// We encountered some cases where people had difficulties to upload their
// works to ascribe due to a slow internet connection.
@ -891,7 +890,6 @@ let ReactS3FineUploader = React.createClass({
multiple,
areAssetsDownloadable,
areAssetsEditable,
onInactive,
enableLocalHashing,
fileClassToUpload,
fileInputElement: FileInputElement,
@ -901,7 +899,6 @@ let ReactS3FineUploader = React.createClass({
multiple,
areAssetsDownloadable,
areAssetsEditable,
onInactive,
enableLocalHashing,
uploadMethod,
fileClassToUpload,

View File

@ -45,10 +45,7 @@ let RegisterPiece = React.createClass( {
UserStore.getState(),
WhitelabelStore.getState(),
PieceListStore.getState(),
{
selectedLicense: 0,
isFineUploaderActive: false
});
);
},
componentDidMount() {
@ -66,13 +63,6 @@ let RegisterPiece = React.createClass( {
onChange(state) {
this.setState(state);
if(this.state.currentUser && this.state.currentUser.email) {
// we should also make the fineuploader component editable again
this.setState({
isFineUploaderActive: true
});
}
},
handleSuccess(response){
@ -117,7 +107,7 @@ let RegisterPiece = React.createClass( {
<Col xs={12} sm={10} md={8} smOffset={1} mdOffset={2}>
<RegisterPieceForm
{...this.props}
isFineUploaderActive={this.state.isFineUploaderActive}
isFineUploaderActive={true}
handleSuccess={this.handleSuccess}
location={this.props.location}>
{this.props.children}

View File

@ -53,8 +53,6 @@ let CylandRegisterPiece = React.createClass({
PieceStore.getState(),
WhitelabelStore.getState(),
{
selectedLicense: 0,
isFineUploaderActive: false,
step: 0
});
},
@ -90,13 +88,6 @@ let CylandRegisterPiece = React.createClass({
onChange(state) {
this.setState(state);
if(this.state.currentUser && this.state.currentUser.email) {
// we should also make the fineuploader component editable again
this.setState({
isFineUploaderActive: true
});
}
},
handleRegisterSuccess(response){
@ -167,11 +158,6 @@ let CylandRegisterPiece = React.createClass({
}
},
// basically redirects to the second slide (index: 1), when the user is not logged in
onLoggedOut() {
this.history.pushState(null, '/login');
},
render() {
let today = new Moment();
@ -197,9 +183,8 @@ let CylandRegisterPiece = React.createClass({
enableLocalHashing={false}
headerMessage={getLangText('Submit to Cyland Archive')}
submitMessage={getLangText('Submit')}
isFineUploaderActive={this.state.isFineUploaderActive}
isFineUploaderActive={true}
handleSuccess={this.handleRegisterSuccess}
onLoggedOut={this.onLoggedOut}
location={this.props.location}/>
</Col>
</Row>

View File

@ -85,13 +85,6 @@ let IkonotvRegisterPiece = React.createClass({
onChange(state) {
this.setState(state);
if(this.state.currentUser && this.state.currentUser.email) {
// we should also make the fineuploader component editable again
this.setState({
isFineUploaderActive: true
});
}
},
@ -157,19 +150,6 @@ let IkonotvRegisterPiece = React.createClass({
);
},
changeSlide() {
// only transition to the login store, if user is not logged in
// ergo the currentUser object is not properly defined
if(this.state.currentUser && !this.state.currentUser.email) {
this.onLoggedOut();
}
},
// basically redirects to the second slide (index: 1), when the user is not logged in
onLoggedOut() {
this.history.pushState(null, '/login');
},
canSubmit() {
let currentUser = this.state.currentUser;
return currentUser && currentUser.acl && currentUser.acl.acl_wallet_submit;
@ -260,9 +240,8 @@ let IkonotvRegisterPiece = React.createClass({
enableLocalHashing={false}
headerMessage={getLangText('Register work')}
submitMessage={getLangText('Register')}
isFineUploaderActive={this.state.isFineUploaderActive}
isFineUploaderActive={true}
handleSuccess={this.handleRegisterSuccess}
onLoggedOut={this.onLoggedOut}
location={this.props.location}/>
</Col>
</Row>

View File

@ -106,11 +106,6 @@ let MarketRegisterPiece = React.createClass({
);
},
// basically redirects to the second slide (index: 1), when the user is not logged in
onLoggedOut() {
this.history.pushState(null, '/login');
},
render() {
setDocumentTitle(getLangText('Register a new piece'));
@ -133,7 +128,6 @@ let MarketRegisterPiece = React.createClass({
submitMessage={getLangText('Proceed to additional details')}
isFineUploaderActive={true}
handleSuccess={this.handleRegisterSuccess}
onLoggedOut={this.onLoggedOut}
location={this.props.location}>
<Property
name="num_editions"