diff --git a/js/components/ascribe_uploader/react_s3_fine_uploader.js b/js/components/ascribe_uploader/react_s3_fine_uploader.js index 8e720f02..6514a588 100644 --- a/js/components/ascribe_uploader/react_s3_fine_uploader.js +++ b/js/components/ascribe_uploader/react_s3_fine_uploader.js @@ -345,10 +345,10 @@ var ReactS3FineUploader = React.createClass({ let newState = React.addons.update(this.state, {filesToUpload: {$set: updatedFilesToUpload}}); this.setState(newState); } else { - let notification = new GlobalNotificationModel('Could not load attached files (Further data)', 'danger', 10000); - GlobalNotificationActions.appendGlobalNotification(notification); - - throw new Error('The session request failed', response); + //let notification = new GlobalNotificationModel('Could not load attached files (Further data)', 'danger', 10000); + //GlobalNotificationActions.appendGlobalNotification(notification); + // + //throw new Error('The session request failed', response); } }, diff --git a/js/components/edition.js b/js/components/edition.js index 073bb952..fad29f38 100644 --- a/js/components/edition.js +++ b/js/components/edition.js @@ -120,7 +120,9 @@ let Edition = React.createClass({ -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}> @@ -497,6 +499,7 @@ let EditionFurtherDetails = React.createClass({ submitKey={this.submitKey} setIsUploadReady={this.setIsUploadReady} isReadyForFormSubmission={this.isReadyForFormSubmission} + editable={editable} edition={this.props.edition}/> @@ -513,34 +516,43 @@ let FileUploader = React.createClass({ }, render() { + if (!this.props.editable && this.props.edition.other_data === null){ + return null; + } return ( - +
+ + + +
+
); } }); diff --git a/js/components/login_container.js b/js/components/login_container.js index 9e6dd10a..a589a3ec 100644 --- a/js/components/login_container.js +++ b/js/components/login_container.js @@ -14,6 +14,7 @@ import Property from './ascribe_forms/property'; import apiUrls from '../constants/api_urls'; import AppConstants from '../constants/application_constants'; +let Link = Router.Link; let LoginContainer = React.createClass({ mixins: [Router.Navigation], @@ -46,7 +47,6 @@ let LoginContainer = React.createClass({
Log in to ascribe...
- ); @@ -108,8 +108,8 @@ let LoginForm = React.createClass({
- Not an ascribe user? Sign up...
- Forgot my password? Rescue me... + Not an ascribe user? Sign up...
+ Forgot my password? Rescue me...
); diff --git a/js/components/password_reset_container.js b/js/components/password_reset_container.js index 2df20ef0..0c8c34be 100644 --- a/js/components/password_reset_container.js +++ b/js/components/password_reset_container.js @@ -3,28 +3,159 @@ import React from 'react'; 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 GlobalNotificationActions from '../actions/global_notification_actions'; let PasswordResetContainer = React.createClass({ mixins: [Router.Navigation], + getInitialState() { + return {isRequested: false}; + }, + handleRequestSuccess(email){ + this.setState({isRequested: email}); + }, + render() { + if (this.props.query.email && this.props.query.token) { + return ( +
+
+ Reset the password for {this.props.query.email} +
+ +
+ ); + } + else { + if (this.state.isRequested === false) { + return ( +
+
+ Reset your ascribe password +
+ +
+ ); + } + else if (this.state.isRequested) { + return ( +
+
+ An email has been sent to "{this.state.isRequested}" +
+
+ ); + } + else { + return ; + } + } + } +}); - 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 ( +
+ Reset your password + } + spinner={ + + }> + + + +
+
+ ); + } +}); + +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'); let notification = new GlobalNotificationModel('password succesfully updated', 'success', 10000); GlobalNotificationActions.appendGlobalNotification(notification); }, render() { return ( - - ); - } + getFormData={this.getFormData} + buttons={ + } + spinner={ + + }> + + + + + + +
+ + ); + } }); export default PasswordResetContainer; \ No newline at end of file diff --git a/js/components/piece_list.js b/js/components/piece_list.js index ce3a732f..c4bf4b71 100644 --- a/js/components/piece_list.js +++ b/js/components/piece_list.js @@ -65,7 +65,6 @@ let PieceList = React.createClass({ let currentPage = parseInt(this.props.query.page, 10) || 1; let totalPages = Math.ceil(this.state.pieceListCount / this.state.pageSize); let loadingElement = (); - return (