mirror of
https://github.com/ascribe/onion.git
synced 2025-02-14 21:10:27 +01:00
Merge remote-tracking branch 'origin/AD-368-harmonize-functionality-of-ascrib' into AD-496-add-control-buttons-to-fineupload
This commit is contained in:
commit
bb73416a8c
@ -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);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -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}/>
|
||||||
@ -497,6 +499,7 @@ let EditionFurtherDetails = React.createClass({
|
|||||||
submitKey={this.submitKey}
|
submitKey={this.submitKey}
|
||||||
setIsUploadReady={this.setIsUploadReady}
|
setIsUploadReady={this.setIsUploadReady}
|
||||||
isReadyForFormSubmission={this.isReadyForFormSubmission}
|
isReadyForFormSubmission={this.isReadyForFormSubmission}
|
||||||
|
editable={editable}
|
||||||
edition={this.props.edition}/>
|
edition={this.props.edition}/>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
@ -513,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>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -14,6 +14,7 @@ import Property from './ascribe_forms/property';
|
|||||||
import apiUrls from '../constants/api_urls';
|
import apiUrls from '../constants/api_urls';
|
||||||
import AppConstants from '../constants/application_constants';
|
import AppConstants from '../constants/application_constants';
|
||||||
|
|
||||||
|
let Link = Router.Link;
|
||||||
|
|
||||||
let LoginContainer = React.createClass({
|
let LoginContainer = React.createClass({
|
||||||
mixins: [Router.Navigation],
|
mixins: [Router.Navigation],
|
||||||
@ -46,7 +47,6 @@ let LoginContainer = React.createClass({
|
|||||||
<div className="ascribe-login-text ascribe-login-header">
|
<div className="ascribe-login-text ascribe-login-header">
|
||||||
Log in to ascribe...
|
Log in to ascribe...
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<LoginForm />
|
<LoginForm />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@ -108,8 +108,8 @@ let LoginForm = React.createClass({
|
|||||||
</Property>
|
</Property>
|
||||||
<hr />
|
<hr />
|
||||||
<div className="ascribe-login-text">
|
<div className="ascribe-login-text">
|
||||||
Not an ascribe user? Sign up...<br/>
|
Not an ascribe user? <Link to="signup">Sign up...</Link><br/>
|
||||||
Forgot my password? Rescue me...
|
Forgot my password? <Link to="password_reset">Rescue me...</Link>
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
|
@ -3,28 +3,159 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Router from 'react-router';
|
import Router from 'react-router';
|
||||||
|
|
||||||
import PasswordResetForm from './ascribe_forms/form_password_reset';
|
import Form from './ascribe_forms/form';
|
||||||
|
import Property from './ascribe_forms/property';
|
||||||
|
|
||||||
|
import apiUrls from '../constants/api_urls';
|
||||||
|
|
||||||
import GlobalNotificationModel from '../models/global_notification_model';
|
import GlobalNotificationModel from '../models/global_notification_model';
|
||||||
import GlobalNotificationActions from '../actions/global_notification_actions';
|
import GlobalNotificationActions from '../actions/global_notification_actions';
|
||||||
|
|
||||||
let PasswordResetContainer = React.createClass({
|
let PasswordResetContainer = React.createClass({
|
||||||
mixins: [Router.Navigation],
|
mixins: [Router.Navigation],
|
||||||
|
getInitialState() {
|
||||||
|
return {isRequested: false};
|
||||||
|
},
|
||||||
|
handleRequestSuccess(email){
|
||||||
|
this.setState({isRequested: email});
|
||||||
|
},
|
||||||
|
render() {
|
||||||
|
if (this.props.query.email && this.props.query.token) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div className="ascribe-login-text ascribe-login-header">
|
||||||
|
Reset the password for {this.props.query.email}
|
||||||
|
</div>
|
||||||
|
<PasswordResetForm
|
||||||
|
email={this.props.query.email}
|
||||||
|
token={this.props.query.token}/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (this.state.isRequested === false) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div className="ascribe-login-text ascribe-login-header">
|
||||||
|
Reset your ascribe password
|
||||||
|
</div>
|
||||||
|
<PasswordRequestResetForm
|
||||||
|
handleRequestSuccess={this.handleRequestSuccess}/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if (this.state.isRequested) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div className="ascribe-login-text ascribe-login-header">
|
||||||
|
An email has been sent to "{this.state.isRequested}"
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return <span />;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
handleSuccess(){
|
let PasswordRequestResetForm = React.createClass({
|
||||||
|
handleSuccess() {
|
||||||
|
let notificationText = 'Request succesfully sent, check your email';
|
||||||
|
let notification = new GlobalNotificationModel(notificationText, 'success', 50000);
|
||||||
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
|
this.props.handleRequestSuccess(this.refs.form.refs.email.state.value);
|
||||||
|
},
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<Form
|
||||||
|
ref="form"
|
||||||
|
url={apiUrls.users_password_reset_request}
|
||||||
|
handleSuccess={this.handleSuccess}
|
||||||
|
buttons={
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
className="btn ascribe-btn ascribe-btn-login">
|
||||||
|
Reset your password
|
||||||
|
</button>}
|
||||||
|
spinner={
|
||||||
|
<button className="btn ascribe-btn ascribe-btn-login ascribe-btn-login-spinner">
|
||||||
|
<img src="https://s3-us-west-2.amazonaws.com/ascribe0/media/thumbnails/ascribe_animated_medium.gif" />
|
||||||
|
</button>
|
||||||
|
}>
|
||||||
|
<Property
|
||||||
|
name='email'
|
||||||
|
label="Email">
|
||||||
|
<input
|
||||||
|
type="email"
|
||||||
|
placeholder="Enter your email and we'll send a link"
|
||||||
|
name="email"
|
||||||
|
required/>
|
||||||
|
</Property>
|
||||||
|
<hr />
|
||||||
|
</Form>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
let PasswordResetForm = React.createClass({
|
||||||
|
mixins: [Router.Navigation],
|
||||||
|
|
||||||
|
getFormData(){
|
||||||
|
let data = {};
|
||||||
|
for (let ref in this.refs.form.refs){
|
||||||
|
data[this.refs.form.refs[ref].props.name] = this.refs.form.refs[ref].state.value;
|
||||||
|
}
|
||||||
|
data.email = this.props.email;
|
||||||
|
data.token = this.props.token;
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
handleSuccess() {
|
||||||
this.transitionTo('pieces');
|
this.transitionTo('pieces');
|
||||||
let notification = new GlobalNotificationModel('password succesfully updated', 'success', 10000);
|
let notification = new GlobalNotificationModel('password succesfully updated', 'success', 10000);
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<PasswordResetForm
|
<Form
|
||||||
email={this.props.query.email}
|
ref="form"
|
||||||
token={this.props.query.token}
|
url={apiUrls.users_password_reset}
|
||||||
handleSuccess={this.handleSuccess}
|
handleSuccess={this.handleSuccess}
|
||||||
/>
|
getFormData={this.getFormData}
|
||||||
);
|
buttons={
|
||||||
}
|
<button
|
||||||
|
type="submit"
|
||||||
|
className="btn ascribe-btn ascribe-btn-login">
|
||||||
|
Reset your password
|
||||||
|
</button>}
|
||||||
|
spinner={
|
||||||
|
<button className="btn ascribe-btn ascribe-btn-login ascribe-btn-login-spinner">
|
||||||
|
<img src="https://s3-us-west-2.amazonaws.com/ascribe0/media/thumbnails/ascribe_animated_medium.gif" />
|
||||||
|
</button>
|
||||||
|
}>
|
||||||
|
<Property
|
||||||
|
name='password'
|
||||||
|
label="Password">
|
||||||
|
<input
|
||||||
|
type="password"
|
||||||
|
placeholder="Enter a new password"
|
||||||
|
name="password"
|
||||||
|
required/>
|
||||||
|
</Property>
|
||||||
|
<Property
|
||||||
|
name='password_confirm'
|
||||||
|
label="Confirm password">
|
||||||
|
<input
|
||||||
|
type="password"
|
||||||
|
placeholder="Enter your password once again"
|
||||||
|
name="password"
|
||||||
|
required/>
|
||||||
|
</Property>
|
||||||
|
<hr />
|
||||||
|
</Form>
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default PasswordResetContainer;
|
export default PasswordResetContainer;
|
@ -65,7 +65,6 @@ let PieceList = React.createClass({
|
|||||||
let currentPage = parseInt(this.props.query.page, 10) || 1;
|
let currentPage = parseInt(this.props.query.page, 10) || 1;
|
||||||
let totalPages = Math.ceil(this.state.pieceListCount / this.state.pageSize);
|
let totalPages = Math.ceil(this.state.pieceListCount / this.state.pageSize);
|
||||||
let loadingElement = (<img src={AppConstants.baseUrl + 'static/img/ascribe_animated_medium.gif'} />);
|
let loadingElement = (<img src={AppConstants.baseUrl + 'static/img/ascribe_animated_medium.gif'} />);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<PieceListToolbar
|
<PieceListToolbar
|
||||||
|
Loading…
x
Reference in New Issue
Block a user