added image url for categories

This commit is contained in:
Edin Dazdarevic
2015-01-31 14:49:27 +01:00
parent 819cee9391
commit 646fbbcf4e
3 changed files with 22 additions and 7 deletions

View File

@@ -7,6 +7,7 @@ var React = require('react'),
ItemCollection = require('../../models/itemCollection'),
SectionStore = require('../../stores/sectionStore'),
SectionActions = require('../../actions/sectionActions.js'),
NavigationActions = require('../../actions/navigationActions'),
Section = require('../../models/section');
var BySection = React.createClass({
@@ -19,6 +20,7 @@ var BySection = React.createClass({
},
render : function() {
var s ={ float: 'left'};
var self = this;
return ( <div>
<div className='col-md-2'>
@@ -35,8 +37,13 @@ var BySection = React.createClass({
return (
<div style={s}>
<img src='http://www.windeln.de/resources/img/content/kat_windelnwickeln.jpg'/>
<div> {category.name}</div>
<img src={category.image_url || 'http://www.windeln.de/resources/img/content/kat_windelnwickeln.jpg'}/>
<div onClick={self.onCategoryClick.bind(self, category, self.state.section)}> {category.name}</div>
<ul>
{category.sub_categories.map(function(sc) {
return (<li>{sc.name}</li>)
})}
</ul>
</div>
)
@@ -46,6 +53,10 @@ var BySection = React.createClass({
</div>
</div> )
},
onCategoryClick: function(category, section) {
NavigationActions.goToCategory(category, section);
},
componentWillReceiveProps: function(nextProps) {
var sectionId = this.getParams().id;
ItemActions.loadBestSellingItemsForSection(sectionId);