1
0
mirror of https://github.com/ascribe/onion.git synced 2024-09-28 03:58:55 +02:00

Merge remote-tracking branch 'remotes/origin/master' into AD-504-revive-coa-for-new-frontend

This commit is contained in:
diminator 2015-06-24 17:51:38 +02:00
commit 2cbfd2d8ee
7 changed files with 118 additions and 29 deletions

View File

@ -91,6 +91,12 @@ Error: watch ENOSPC
``` ```
A: Use `npm dedupe` to remove duplicates in npm. This might fix that you're not [running out of watchers in your system (read the comments)](http://stackoverflow.com/a/17437601/1263876). A: Use `npm dedupe` to remove duplicates in npm. This might fix that you're not [running out of watchers in your system (read the comments)](http://stackoverflow.com/a/17437601/1263876).
Q: How can I use a local copy of SPOOL and Onion?
A: Easily by starting the your gulp process with the following command:
```
ONION_BASE_URL='/' ONION_API_ENDPOINT='http://localhost:8000/api/' ONION_SERVER_URL='http://localhost:8000/' gulp serve
```
Reading list Reading list
============ ============

View File

@ -69,7 +69,7 @@ gulp.task('js:build', function() {
bundle(false); 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); bundle(true);
}); });

View File

@ -137,9 +137,12 @@ let Form = React.createClass({
}); });
}, },
render() { render() {
return ( return (
<form role="form" className="ascribe-form" onSubmit={this.submit} autoComplete="on"> <form
role="form"
className="ascribe-form"
onSubmit={this.submit}
autoComplete="on">
{this.getErrors()} {this.getErrors()}
{this.renderChildren()} {this.renderChildren()}
{this.getButtons()} {this.getButtons()}

View File

@ -118,7 +118,7 @@ var ReactS3FineUploader = React.createClass({
}, },
getCookie(name) { getCookie(name) {
console.log(document.cookie); //console.log(document);
let value = '; ' + document.cookie; let value = '; ' + document.cookie;
let parts = value.split('; ' + name + '='); let parts = value.split('; ' + name + '=');
if (parts.length === 2) { if (parts.length === 2) {
@ -126,8 +126,9 @@ var ReactS3FineUploader = React.createClass({
} }
}, },
requestKey(fileId) { requestKey(fileId) {
//console.log(this.getCookie('csrftoken'));
let filename = this.state.uploader.getName(fileId); let filename = this.state.uploader.getName(fileId);
let defer = new fineUploader.Promise(); return new Promise((resolve, reject) => {
fetch(this.props.keyRoutine.url, { fetch(this.props.keyRoutine.url, {
method: 'post', method: 'post',
headers: { headers: {
@ -145,12 +146,13 @@ var ReactS3FineUploader = React.createClass({
return res.json(); return res.json();
}) })
.then((res) =>{ .then((res) =>{
defer.success(res.key); resolve(res.key);
}) })
.catch((err) => { .catch((err) => {
console.error(err); console.error(err);
reject(err);
});
}); });
return defer;
}, },
/* FineUploader specific callback function handlers */ /* FineUploader specific callback function handlers */

View File

@ -37,16 +37,27 @@ let LoginForm = React.createClass({
handleSuccess(){ handleSuccess(){
let notification = new GlobalNotificationModel('Login successsful', 'success', 10000); let notification = new GlobalNotificationModel('Login successsful', 'success', 10000);
GlobalNotificationActions.appendGlobalNotification(notification); 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() { render() {
return ( return (
<Form <Form
ref="loginForm"
url={apiUrls.users_login} url={apiUrls.users_login}
handleSuccess={this.handleSuccess} handleSuccess={this.handleSuccess}
buttons={ buttons={
<button type="submit" className="btn ascribe-btn ascribe-btn-login"> <button
type="submit"
className="btn ascribe-btn ascribe-btn-login">
Log in to ascribe Log in to ascribe
</button>} </button>}
spinner={ spinner={
@ -61,6 +72,7 @@ let LoginForm = React.createClass({
type="email" type="email"
placeholder="Enter your email" placeholder="Enter your email"
autoComplete="on" autoComplete="on"
name="username"
required/> required/>
</Property> </Property>
<Property <Property
@ -70,6 +82,7 @@ let LoginForm = React.createClass({
type="password" type="password"
placeholder="Enter your password" placeholder="Enter your password"
autoComplete="on" autoComplete="on"
name="password"
required/> required/>
</Property> </Property>
<hr /> <hr />

View File

@ -0,0 +1,64 @@
.file-drag-and-drop {
display: table-cell;
outline: 1px dashed #616161;
cursor: pointer;
vertical-align: middle;
text-align: center;
height:208px;
width: 672px;
background-color: #FAFAFA;
transition: .1s linear background-color;
}
.file-drag-and-drop:hover {
background-color: rgba(72, 218, 203, 0.2);
}
.file-drag-and-drop > span {
font-size: 1.5em;
}
.has-files {
text-align: left;
padding: 3em 0 0 0;
}
.file-drag-and-drop-position {
display: inline-block;
margin: 0 0 3em 3em;
float:left;
}
.file-drag-and-drop-preview-table-wrapper {
display: table;
height:94px;
width:104px;
}
.file-drag-and-drop-preview {
overflow:hidden;
cursor: default;
background-color: #EEEEEE;
border: 1px solid #616161;
}
.file-drag-and-drop-preview-image {
display: table;
height:104px;
width:104px;
overflow:hidden;
border: 1px solid #616161;
}
.file-drag-and-drop-preview-other {
display: table-cell;
text-align: center;
vertical-align: middle;
}
.file-drag-and-drop-preview-other span {
font-size: 1.1em;
display: block;
margin-top: -10px;
}

View File

@ -22,6 +22,7 @@ $BASE_URL: '<%= BASE_URL %>';
@import 'ascribe_piece_register'; @import 'ascribe_piece_register';
@import 'offset_right'; @import 'offset_right';
@import 'ascribe_settings'; @import 'ascribe_settings';
@import 'ascribe_react_s3_fineuploader';
body { body {
background-color: #FDFDFD; background-color: #FDFDFD;