groups of articles now shown on ribica.ba/group/1/, background is in cloudinary

This commit is contained in:
Senad Uka
2015-03-23 07:21:53 +01:00
parent 0ff47313df
commit b534d15866
13 changed files with 143 additions and 5 deletions

View File

@@ -0,0 +1,44 @@
var React = require('react');
var ItemList = require('./itemList');
var ItemStore = require('../../stores/itemStore.js');
var ItemActions = require('../../actions/itemActions.js');
var ItemCollection = require('../../models/itemCollection');
var NavigationStore = require('../../stores/navigationStore.js');
var AllItemsInGroup = React.createClass({
render: function() {
return (
<ItemList items={this.state.items} />
);
},
// Add change listeners to stores
componentDidMount: function() {
ItemActions.loadBestSellingItemsForGroup(NavigationStore.getGroupIdFromUrl());
ItemStore.addChangeListener(this._onChange);
},
componentWillUnmount: function () {
ItemStore.removeChangeListener(this._onChange);
},
getInitialState: function() {
return {
items: ItemStore.getItemsForGroup()
}
},
_onChange: function () {
if (this.isMounted()) {
this.setState({
items: ItemStore.getItemsForGroup()
});
}
},
});
module.exports = AllItemsInGroup;