Files
old-ribica/front-ui/app/components/items/itemWithDetailsPage.js

61 lines
1.5 KiB
JavaScript
Raw Normal View History

2015-01-24 18:49:47 +01:00
var React = require('react'),
2015-01-25 10:26:10 +01:00
ItemMultiMediaDescriptions = require('./itemMultiMediaDescriptions'),
2015-01-25 14:04:10 +01:00
ItemActions = require('../../actions/itemActions'),
NavigationStore = require('../../stores/NavigationStore'),
2015-01-25 14:04:10 +01:00
ItemStore = require('../../stores/itemStore');
2015-01-25 10:26:10 +01:00
var Router = require('react-router');
2015-01-24 18:49:47 +01:00
2015-01-27 05:47:10 +01:00
var ItemWithDetailsPage = React.createClass({
2015-01-25 10:26:10 +01:00
2015-01-24 18:49:47 +01:00
render: function() {
2015-01-25 16:42:16 +01:00
return (
2015-01-25 16:42:16 +01:00
<div className="item-with-details row-fluid center">
<div className="span3">
2015-01-25 16:42:16 +01:00
<h3> {this.state.item.get('name')} </h3>
<div>
2015-01-25 16:42:16 +01:00
<div className='h4'> {this.state.item.get('list_price')} KM</div>
<div> {this.state.item.get('description')}</div>
</div>
<ItemMultiMediaDescriptions descriptions={this.state.item.get('multi_media_descriptions')} />
</div>
<div className="span4">
quantitative descriptions
</div>
</div>
2015-01-24 18:49:47 +01:00
) ;
2015-01-25 10:26:10 +01:00
},
2015-01-25 16:42:16 +01:00
// Add change listeners to stores
2015-01-25 10:26:10 +01:00
componentDidMount: function() {
2015-01-27 05:47:10 +01:00
ItemStore.addChangeListener(this._onChange);
NavigationStore.addChangeListener(this._onChange);
ItemActions.loadItemWithDetails();
2015-01-25 10:26:10 +01:00
},
_onChange: function () {
if (this.isMounted()) {
this.setState({
item: ItemStore.getLoadedItemWithDetails()
});
}
2015-01-25 10:26:10 +01:00
},
getInitialState: function () {
return {
item : ItemStore.getLoadedItemWithDetails()
};
2015-01-24 18:49:47 +01:00
}
});
module.exports = ItemWithDetailsPage;