- removed our copy jquery & bootstrap. using cdn instead

- added search box to the header
- made reindex rake task
This commit is contained in:
Edin Dazdarevic
2015-05-25 20:49:52 +02:00
parent c99bcbda7a
commit e1be044fd9
14 changed files with 154 additions and 88 deletions

View File

@@ -3,18 +3,14 @@ var CartStore = require('../../stores/cartStore.js');
var CartActions = require('../../actions/cartActions.js');
var Globals = require('../../globals');
var buttonHolderStyle = {
display: 'inline-block'
};
var AddToCart = React.createClass({
render: function() {
INITIAL_ITEM_COUNT: 1,
render: function() {
var itemCount = this.state.count;
var amountAndAddButton = (
<div className="row-fluid add-to-cart">
<div className="span12">
@@ -25,16 +21,14 @@ var AddToCart = React.createClass({
<div>
<div style={buttonHolderStyle}><button className="btn mybutton" onClick={this._addToCartClick}>Dodaj na popis za kupovinu</button></div>
</div>
</div>
</div>
);
return amountAndAddButton;
},
},
// Add change listeners to stores
componentDidMount: function() {
CartStore.addChangeListener(this._onChange);
CartStore.addChangeListener(this._onChange);
if(!CartStore.dataStartedLoading()) {
CartActions.load();
@@ -44,9 +38,9 @@ var AddToCart = React.createClass({
getInitialState: function() {
var itemInCart = CartStore.getStateFor(this.props.item.get('id'));
return {
return {
item: itemInCart,
count: 0
count: this.INITIAL_ITEM_COUNT
}
},
@@ -54,12 +48,12 @@ var AddToCart = React.createClass({
_onChange: function () {
if (this.isMounted()) {
var item = CartStore.getStateFor(this.props.item.get('id'));
this.setState({ item: item, count: 0 });
this.setState({ item: item, count: this.INITIAL_ITEM_COUNT });
}
},
_onIncreaseClick: function () {
if (this.state.count < Globals.MaxNumberOfItemsToBeAdded ) {
this.state.count = this.state.count + 1;
this.setState(this.state);
@@ -67,8 +61,8 @@ var AddToCart = React.createClass({
},
_onDecreaseClick: function () {
if (this.state.count > 0) {
if (this.state.count > 1) {
this.state.count = this.state.count - 1;
this.setState(this.state);
}
@@ -81,7 +75,7 @@ var AddToCart = React.createClass({
componentWillUnmount: function () {
CartStore.removeChangeListener(this._onChange);
}
});
module.exports = AddToCart;
module.exports = AddToCart;