1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-30 13:41:57 +02:00

Merge remote-tracking branch 'remotes/origin/master' into AD-44-in-piece-detail-support-public-not

This commit is contained in:
ddejongh 2015-06-16 20:37:01 +02:00
commit 37dfde83b0
3 changed files with 14 additions and 5 deletions

View File

@ -3,6 +3,7 @@
import React from 'react';
import InjectInHeadMixin from '../../mixins/inject_in_head_mixin';
import Panel from 'react-bootstrap/lib/Panel';
import AppConstants from '../../constants/application_constants.js';
/**
* This is the component that implements display-specific functionality.
@ -46,8 +47,8 @@ let Image = React.createClass({
this.inject('http://code.jquery.com/jquery-2.1.4.min.js')
.then(() =>
Promise.all([
this.inject('/static/thirdparty/shmui/shmui.css'),
this.inject('/static/thirdparty/shmui/jquery.shmui.js')
this.inject(AppConstants.baseUrl + 'static/thirdparty/shmui/shmui.css'),
this.inject(AppConstants.baseUrl + 'static/thirdparty/shmui/jquery.shmui.js')
]).then(() => { window.jQuery('.shmui-ascribe').shmui(); }));
},

View File

@ -76,7 +76,10 @@ class Requests {
request(verb, url, options) {
options = options || {};
let merged = this._merge(this.httpOptions, options);
this.httpOptions.headers['X-CSRFToken'] = getCookie('csrftoken');
let csrftoken = getCookie('csrftoken');
if (csrftoken) {
merged.headers['X-CSRFToken'] = csrftoken;
}
merged.method = verb;
return fetch(url, merged)
.then(this.unpackResponse)

View File

@ -12,14 +12,19 @@ app.use(baseUrl + 'static/js', express.static(__dirname + '/build/js'));
app.use(baseUrl + 'static/img', express.static(__dirname + '/build/img'));
app.use(baseUrl + 'static/css', express.static(__dirname + '/build/css'));
app.use(baseUrl + 'static/fonts', express.static(__dirname + '/build/fonts'));
app.use(baseUrl + 'static/thirdparty/', express.static(__dirname + '/node_modules'));
app.use(baseUrl + 'static/thirdparty', express.static(__dirname + '/node_modules'));
app.get(/.*/, function(req, res) {
console.log('%s %s', req.method, req.path);
res.sendFile(__dirname + '/build/index.html');
});
if (require.main === module) {
app.listen(process.env.PORT || 4000);
var port = process.env.PORT || 4000;
console.log('Starting Onion server on port', port,
'baseUrl is set to', baseUrl);
app.listen(port);
}
module.exports.app = app;