more reformatting

This commit is contained in:
Edin Dazdarevic
2015-01-25 16:42:16 +01:00
parent e3997a1a48
commit 0abbdcec1f
5 changed files with 59 additions and 58 deletions

View File

@@ -2,17 +2,17 @@ var React = require('react'),
Router = require('react-router');
var BySection = React.createClass({
mixins: [Router.State],
mixins: [Router.State],
render : function() {
return ( <div>
return ( <div>
<div className='col-md-2'>
Here goes section for refining search, by section
</div>
<div className='col-md-10'>
<h2> Welcome to section {this.getParams().id} </h2>
</div>
</div> )
<div className='col-md-2'>
Here goes section for refining search, by section
</div>
<div className='col-md-10'>
<h2> Welcome to section {this.getParams().id} </h2>
</div>
</div> )
}
});

View File

@@ -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()
});
}
},

View File

@@ -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())
};
}

View File

@@ -74,6 +74,7 @@ var SectionsListComponent = React.createClass({
<div>
<ul className='nav nav-pills'>
{this.state.sections.map(function(section) {
return (
<li key={section.get('id')} role='presentation' style={style}>
<a href="#" onClick={self.onSectionClick.bind(self, section)} onMouseOver={self.onMouseOver.bind(self, section)}>

View File

@@ -4,6 +4,6 @@ var Routes = require('./routes');
Backbone.$ = $;
module.exports = {
ExternalApi: ExternalApi,
Routes : Routes
App: ExternalApi,
Routes: Routes
}