1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 17:33:14 +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 AscribeApp from './components/ascribe_app';
import routes from './routes'; import routes from './routes';
Router.run(routes, Router.HashLocation, (AscribeApp) => { Router.run(routes, Router.HistoryLocation, (AscribeApp) => {
React.render( React.render(
<AscribeApp />, <AscribeApp />,
document.getElementById('main') 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,13 +1,17 @@
import React from 'react'; import React from 'react';
import Router from 'react-router'; import Router from 'react-router';
var Link = Router.Link;
var RouteHandler = Router.RouteHandler; var RouteHandler = Router.RouteHandler;
class AscribeApp extends React.Component { class AscribeApp extends React.Component {
render() { render() {
return ( return (
<div> <div>
<h1>ascribe all the things!</h1> <h1>ascribe all the things!</h1>
<Link to="artworks">artworks</Link>
<RouteHandler /> <RouteHandler />
</div> </div>
); );

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

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);