Skip to content

Commit 9af1da2

Browse files
committed
Improved folder structure (#7) + Dependencies update
1 parent 5080520 commit 9af1da2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+145
-166
lines changed

.jshintrc

-20
This file was deleted.

TODO.txt

-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ Accessibility
77

88
Small:
99
- Use superagent for requests
10-
- Use 'aug' instead of $.extend
1110
- Get rid of jquery (thus replace foundation menu),
1211
check http://medialoot.com/blog/how-to-create-a-responsive-navigation-menu-using-only-css/

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"Wilbert van de Ridder <wilbert.ridder@gmail.com>"
77
],
88
"description": "Community site SPA Proof of Concept based on ReactJS",
9-
"main": "src/app.js",
9+
"main": "client/src/app.js",
1010
"moduleType": [
1111
"amd"
1212
],
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/actions/resourceActions.js client/src/actions/resourceActions.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use strict";
22
var reflux = require("reflux");
3-
var dataInterface = require("client/core/dataInterface");
3+
var dataInterface = require("local/core/dataInterface");
44

55
// Create actions
66
var actions = reflux.createActions([
@@ -27,7 +27,7 @@ var actions = reflux.createActions([
2727

2828
// Action handlers
2929
actions.loadResource.listen(function(type, id, childrenType) {
30-
dataInterface.get("/api/" + [type, id, childrenType].filter(function(e){return e;}).join("/"))
30+
dataInterface.get("/api/" + [type, id, childrenType].filter(function(e){ return e; }).join("/"))
3131
.then(function(data) {
3232
actions.loadResourceSuccess(type, id, childrenType, data);
3333
})
@@ -37,14 +37,14 @@ actions.loadResource.listen(function(type, id, childrenType) {
3737
});
3838

3939
actions.createResource.listen(function(type, data, navigateTo) {
40-
dataInterface.post("/api/" + [type].filter(function(e){return e;}).join("/"), data)
40+
dataInterface.post("/api/" + [type].filter(function(e){ return e; }).join("/"), data)
4141
.then(function(resultData) {
4242
actions.createResourceSuccess(type, resultData);
4343

4444
// Navigate to resource
4545
if (navigateTo) {
46-
var router = require("client/core/router").router;
47-
var urlCreator = require("client/helper/resourceUrlCreator");
46+
var router = require("local/core/router").router;
47+
var urlCreator = require("local/helper/resourceUrlCreator");
4848
var url = urlCreator(type, resultData);
4949
router.transitionTo(url);
5050
}

src/actions/sessionActions.js client/src/actions/sessionActions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use strict";
22
var reflux = require("reflux");
3-
var dataInterface = require("client/core/dataInterface");
3+
var dataInterface = require("local/core/dataInterface");
44

55
// Create actions
66
var actions = reflux.createActions([

src/app.js client/src/app.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Reflux.nextTick(require("setimmediate2"));
99
Reflux.PublisherMethods.triggerAsync = Reflux.PublisherMethods.trigger;
1010

1111
// Data interface
12-
var DI = require("client/core/dataInterface");
12+
var DI = require("local/core/dataInterface");
1313

1414
module.exports = {
1515
init: function() {
@@ -18,19 +18,19 @@ module.exports = {
1818
renderToDom: function(water) {
1919
// Check if initial data is available
2020
if (water) {
21-
require("client/core/syncDataProvider").hydrate(water);
21+
require("local/core/syncDataProvider").hydrate(water);
2222
}
2323

2424
// React tap event plugin
2525
require("react-tap-event-plugin")();
2626

2727
// Init routes
28-
var router = require("client/core/router");
28+
var router = require("local/core/router");
2929

3030
// Init stores
31-
require("client/stores/session");
32-
require("client/stores/question");
33-
require("client/stores/questions");
31+
require("local/stores/session");
32+
require("local/stores/question");
33+
require("local/stores/questions");
3434

3535
// Temporary tap event plugin
3636
var injectTapEventPlugin = require("react-tap-event-plugin");
@@ -40,22 +40,22 @@ module.exports = {
4040
router.renderToDom();
4141

4242
// Clear initial data
43-
require("client/core/syncDataProvider").dry();
43+
require("local/core/syncDataProvider").dry();
4444
},
4545
renderToString: function(path, water, profile) {
4646
// Init data interface profiler
4747
DI.enableProfiling(profile);
4848

4949
// Hydrate data
50-
require("client/core/syncDataProvider").hydrate(water || {});
50+
require("local/core/syncDataProvider").hydrate(water || {});
5151

5252
// Init stores
53-
require("client/stores/session");
54-
require("client/stores/question");
55-
require("client/stores/questions");
53+
require("local/stores/session");
54+
require("local/stores/question");
55+
require("local/stores/questions");
5656

5757
// Init routes
58-
var router = require("client/core/router");
58+
var router = require("local/core/router");
5959

6060
// Render html body
6161
var htmlBody = router.renderToString(path || "/");
File renamed without changes.

src/components/core/breadcrumbs.jsx client/src/components/core/breadcrumbs.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ var React = require("react");
33
var Router = require("react-router");
44
var Link = Router.Link;
55
var mui = require("material-ui");
6-
var NavigationStore = require("client/stores/navigation");
6+
var NavigationStore = require("local/stores/navigation");
77
var ImmutableRenderMixin = require("react-immutable-render-mixin");
8-
var connect= require("client/libraries/tmp_connect");
8+
var connect = require("local/libraries/tmp_connect");
99

1010
var Breadcrumbs = React.createClass({
1111
mixins: [connect(NavigationStore), ImmutableRenderMixin],

src/components/core/documentTitle.jsx client/src/components/core/documentTitle.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use strict";
22
var React = require("react");
33
var DocTitle = require("react-document-title");
4-
var navigationActions = require("client/actions/navigationActions");
4+
var navigationActions = require("local/actions/navigationActions");
55

66
var DocumentTitle = React.createClass({
77
propTypes: {
File renamed without changes.

src/components/core/header.jsx client/src/components/core/header.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var React = require("react");
33
var Router = require("react-router");
44
var Navigation = require("./navigation.jsx");
55
var Breadcrumbs = require("./breadcrumbs.jsx");
6-
var HeaderSession = require("client/components/user/headerSession.jsx");
6+
var HeaderSession = require("local/components/user/headerSession.jsx");
77
var Link = Router.Link;
88

99
var Header = React.createClass({

src/components/core/navLink.jsx client/src/components/core/navLink.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
var React = require("react");
33
var Router = require("react-router");
44
var classSet = require("react/lib/cx");
5-
var NavigationStore = require("client/stores/navigation");
5+
var NavigationStore = require("local/stores/navigation");
66
var State = Router.State;
77
var Link = Router.Link;
8-
var connect= require("client/libraries/tmp_connect");
8+
var connect = require("local/libraries/tmp_connect");
99

1010
var NavigationLink = React.createClass({
1111
mixins: [State, connect(NavigationStore)],
File renamed without changes.

src/components/core/navigation.jsx client/src/components/core/navigation.jsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
var React = require("react");
33
var Mui = require("material-ui");
44
var NavLink = require("./navLink.jsx");
5-
var connect= require("client/libraries/tmp_connect");
6-
var sessionStore = require("client/stores/session");
5+
var connect = require("local/libraries/tmp_connect");
6+
var sessionStore = require("local/stores/session");
77
var ImmutableRenderMixin = require("react-immutable-render-mixin");
8-
var LogoutLink = require("client/components/user/logoutLink.jsx");
9-
var devSettings = require("client/helper/devSettings");
8+
var LogoutLink = require("local/components/user/logoutLink.jsx");
9+
var devSettings = require("local/helper/devSettings");
1010

1111

1212
var Navigation = React.createClass({

src/components/core/notfound.jsx client/src/components/core/notfound.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use strict";
22
var React = require("react");
3-
var DocumentTitle = require("client/components/core/documentTitle");
3+
var DocumentTitle = require("local/components/core/documentTitle");
44

55
var NotFound = React.createClass({
66
render: function() {

src/components/discussions/discussions.jsx client/src/components/discussions/discussions.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use strict";
22
var React = require("react");
33
var mui = require("material-ui");
4-
var DocumentTitle = require("client/components/core/documentTitle.jsx");
4+
var DocumentTitle = require("local/components/core/documentTitle.jsx");
55

66
var Discussions = React.createClass({
77
render: function() {

src/components/markdown/editor.jsx client/src/components/markdown/editor.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use strict";
22
var React = require("react");
33
var mui = require("material-ui");
4-
var MarkdownViewer = require("client/components/markdown/viewer.jsx");
4+
var MarkdownViewer = require("local/components/markdown/viewer.jsx");
55
var Spinner = require("react-spinner");
66

77
var MaterialUiMarkdownEditor = React.createClass({

src/components/markdown/viewer.jsx client/src/components/markdown/viewer.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use strict";
22
var React = require("react");
3-
var Markdown = require("../markdown/custom-md.jsx");
3+
var Markdown = require("./custom-md.jsx");
44
var mdParser = Markdown.parse;
55
var mdOutput = Markdown.output;
66

src/components/pages/about.jsx client/src/components/pages/about.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use strict";
22
var React = require("react");
3-
var DocumentTitle = require("client/components/core/documentTitle.jsx");
4-
var MarkdownViewer = require("client/components/markdown/viewer.jsx");
3+
var DocumentTitle = require("local/components/core/documentTitle.jsx");
4+
var MarkdownViewer = require("local/components/markdown/viewer.jsx");
55

66
var aboutMarkdown = "[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/WRidder/react-spa?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)\n[![Build Status](https://travis-ci.org/WRidder/react-spa.svg?branch=master)](https://travis-ci.org/WRidder/react-spa)\n\nA Proof of Concept real-time single page application based on React and (Re)flux to discover best practices regarding a multitude of use cases. Contains a simple server with in-memory database in `./server`.\n\n[**Demo on Heroku**](http://react-spa.herokuapp.com/) \n(Automatically deployed from this repository on travis build)\n\n### Installation\n#### Just running the demo\n1. Run `$ npm install` in the ./server directory\n2. Start the server in ./server using `$ node src/server.js`. Should open a port on 8080.\n3. Navigate your browser to http://localhost:8080.\n\n#### For developers\n1. Run `$ npm install` in the base and in the ./server directory\n2. Run `$ bower install` in the base directory\n3. Start the server in ./server using `$ node src/server.js`. Should open a port on 8080.\n4. **[optional]** Install gulp globally using `npm install -g gulp`\n5. Run `$ gulp` in the base directory. This will watch for file changes and build when necessary.\n6. Navigate your browser to http://localhost:8080; will reload on client changes.\n\nTested using npm 2.1.0 and node 0.10.33\n\n### Current state\n* Discovery\n* **Proof of concept**\n* Refactoring\n* Stabilizing\n\n### Goal\nCreate a more advanced example (w.r.t. your average TODO app) of creating a SPA using ReactJS. Initially as a personal exercise to go *through the mud* once while hoping to share new insights gained during the process and discuss various approaches. \n\nThis will be by no means a production ready application. Objectives and goals are subject to change.\n\n#### Primary objectives\n* Find sensible approaches to using reactjs with (re)flux\n* Scalable solutions (both in size and regarding developers)\n* Isomorphic application\n* Tests (unit, integration and functional) for all essential components\n* Build methods\n* Realtime connections\n* File/folder layout\n\n#### Secondary objectives\n* Load modules on demand\n* SEO \n* Accessibility\n\n### Application design\n#### Features\n* User login and registration\n* Forum-like discussions\n* Realtime connections\n* Stackoverflow-like questions\n* Chat\n* Updates\n\n#### Roles\n* Guest\n * Can view public pages\n * Can login\n * Can create account\n* User\n * Can view restricted pages\n * Can create questions, discussions and comments. \n * Can delete own comments\n* Moderator\n * Can edit/delete questions, discussions and comments from other users\n* Administrator\n * Can access adminstrative area\n * Can list/disable/remove users\n\n#### Layout\n**Home page**\n```\n\n+---------------------------------------------------------------------------+\n| Logo Account Updates(5) |\n| +----------+ +-----------+ +-------------+ +-------------+ +-----------+ |\n| | Home | | Questions | | Discussions | | About | | Chat | |\n| +----------+ +-----------+ +-------------+ +-------------+ +-----------+ |\n| |\n+---------------------------------------------------------------------------+\n| Homepage |\n| |\n| List of updates |\n| |\n+---------------------------------------------------------------------------+\n|(c) notice |\n+---------------------------------------------------------------------------+\n```\n\n### Libraries\n* [ReactJS](https://facebook.github.io/react/)\n* [Reflux](https://github.com/spoike/refluxjs)\n* [React-router](https://github.com/rackt/react-router/)\n* [ImmutableJS](https://github.com/facebook/immutable-js)\n* [Material-ui](https://github.com/callemall/material-ui)\n* [SocketIO](http://socket.io/)\n\n### Foundations\n* [React starter kit](https://github.com/kriasoft/react-starter-kit)\n\n### Resources\n#### Blogs\n* [krawaller.se](http://blog.krawaller.se/)\n* [spoike.ghost.io](http://spoike.ghost.io/)\n\n#### Discussions\n* [Google ReactJS group](https://groups.google.com/forum/#!forum/reactjs)\n* [ReactJS subreddit](https://www.reddit.com/r/reactjs/search?q=reactjs&sort=relevance&restrict_sr=on&t=all)\n\n#### Books\n* [Developing a React.js Edge](http://shop.oreilly.com/product/9781939902122.do)\n\n### Changelog\n**[06-jan-14]** Added demo app to heroku \n**[01-dec-14]** Improving isomorphic rendering \n**[30-nov-14]** Isomorphic app support \n**[24-nov-14]** Sessions (login/logout/profile); html5 puhsState; single server \n**[22-nov-14]** Initial version\n";
77

src/components/pages/home.jsx client/src/components/pages/home.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use strict";
22
var React = require("react");
3-
var DocumentTitle = require("client/components/core/documentTitle.jsx");
4-
var MarkdownViewer = require("client/components/markdown/viewer.jsx");
3+
var DocumentTitle = require("local/components/core/documentTitle.jsx");
4+
var MarkdownViewer = require("local/components/markdown/viewer.jsx");
55

66
var homeMarkedown = "[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/WRidder/react-spa?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)\n[![Build Status](https://travis-ci.org/WRidder/react-spa.svg?branch=master)](https://travis-ci.org/WRidder/react-spa)\n\nA Proof of Concept real-time single page application based on React and (Re)flux to discover best practices regarding a multitude of use cases. Contains a simple server with in-memory database in `./server`.\n\n[**Demo on Heroku**](http://react-spa.herokuapp.com/) \n(Automatically deployed from this repository on travis build)\n\n### Installation\n#### Just running the demo\n1. Run `$ npm install` in the ./server directory\n2. Start the server in ./server using `$ node src/server.js`. Should open a port on 8080.\n3. Navigate your browser to http://localhost:8080.\n\n#### For developers\n1. Run `$ npm install` in the base and in the ./server directory\n2. Run `$ bower install` in the base directory\n3. Start the server in ./server using `$ node src/server.js`. Should open a port on 8080.\n4. **[optional]** Install gulp globally using `npm install -g gulp`\n5. Run `$ gulp` in the base directory. This will watch for file changes and build when necessary.\n6. Navigate your browser to http://localhost:8080; will reload on client changes.\n\nTested using npm 2.1.0 and node 0.10.33\n\n### Current state\n* Discovery\n* **Proof of concept**\n* Refactoring\n* Stabilizing\n\n### Goal\nCreate a more advanced example (w.r.t. your average TODO app) of creating a SPA using ReactJS. Initially as a personal exercise to go *through the mud* once while hoping to share new insights gained during the process and discuss various approaches. \n\nThis will be by no means a production ready application. Objectives and goals are subject to change.\n\n#### Primary objectives\n* Find sensible approaches to using reactjs with (re)flux\n* Scalable solutions (both in size and regarding developers)\n* Isomorphic application\n* Tests (unit, integration and functional) for all essential components\n* Build methods\n* Realtime connections\n* File/folder layout\n\n#### Secondary objectives\n* Load modules on demand\n* SEO \n* Accessibility\n\n### Application design\n#### Features\n* User login and registration\n* Forum-like discussions\n* Realtime connections\n* Stackoverflow-like questions\n* Chat\n* Updates\n\n#### Roles\n* Guest\n * Can view public pages\n * Can login\n * Can create account\n* User\n * Can view restricted pages\n * Can create questions, discussions and comments. \n * Can delete own comments\n* Moderator\n * Can edit/delete questions, discussions and comments from other users\n* Administrator\n * Can access adminstrative area\n * Can list/disable/remove users\n\n#### Layout\n**Home page**\n\n```\n+---------------------------------------------------------------------------+\n| Logo Account Updates(5) |\n| +----------+ +-----------+ +-------------+ +-------------+ +-----------+ |\n| | Home | | Questions | | Discussions | | About | | Chat | |\n| +----------+ +-----------+ +-------------+ +-------------+ +-----------+ |\n| |\n+---------------------------------------------------------------------------+\n| Homepage |\n| |\n| List of updates |\n| |\n+---------------------------------------------------------------------------+\n|(c) notice |\n+---------------------------------------------------------------------------+\n```\n\n### Libraries\n* [ReactJS](https://facebook.github.io/react/)\n* [Reflux](https://github.com/spoike/refluxjs)\n* [React-router](https://github.com/rackt/react-router/)\n* [ImmutableJS](https://github.com/facebook/immutable-js)\n* [Material-ui](https://github.com/callemall/material-ui)\n* [SocketIO](http://socket.io/)\n\n### Foundations\n* [React starter kit](https://github.com/kriasoft/react-starter-kit)\n\n### Resources\n#### Blogs\n* [krawaller.se](http://blog.krawaller.se/)\n* [spoike.ghost.io](http://spoike.ghost.io/)\n\n#### Discussions\n* [Google ReactJS group](https://groups.google.com/forum/#!forum/reactjs)\n* [ReactJS subreddit](https://www.reddit.com/r/reactjs/search?q=reactjs&sort=relevance&restrict_sr=on&t=all)\n\n#### Books\n* [Developing a React.js Edge](http://shop.oreilly.com/product/9781939902122.do)\n\n### Changelog\n**[06-jan-14]** Added demo app to heroku \n**[01-dec-14]** Improving isomorphic rendering \n**[30-nov-14]** Isomorphic app support \n**[24-nov-14]** Sessions (login/logout/profile); html5 puhsState; single server \n**[22-nov-14]** Initial version\n";
77

File renamed without changes.

src/components/questions/question.jsx client/src/components/questions/question.jsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"use strict";
22
var React = require("react");
3-
var MarkdownViewer = require("client/components/markdown/viewer.jsx");
3+
var MarkdownViewer = require("local/components/markdown/viewer.jsx");
44
var ReactSpinner = require("react-spinner");
55

6-
var connect= require("client/libraries/tmp_connect");
7-
var DocumentTitle = require("client/components/core/documentTitle.jsx");
8-
var questionStore = require("client/stores/question");
6+
var connect = require("local/libraries/tmp_connect");
7+
var DocumentTitle = require("local/components/core/documentTitle.jsx");
8+
var questionStore = require("local/stores/question");
99
var ImmutableRenderMixin = require("react-immutable-render-mixin");
10-
var componentTransitionMixin = require("client/mixins/componentTransition");
10+
var componentTransitionMixin = require("local/mixins/componentTransition");
1111

1212
var Question = React.createClass({
1313
mixins: [

0 commit comments

Comments
 (0)