From c6097fe5c2e7c82da8e1c676ca48a4d44cbea8fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Mon, 18 May 2015 13:43:42 +0200 Subject: [PATCH] outsourced routes to separate file and created a boilerplate action and store --- js/app.js | 2 +- js/components/actions/artwork_list_actions.js | 11 +++++++++++ js/components/ascribe_app.js | 2 +- js/components/stores/artwork_list_store.js | 6 +++++- js/routes.js | 7 +++++-- 5 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 js/components/actions/artwork_list_actions.js diff --git a/js/app.js b/js/app.js index 1b468524..db30113e 100644 --- a/js/app.js +++ b/js/app.js @@ -4,7 +4,7 @@ import React from 'react'; import Router from 'react-router'; import AscribeApp from './components/ascribe_app'; -import routes from '.routes'; +import routes from './routes'; Router.run(routes, Router.HashLocation, (AscribeApp) => { React.render( diff --git a/js/components/actions/artwork_list_actions.js b/js/components/actions/artwork_list_actions.js new file mode 100644 index 00000000..615ca62d --- /dev/null +++ b/js/components/actions/artwork_list_actions.js @@ -0,0 +1,11 @@ +import alt from '../alt'; + +class ArtworkListActions { + constructor() { + this.generateActions( + 'updateArtworks' + ); + }; +}; + +export default alt.createAction(ArtworkListActions); \ No newline at end of file diff --git a/js/components/ascribe_app.js b/js/components/ascribe_app.js index 4bc41224..8794e719 100644 --- a/js/components/ascribe_app.js +++ b/js/components/ascribe_app.js @@ -4,7 +4,7 @@ import Router from 'react-router'; var RouteHandler = Router.RouteHandler; class AscribeApp extends React.Component { - render () { + render() { return (

ascribe all the things!

diff --git a/js/components/stores/artwork_list_store.js b/js/components/stores/artwork_list_store.js index 37c924d4..db08be54 100644 --- a/js/components/stores/artwork_list_store.js +++ b/js/components/stores/artwork_list_store.js @@ -1,5 +1,9 @@ +import alt from '../alt'; + class ArtworkListStore { constructor() { this.artworkList = []; } -}; \ No newline at end of file +}; + +export default alt.createStore(ArtworkListStore); \ No newline at end of file diff --git a/js/routes.js b/js/routes.js index 0587cff1..04d7158a 100644 --- a/js/routes.js +++ b/js/routes.js @@ -1,7 +1,8 @@ +import React from 'react'; import Router from 'react-router'; import AscribeApp from './components/ascribe_app'; -import ArtworkList from './components/artwork_list'; +import ArtworkList from './components/gui/artwork_list'; var Route = Router.Route; @@ -9,4 +10,6 @@ var routes = ( -); \ No newline at end of file +); + +export default routes; \ No newline at end of file