1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 09:23:13 +01:00

Refactor a bit

This commit is contained in:
vrde 2015-05-18 18:00:12 +02:00
parent f189851355
commit 5dd7cd7554
12 changed files with 78 additions and 19982 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,11 @@
import alt from '../alt';
class ArtworkListActions {
constructor() {
this.generateActions(
'updateArtworkList'
);
};
};
//export default alt.createAction(ArtworkListActions);

View File

@ -6,7 +6,7 @@ import Router from 'react-router';
import AscribeApp from './components/ascribe_app';
import routes from './routes';
Router.run(routes, Router.HashLocation, (AscribeApp) => {
Router.run(routes, Router.HistoryLocation, (AscribeApp) => {
React.render(
<AscribeApp />,
document.getElementById('main')

View File

@ -1,11 +0,0 @@
import alt from '../alt';
class ArtworkListActions {
constructor() {
this.generateActions(
'updateArtworks'
);
};
};
export default alt.createAction(ArtworkListActions);

View File

@ -0,0 +1,24 @@
import React from 'react';
import ArtworkFetcher from '../fetchers/artwork_fetcher';
import ArtworkListStore from '../stores/artwork_list_store';
class ArtworkList extends React.Component {
componentDidMount() {
ArtworkFetcher.fetch().end();
}
getInitialState() {
}
render() {
return (
<ul>
<li>This is an artwork</li>
</ul>
);
}
};
export default ArtworkList;

View File

@ -1,17 +1,21 @@
import React from 'react';
import Router from 'react-router';
var Link = Router.Link;
var RouteHandler = Router.RouteHandler;
class AscribeApp extends React.Component {
render() {
return (
<div>
<h1>ascribe all the things!</h1>
<RouteHandler />
</div>
);
}
render() {
return (
<div>
<h1>ascribe all the things!</h1>
<Link to="artworks">artworks</Link>
<RouteHandler />
</div>
);
}
};
export default AscribeApp;

View File

@ -1,13 +0,0 @@
import React from 'react';
class ArtworkList extends React.Component {
render() {
return (
<ul>
<li>This is an artwork</li>
</ul>
);
}
};
export default ArtworkList;

View File

@ -1,9 +0,0 @@
import alt from '../alt';
class ArtworkListStore {
constructor() {
this.artworkList = [];
}
};
export default alt.createStore(ArtworkListStore);

View File

@ -0,0 +1,10 @@
import request from 'superagent';
var ArtworkListFetcher = {
fetch() {
return request.get('http://staging.ascribe.io/api/users/')
.auth('dimi@mailinator.com', '0000000000');
}
};
export default ArtworkListFetcher;

View File

@ -2,14 +2,14 @@ import React from 'react';
import Router from 'react-router';
import AscribeApp from './components/ascribe_app';
import ArtworkList from './components/gui/artwork_list';
import ArtworkList from './components/artwork_list';
var Route = Router.Route;
var routes = (
<Route handler={AscribeApp}>
<Route path="artworks" handler={ArtworkList} />
</Route>
<Route name="app" path="/" handler={AscribeApp}>
<Route name="artworks" handler={ArtworkList} />
</Route>
);
export default routes;
export default routes;

View File

@ -0,0 +1,15 @@
import alt from '../alt';
import ArtworkListActions from '../actions/artwork_list_actions';
class ArtworkListStore {
constructor() {
this.artworkList = [];
this.bindActions(ArtworkListActions);
}
onUpdateArtworkList(artworkList) {
this.artworkList = artworkList;
}
};
export default alt.createStore(ArtworkListStore);