2015-06-17 17:48:52 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
|
2015-06-19 11:01:06 +02:00
|
|
|
import AppConstants from '../constants/application_constants';
|
|
|
|
import fineUploader from 'fineUploader';
|
|
|
|
|
2015-06-22 10:50:22 +02:00
|
|
|
import Router from 'react-router';
|
|
|
|
|
|
|
|
import GlobalNotificationModel from '../models/global_notification_model';
|
|
|
|
import GlobalNotificationActions from '../actions/global_notification_actions';
|
|
|
|
|
|
|
|
import Form from './ascribe_forms/form';
|
|
|
|
import Property from './ascribe_forms/property';
|
|
|
|
|
|
|
|
import apiUrls from '../constants/api_urls';
|
|
|
|
|
2015-06-19 11:01:06 +02:00
|
|
|
import ReactS3FineUploader from 'ReactS3FineUploader';
|
|
|
|
|
2015-06-17 17:48:52 +02:00
|
|
|
let RegisterPiece = React.createClass( {
|
|
|
|
render() {
|
2015-06-20 16:43:18 +02:00
|
|
|
|
2015-06-17 17:48:52 +02:00
|
|
|
return (
|
2015-06-22 10:50:22 +02:00
|
|
|
<div className="row ascribe-row">
|
|
|
|
<div className="col-md-6">
|
|
|
|
<FileUploader />
|
|
|
|
</div>
|
|
|
|
<div className="col-md-6">
|
|
|
|
<LoginForm />
|
2015-06-19 11:01:06 +02:00
|
|
|
</div>
|
2015-06-22 10:50:22 +02:00
|
|
|
</div>
|
2015-06-17 17:48:52 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-06-22 10:50:22 +02:00
|
|
|
|
|
|
|
let FileUploader = React.createClass( {
|
|
|
|
render() {
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ReactS3FineUploader
|
|
|
|
keyRoutine={{
|
|
|
|
url: AppConstants.serverUrl + 's3/key/',
|
|
|
|
fileClass: 'digitalwork'
|
|
|
|
}}
|
|
|
|
autoUpload={true}
|
|
|
|
debug={false}
|
|
|
|
objectProperties={{
|
|
|
|
acl: 'public-read',
|
|
|
|
bucket: 'ascribe0'
|
|
|
|
}}
|
|
|
|
request={{
|
|
|
|
endpoint: 'https://ascribe0.s3.amazonaws.com',
|
|
|
|
accessKey: 'AKIAIVCZJ33WSCBQ3QDA'
|
|
|
|
}}
|
|
|
|
signature={{
|
|
|
|
endpoint: AppConstants.serverUrl + 's3/signature/'
|
|
|
|
}}
|
|
|
|
uploadSuccess={{
|
|
|
|
params: {
|
|
|
|
isBrowserPreviewCapable: fineUploader.supportedFeatures.imagePreviews
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
cors={{
|
|
|
|
expected: true
|
|
|
|
}}
|
|
|
|
chunking={{
|
|
|
|
enabled: true
|
|
|
|
}}
|
|
|
|
resume={{
|
|
|
|
enabled: true
|
|
|
|
}}
|
|
|
|
retry={{
|
|
|
|
enableAuto: false
|
|
|
|
}}
|
|
|
|
deleteFile={{
|
|
|
|
enabled: true,
|
|
|
|
method: 'DELETE',
|
|
|
|
endpoint: AppConstants.serverUrl + 's3/delete'
|
|
|
|
}}
|
|
|
|
validation={{
|
|
|
|
itemLimit: 100000,
|
|
|
|
sizeLimit: '25000000000'
|
|
|
|
}}
|
|
|
|
session={{
|
|
|
|
endpoint: null
|
|
|
|
}}
|
|
|
|
messages={{
|
|
|
|
unsupportedBrowser: '<h3>Upload is not functional in IE7 as IE7 has no support for CORS!</h3>'
|
|
|
|
}}
|
|
|
|
formatFileName={(name) => {// fix maybe
|
|
|
|
if (name !== undefined && name.length > 26) {
|
|
|
|
name = name.slice(0, 15) + '...' + name.slice(-15);
|
|
|
|
}
|
|
|
|
return name;
|
|
|
|
}}
|
|
|
|
multiple={true}/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
let LoginForm = React.createClass({
|
|
|
|
mixins: [Router.Navigation],
|
|
|
|
|
|
|
|
|
|
|
|
handleSuccess(){
|
|
|
|
let notification = new GlobalNotificationModel('Login successsful', 'success', 10000);
|
|
|
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
|
|
|
this.transitionTo('pieces');
|
|
|
|
|
|
|
|
},
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<Form
|
|
|
|
url={apiUrls.users_login}
|
|
|
|
handleSuccess={this.handleSuccess}
|
|
|
|
buttons={
|
|
|
|
<button type="submit" className="btn ascribe-btn ascribe-btn-login">
|
|
|
|
Log in to ascribe
|
|
|
|
</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"
|
|
|
|
autoComplete="on"
|
|
|
|
required/>
|
|
|
|
</Property>
|
|
|
|
<Property
|
|
|
|
name='password'
|
|
|
|
label="Password">
|
|
|
|
<input
|
|
|
|
type="password"
|
|
|
|
placeholder="Enter your password"
|
|
|
|
autoComplete="on"
|
|
|
|
required/>
|
|
|
|
</Property>
|
|
|
|
<hr />
|
|
|
|
<div className="ascribe-login-text">
|
|
|
|
Not an ascribe user? Sign up...<br/>
|
|
|
|
Forgot my password? Rescue me...
|
|
|
|
</div>
|
|
|
|
</Form>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
2015-06-19 14:05:56 +02:00
|
|
|
export default RegisterPiece;
|