From 6660065cada917f708aa081e32c58a8d972a50fa Mon Sep 17 00:00:00 2001 From: diminator Date: Tue, 30 Jun 2015 14:46:28 +0200 Subject: [PATCH 1/4] signup process complete + subdomained --- js/components/login_container.js | 6 +- js/components/password_reset_container.js | 148 ++++++++++++++++++++-- 2 files changed, 143 insertions(+), 11 deletions(-) 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..5098a7ad 100644 --- a/js/components/password_reset_container.js +++ b/js/components/password_reset_container.js @@ -3,28 +3,160 @@ 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.digital_work_key = this.state.digitalWorkKey; + 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 From ce13da4b4927ecc6c804f88ecb0dcc088a47cb68 Mon Sep 17 00:00:00 2001 From: diminator Date: Tue, 30 Jun 2015 15:26:39 +0200 Subject: [PATCH 2/4] password reset complete + subdomain --- js/components/password_reset_container.js | 1 - js/components/piece_list.js | 1 - 2 files changed, 2 deletions(-) diff --git a/js/components/password_reset_container.js b/js/components/password_reset_container.js index 5098a7ad..0c8c34be 100644 --- a/js/components/password_reset_container.js +++ b/js/components/password_reset_container.js @@ -107,7 +107,6 @@ let PasswordResetForm = React.createClass({ for (let ref in this.refs.form.refs){ data[this.refs.form.refs[ref].props.name] = this.refs.form.refs[ref].state.value; } - data.digital_work_key = this.state.digitalWorkKey; data.email = this.props.email; data.token = this.props.token; return data; 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 (
Date: Tue, 30 Jun 2015 16:54:45 +0200 Subject: [PATCH 3/4] otherdata delete --- .../ascribe_uploader/react_s3_fine_uploader.js | 3 --- js/components/edition.js | 15 ++++++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/js/components/ascribe_uploader/react_s3_fine_uploader.js b/js/components/ascribe_uploader/react_s3_fine_uploader.js index ec13c9f6..d01ff23e 100644 --- a/js/components/ascribe_uploader/react_s3_fine_uploader.js +++ b/js/components/ascribe_uploader/react_s3_fine_uploader.js @@ -364,9 +364,6 @@ 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)', 'success', 5000); - GlobalNotificationActions.appendGlobalNotification(notification); - throw new Error('The session request failed', response); } }, diff --git a/js/components/edition.js b/js/components/edition.js index 3d2193ae..6bd096a4 100644 --- a/js/components/edition.js +++ b/js/components/edition.js @@ -493,11 +493,16 @@ let EditionFurtherDetails = React.createClass({ handleSuccess={this.showNotification} editable={editable} edition={this.props.edition} /> - + + + + ); From c6528d8999a52af7f71f3f08fd25847e9d9bb66b Mon Sep 17 00:00:00 2001 From: diminator Date: Tue, 30 Jun 2015 17:12:51 +0200 Subject: [PATCH 4/4] other_data : delete without cascade and show acl --- .../react_s3_fine_uploader.js | 8 +- js/components/edition.js | 83 ++++++++++--------- 2 files changed, 49 insertions(+), 42 deletions(-) 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 6bd096a4..ba6014ce 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}> @@ -493,16 +495,12 @@ let EditionFurtherDetails = React.createClass({ handleSuccess={this.showNotification} editable={editable} edition={this.props.edition} /> - - - - + ); @@ -518,34 +516,43 @@ let FileUploader = React.createClass({ }, render() { + if (!this.props.editable && this.props.edition.other_data === null){ + return null; + } return ( - +
+ + + +
+
); } });