61 lines
1.5 KiB
JavaScript
61 lines
1.5 KiB
JavaScript
var React = require('react'),
|
|
ItemMultiMediaDescriptions = require('./itemMultiMediaDescriptions'),
|
|
ItemActions = require('../../actions/itemActions'),
|
|
NavigationStore = require('../../stores/NavigationStore'),
|
|
ItemStore = require('../../stores/itemStore');
|
|
|
|
var Router = require('react-router');
|
|
|
|
|
|
var ItemWithDetailsPage = React.createClass({
|
|
|
|
render: function() {
|
|
|
|
return (
|
|
|
|
|
|
<div className="item-with-details row-fluid center">
|
|
<div className="span3">
|
|
|
|
<h3> {this.state.item.get('name')} </h3>
|
|
<div>
|
|
|
|
<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>
|
|
) ;
|
|
|
|
},
|
|
|
|
// Add change listeners to stores
|
|
componentDidMount: function() {
|
|
ItemStore.addChangeListener(this._onChange);
|
|
NavigationStore.addChangeListener(this._onChange);
|
|
ItemActions.loadItemWithDetails();
|
|
},
|
|
|
|
_onChange: function () {
|
|
if (this.isMounted()) {
|
|
this.setState({
|
|
item: ItemStore.getLoadedItemWithDetails()
|
|
});
|
|
}
|
|
},
|
|
|
|
getInitialState: function () {
|
|
return {
|
|
item : ItemStore.getLoadedItemWithDetails()
|
|
};
|
|
}
|
|
|
|
});
|
|
|
|
|
|
module.exports = ItemWithDetailsPage;
|