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:
commit
2cbfd2d8ee
@ -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
|
||||||
============
|
============
|
||||||
|
|
||||||
@ -111,4 +117,4 @@ Moar stuff
|
|||||||
- [24ways.org: JavaScript Modules the ES6 Way](http://24ways.org/2014/javascript-modules-the-es6-way/)
|
- [24ways.org: JavaScript Modules the ES6 Way](http://24ways.org/2014/javascript-modules-the-es6-way/)
|
||||||
- [Babel: Learn ES6](https://babeljs.io/docs/learn-es6/)
|
- [Babel: Learn ES6](https://babeljs.io/docs/learn-es6/)
|
||||||
- [egghead's awesome reactjs and flux tutorials](https://egghead.io/)
|
- [egghead's awesome reactjs and flux tutorials](https://egghead.io/)
|
||||||
- [Crockford's genious Javascript: The Good Parts (Tim has a copy)](http://www.amazon.de/JavaScript-Parts-Working-Shallow-Grain/dp/0596517742)
|
- [Crockford's genious Javascript: The Good Parts (Tim has a copy)](http://www.amazon.de/JavaScript-Parts-Working-Shallow-Grain/dp/0596517742)
|
@ -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);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -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()}
|
||||||
|
@ -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,31 +126,33 @@ 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: {
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'X-CSRFToken': this.getCookie('csrftoken')
|
'X-CSRFToken': this.getCookie('csrftoken')
|
||||||
},
|
},
|
||||||
credentials: 'include',
|
credentials: 'include',
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
'filename': filename,
|
'filename': filename,
|
||||||
'file_class': 'digitalwork'
|
'file_class': 'digitalwork'
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
.then((res) => {
|
||||||
.then((res) => {
|
return res.json();
|
||||||
return res.json();
|
})
|
||||||
})
|
.then((res) =>{
|
||||||
.then((res) =>{
|
resolve(res.key);
|
||||||
defer.success(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 */
|
||||||
|
@ -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 />
|
||||||
|
64
sass/ascribe_react_s3_fineuploader.scss
Normal file
64
sass/ascribe_react_s3_fineuploader.scss
Normal 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;
|
||||||
|
}
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user