1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 09:35:10 +01:00

Improved naming

This commit is contained in:
Tim Daubenschütz 2015-05-26 10:52:20 +02:00
parent 1cb0b54f77
commit 54866cda84
4 changed files with 58 additions and 58 deletions

View File

@ -1,18 +0,0 @@
import React from 'react';
/**
* This is the component that implements display-specific functionality
*/
let PieceDetail = React.createClass({
propTypes: {
title: React.PropTypes.string.isRequired
},
render() {
return (
<p>Title: {this.props.title}</p>
);
}
});
export default PieceDetail;

View File

@ -1,45 +1,17 @@
import React from 'react';
import PieceActions from '../actions/piece_actions';
import PieceStore from '../stores/piece_store';
import PieceDetail from './ascribe_piece_detail/piece_detail';
/**
* This is the component that implements resource/data specific functionality
* This is the component that implements display-specific functionality
*/
let Piece = React.createClass({
getInitialState() {
return PieceStore.getState();
},
onChange(state) {
this.setState(state);
},
componentDidMount() {
PieceActions.fetchOne(this.props.params.pieceId);
PieceStore.listen(this.onChange);
},
componentDidUnmount() {
PieceStore.unlisten(this.onChange);
propTypes: {
title: React.PropTypes.string.isRequired
},
render() {
if('title' in this.state.piece) {
return (
<PieceDetail title={this.state.piece.title}></PieceDetail>
<p>Title: {this.props.title}</p>
);
} else {
return (
<p>Loading</p>
);
}
}
});

View File

@ -0,0 +1,46 @@
import React from 'react';
import PieceActions from '../actions/piece_actions';
import PieceStore from '../stores/piece_store';
import Piece from './piece';
/**
* This is the component that implements resource/data specific functionality
*/
let PieceContainer = React.createClass({
getInitialState() {
return PieceStore.getState();
},
onChange(state) {
this.setState(state);
},
componentDidMount() {
PieceActions.fetchOne(this.props.params.pieceId);
PieceStore.listen(this.onChange);
},
componentDidUnmount() {
PieceStore.unlisten(this.onChange);
},
render() {
if('title' in this.state.piece) {
return (
<Piece title={this.state.piece.title}></Piece>
);
} else {
return (
<p>Loading</p>
);
}
}
});
export default PieceContainer;

View File

@ -3,7 +3,7 @@ import Router from 'react-router';
import AscribeApp from './components/ascribe_app';
import PieceList from './components/piece_list';
import Piece from './components/piece';
import PieceContainer from './components/piece_container';
let Route = Router.Route;
@ -13,7 +13,7 @@ let routes = (
<Route name="pieces" path="/pieces" handler={PieceList}>
</Route>
<Route name="piece" path="/pieces/:pieceId" handler={Piece}>
<Route name="piece" path="/pieces/:pieceId" handler={PieceContainer}>
</Route>
</Route>
);