diff --git a/gulpfile.js b/gulpfile.js index e570c2ff..fe7e75a8 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -69,7 +69,7 @@ gulp.task('js:build', function() { bundle(false); }); -gulp.task('serve', ['browser-sync', 'run-server', 'lint:watch', 'sass:build', 'sass:watch', 'copy'], function() { +gulp.task('serve', ['browser-sync', 'run-server', 'sass:build', 'sass:watch', 'copy'], function() { bundle(true); }); diff --git a/js/components/ascribe_forms/form.js b/js/components/ascribe_forms/form.js index b8ff1539..319214c1 100644 --- a/js/components/ascribe_forms/form.js +++ b/js/components/ascribe_forms/form.js @@ -137,9 +137,12 @@ let Form = React.createClass({ }); }, render() { - return ( -
+ {this.getErrors()} {this.renderChildren()} {this.getButtons()} diff --git a/js/components/ascribe_uploader/react_s3_fine_uploader.js b/js/components/ascribe_uploader/react_s3_fine_uploader.js index 4302b1ca..797ca0eb 100644 --- a/js/components/ascribe_uploader/react_s3_fine_uploader.js +++ b/js/components/ascribe_uploader/react_s3_fine_uploader.js @@ -118,7 +118,7 @@ var ReactS3FineUploader = React.createClass({ }, getCookie(name) { - console.log(document.cookie); + //console.log(document); let value = '; ' + document.cookie; let parts = value.split('; ' + name + '='); if (parts.length === 2) { @@ -126,31 +126,33 @@ var ReactS3FineUploader = React.createClass({ } }, requestKey(fileId) { + //console.log(this.getCookie('csrftoken')); let filename = this.state.uploader.getName(fileId); - let defer = new fineUploader.Promise(); - fetch(this.props.keyRoutine.url, { - method: 'post', - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - 'X-CSRFToken': this.getCookie('csrftoken') - }, - credentials: 'include', - body: JSON.stringify({ - 'filename': filename, - 'file_class': 'digitalwork' + return new Promise((resolve, reject) => { + fetch(this.props.keyRoutine.url, { + method: 'post', + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + 'X-CSRFToken': this.getCookie('csrftoken') + }, + credentials: 'include', + body: JSON.stringify({ + 'filename': filename, + 'file_class': 'digitalwork' + }) }) - }) - .then((res) => { - return res.json(); - }) - .then((res) =>{ - defer.success(res.key); - }) - .catch((err) => { - console.error(err); + .then((res) => { + return res.json(); + }) + .then((res) =>{ + resolve(res.key); + }) + .catch((err) => { + console.error(err); + reject(err); + }); }); - return defer; }, /* FineUploader specific callback function handlers */ diff --git a/js/components/login_container.js b/js/components/login_container.js index fcdf6523..8c149d8c 100644 --- a/js/components/login_container.js +++ b/js/components/login_container.js @@ -37,16 +37,27 @@ let LoginForm = React.createClass({ handleSuccess(){ let notification = new GlobalNotificationModel('Login successsful', 'success', 10000); GlobalNotificationActions.appendGlobalNotification(notification); - this.transitionTo('pieces'); + /*Taken from http://stackoverflow.com/a/14916411 */ + /* + We actually have to trick the Browser into showing the "save password" dialog + as Chrome expects the login page to be reloaded after the login. + Users on Stack Overflow claim this is a bug in chrome and should be fixed in the future. + Until then, we redirect the HARD way, but reloading the whole page using window.location + */ + window.location = '/collection'; }, + render() { return ( + } spinner={ @@ -61,6 +72,7 @@ let LoginForm = React.createClass({ type="email" placeholder="Enter your email" autoComplete="on" + name="username" required/>
diff --git a/js/components/register_piece.js b/js/components/register_piece.js index 384f0d23..693c43be 100644 --- a/js/components/register_piece.js +++ b/js/components/register_piece.js @@ -40,7 +40,7 @@ let RegisterPiece = React.createClass( { return data; }, handleChange(){ - this.setState({digital_work_key: this.refs.uploader.refs.fineuploader.state.filesToUpload[0].key}) + this.setState({digital_work_key: this.refs.uploader.refs.fineuploader.state.filesToUpload[0].key}); }, render() {