we are using flux now ... yaaay ...
This commit is contained in:
@@ -1,14 +1,18 @@
|
||||
var React = require('react'),
|
||||
ItemMultiMediaDescriptions = require('./itemMultiMediaDescriptions');
|
||||
ItemMultiMediaDescriptions = require('./itemMultiMediaDescriptions'),
|
||||
ItemActions = require('../actions/itemActions'),
|
||||
ItemStore = require('../stores/itemStore');
|
||||
|
||||
|
||||
var ItemWithDetailsPage = React.createClass({
|
||||
|
||||
|
||||
render: function() {
|
||||
|
||||
return (
|
||||
<div className="item-with-details row-fluid center">
|
||||
<div className="span3">
|
||||
<ItemMultiMediaDescriptions descriptions={this.props.item.get('multi_media_descriptions')} />
|
||||
<ItemMultiMediaDescriptions descriptions={this.state.item.get('multi_media_descriptions')} />
|
||||
</div>
|
||||
<div className="span4">
|
||||
quantitative descriptions
|
||||
@@ -17,6 +21,22 @@ var ItemWithDetailsPage = React.createClass({
|
||||
|
||||
) ;
|
||||
|
||||
},
|
||||
|
||||
// Add change listeners to stores
|
||||
componentDidMount: function() {
|
||||
ItemStore.addChangeListener(this._onChange);
|
||||
ItemActions.loadFrontPageItems();
|
||||
},
|
||||
|
||||
_onChange: function () {
|
||||
this.setState({
|
||||
item: ItemStore.getSelectedItem()
|
||||
});
|
||||
},
|
||||
|
||||
getInitialState: function () {
|
||||
return { item: ItemStore.getSelectedItem() };
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user