more reformatting
This commit is contained in:
@@ -6,30 +6,30 @@ var ItemCollection = require('../../models/itemCollection');
|
||||
|
||||
var AllItems = React.createClass({
|
||||
|
||||
render: function() {
|
||||
if(this.state) {
|
||||
return (
|
||||
<ItemList items={this.state.items} />
|
||||
render: function() {
|
||||
if(this.state) {
|
||||
return (
|
||||
<ItemList items={this.state.items} />
|
||||
);
|
||||
}
|
||||
else {
|
||||
return (
|
||||
<div> Not Loaded ! </div>
|
||||
return (
|
||||
<div> Not Loaded ! </div>
|
||||
);
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
// Add change listeners to stores
|
||||
},
|
||||
|
||||
// Add change listeners to stores
|
||||
componentDidMount: function() {
|
||||
ItemActions.loadFrontPageItems();
|
||||
ItemStore.addChangeListener(this._onChange);
|
||||
ItemActions.loadFrontPageItems();
|
||||
ItemStore.addChangeListener(this._onChange);
|
||||
},
|
||||
|
||||
_onChange: function () {
|
||||
if (this.isMounted()) {
|
||||
this.setState({
|
||||
items: ItemStore.getItems()
|
||||
items: ItemStore.getItems()
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -11,61 +11,61 @@ var Navigation = Router.Navigation;
|
||||
var ItemWithDetailsPage = React.createClass({
|
||||
|
||||
|
||||
mixins : [Router.State],
|
||||
mixins : [Router.State],
|
||||
render: function() {
|
||||
|
||||
return (
|
||||
return (
|
||||
|
||||
|
||||
<div className="item-with-details row-fluid center">
|
||||
<div className="span3">
|
||||
|
||||
<h3> {this.state.item.get('name')} </h3>
|
||||
<div>
|
||||
<div className="item-with-details row-fluid center">
|
||||
<div className="span3">
|
||||
|
||||
<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')} />
|
||||
<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>
|
||||
</div>
|
||||
<div className="span4">
|
||||
quantitative descriptions
|
||||
</div>
|
||||
</div>
|
||||
) ;
|
||||
|
||||
},
|
||||
|
||||
// Add change listeners to stores
|
||||
// Add change listeners to stores
|
||||
componentDidMount: function() {
|
||||
//ItemStore.addChangeListener(this._onChange);
|
||||
//ItemActions.loadFrontPageItems();
|
||||
|
||||
var self = this;
|
||||
var item = new Item({ id: self.getParams().id });
|
||||
item.fetch({success: function() {
|
||||
if (self.isMounted()) {
|
||||
console.log('article loaded', item);
|
||||
self.setState({
|
||||
item : item
|
||||
});
|
||||
}
|
||||
}});
|
||||
//ItemStore.addChangeListener(this._onChange);
|
||||
//ItemActions.loadFrontPageItems();
|
||||
|
||||
var self = this;
|
||||
var item = new Item({ id: self.getParams().id });
|
||||
item.fetch({success: function() {
|
||||
if (self.isMounted()) {
|
||||
console.log('article loaded', item);
|
||||
self.setState({
|
||||
item : item
|
||||
});
|
||||
}
|
||||
}});
|
||||
},
|
||||
|
||||
_onChange: function () {
|
||||
this.setState({
|
||||
item: ItemStore.getSelectedItem()
|
||||
});
|
||||
this.setState({
|
||||
item: ItemStore.getSelectedItem()
|
||||
});
|
||||
},
|
||||
|
||||
getInitialState: function () {
|
||||
return {
|
||||
//item: ItemStore.getSelectedItem()
|
||||
item : (new Item())
|
||||
//item: ItemStore.getSelectedItem()
|
||||
item : (new Item())
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user