diff --git a/.babelrc b/.babelrc index f8a7a65..203e642 100644 --- a/.babelrc +++ b/.babelrc @@ -1,3 +1,3 @@ { - "presets": ["react", "es2015", "stage-2"] + "presets": ["react", "es2015"] } \ No newline at end of file diff --git a/distributionviewer/core/__init__.py b/distributionviewer/core/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/distributionviewer/core/static/css/distributionviewer.styl b/distributionviewer/core/static/css/distributionviewer.styl new file mode 100644 index 0000000..e69de29 diff --git a/distributionviewer/core/static/js/app/app.js b/distributionviewer/core/static/js/app/app.js new file mode 100644 index 0000000..14a089a --- /dev/null +++ b/distributionviewer/core/static/js/app/app.js @@ -0,0 +1,5 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import router from './router'; + +ReactDOM.render(router, document.getElementById('root')); diff --git a/distributionviewer/core/static/js/app/components/containers/.exists b/distributionviewer/core/static/js/app/components/containers/.exists new file mode 100644 index 0000000..e69de29 diff --git a/distributionviewer/core/static/js/app/components/home.js b/distributionviewer/core/static/js/app/components/home.js new file mode 100644 index 0000000..a1dfd46 --- /dev/null +++ b/distributionviewer/core/static/js/app/components/home.js @@ -0,0 +1,11 @@ +import React from 'react'; + +const Home = React.createClass({ + render: function() { + return ( +

Distribution Viewer

+ ); + } +}); + +export default Home; diff --git a/distributionviewer/core/static/js/app/components/layouts/main-layout.js b/distributionviewer/core/static/js/app/components/layouts/main-layout.js new file mode 100644 index 0000000..71a6cdb --- /dev/null +++ b/distributionviewer/core/static/js/app/components/layouts/main-layout.js @@ -0,0 +1,12 @@ +import React from 'react'; + +export default function(props) { + return ( +
+
+
+ {props.children} +
+
+ ); +} diff --git a/distributionviewer/core/static/js/app/components/views/.exists b/distributionviewer/core/static/js/app/components/views/.exists new file mode 100644 index 0000000..e69de29 diff --git a/distributionviewer/core/static/js/app/router.js b/distributionviewer/core/static/js/app/router.js new file mode 100644 index 0000000..c5ba961 --- /dev/null +++ b/distributionviewer/core/static/js/app/router.js @@ -0,0 +1,16 @@ +import React from 'react'; +import { Router, Route, browserHistory } from 'react-router'; + +// Layouts +import MainLayout from './components/layouts/main-layout'; + +// Pages +import Home from './components/home'; + +export default ( + + + + + +); diff --git a/distributionviewer/core/templates/distributionviewer/index.html b/distributionviewer/core/templates/distributionviewer/index.html new file mode 100644 index 0000000..babe3f0 --- /dev/null +++ b/distributionviewer/core/templates/distributionviewer/index.html @@ -0,0 +1,13 @@ +{% load staticfiles %} + + + + + Distribution Viewer + + + +
+ + + diff --git a/distributionviewer/settings.py b/distributionviewer/settings.py index 3be5aa9..c70e55f 100644 --- a/distributionviewer/settings.py +++ b/distributionviewer/settings.py @@ -34,6 +34,7 @@ INSTALLED_APPS = [ 'django.contrib.staticfiles', 'rest_framework', 'distributionviewer.api', + 'distributionviewer.core', ] MIDDLEWARE_CLASSES = [ @@ -62,7 +63,6 @@ TEMPLATES = [ 'django.template.context_processors.static', 'django.template.context_processors.tz', 'django.contrib.messages.context_processors.messages', - 'distributionviewer.studies.context_processors.google_auth_key', ], } } @@ -109,7 +109,7 @@ REST_FRAMEWORK = { 'DEFAULT_RENDERER_CLASSES': ( 'rest_framework.renderers.JSONRenderer', ), - + 'DEFAULT_PERMISSION_CLASSES': ( 'distributionviewer.authentication.OptionsOrIsAuthenticated', ), diff --git a/gulpfile.js b/gulpfile.js index 9b65bca..9b28fc8 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -10,12 +10,13 @@ var concat = require('gulp-concat'); require('es6-promise').polyfill(); var ROOT = './'; +var JS = path.resolve(ROOT, 'distributionviewer/core/static/js'); var CSS = path.resolve(ROOT, 'distributionviewer/core/static/css'); // Webpack gulp.task('webpack', function() { return gulp.src('./distributionviewer/core/static/js/app/app.js') - .pipe(webpack(require('./distributionviewer/core/static/js/webpack.config.js'))) + .pipe(webpack(require('./webpack.config.js'))) .pipe(gulp.dest('./')); }); @@ -31,6 +32,7 @@ gulp.task('css', function() { }); gulp.task('watch', ['build'], function() { + gulp.watch([path.resolve(JS, '**/*.js'), '!' + path.resolve(JS, 'bundle.js')], ['webpack']); gulp.watch(path.resolve(CSS, '**/*.styl'), ['css']); }); diff --git a/package.json b/package.json index 34398b5..b8841bb 100644 --- a/package.json +++ b/package.json @@ -5,12 +5,10 @@ "postinstall": "gulp build" }, "dependencies": { - "axios": "^0.9.1", "babel-core": "^6.7.7", "babel-loader": "^6.2.4", "babel-preset-es2015": "^6.6.0", "babel-preset-react": "^6.5.0", - "babel-preset-stage-2": "^6.5.0", "browser-sync": "^2.12.3", "es6-promise": "^3.1.2", "gulp": "^3.9.1", @@ -20,14 +18,9 @@ "nib": "^1.1.0", "react": "^15.0.1", "react-dom": "^15.0.1", - "react-redux": "^4.4.5", "react-router": "^2.0.0", - "redux": "^3.4.0", "webpack-stream": "^3.1.0" }, "devDependencies": { - "babel-cli": "^6.7.7", - "foreman": "^1.4.1", - "stylus": "^0.54.2" } } diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..71bc927 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,18 @@ +var path = require('path'); + +module.exports = { + entry: './distributionviewer/core/static/js/app/app.js', + output: { + filename: './distributionviewer/core/static/js/bundle.js', + sourceMapFilename: './distributionviewer/core/static/js/bundle.map' + }, + devtool: '#source-map', + module: { + loaders: [ + { + loader: 'babel', + exclude: /node_modules/ + } + ] + } +};