fixed bug with amount not updating / solved double dispatch problem with cartAction.load / removed all console.log calls - it became too chatty / add them as needed
This commit is contained in:
@@ -10,24 +10,10 @@ var CartActions = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
addItem: function(itemId) {
|
setItemCount: function(item, count) {
|
||||||
AppDispatcher.handleAction({
|
|
||||||
actionType: CartConstants.ADD_ITEM,
|
|
||||||
itemId: itemId
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
takeItemOut: function(itemId) {
|
|
||||||
AppDispatcher.handleAction({
|
|
||||||
actionType: CartConstants.TAKE_ITEM_OUT,
|
|
||||||
itemId: itemId
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
setItemCount: function(itemId, count) {
|
|
||||||
AppDispatcher.handleAction({
|
AppDispatcher.handleAction({
|
||||||
actionType: CartConstants.SET_ITEM_COUNT,
|
actionType: CartConstants.SET_ITEM_COUNT,
|
||||||
itemId: itemId,
|
item: item,
|
||||||
count: count
|
count: count
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ var NavigationConstants = require('../constants/navigationConstants');
|
|||||||
var NavigationActions = {
|
var NavigationActions = {
|
||||||
// select item
|
// select item
|
||||||
goToItemDetails: function(item) {
|
goToItemDetails: function(item) {
|
||||||
console.log("Going to item details");
|
|
||||||
AppDispatcher.handleAction({
|
AppDispatcher.handleAction({
|
||||||
actionType: NavigationConstants.CHANGE_URL,
|
actionType: NavigationConstants.CHANGE_URL,
|
||||||
url: '/artikal/' + item.get('id') +'/' + item.get('name')
|
url: '/artikal/' + item.get('id') +'/' + item.get('name')
|
||||||
@@ -13,7 +13,6 @@ var NavigationActions = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
goToSection: function(section) {
|
goToSection: function(section) {
|
||||||
console.log("Going to item details");
|
|
||||||
AppDispatcher.handleAction({
|
AppDispatcher.handleAction({
|
||||||
actionType: NavigationConstants.CHANGE_URL,
|
actionType: NavigationConstants.CHANGE_URL,
|
||||||
url: '/sekcija/'+ section.get('id') + '/' + section.get('name')
|
url: '/sekcija/'+ section.get('id') + '/' + section.get('name')
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ var BySection = React.createClass({
|
|||||||
SectionActions.loadSectionDetails(sectionId);
|
SectionActions.loadSectionDetails(sectionId);
|
||||||
},
|
},
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
console.log('mounting....');
|
|
||||||
var sectionId = this.getParams().id;
|
var sectionId = this.getParams().id;
|
||||||
ItemActions.loadBestSellingItemsForSection(sectionId);
|
ItemActions.loadBestSellingItemsForSection(sectionId);
|
||||||
SectionActions.loadSectionDetails(sectionId);
|
SectionActions.loadSectionDetails(sectionId);
|
||||||
@@ -112,7 +112,7 @@ var BySection = React.createClass({
|
|||||||
},
|
},
|
||||||
_onChange: function() {
|
_onChange: function() {
|
||||||
if(this.isMounted()) {
|
if(this.isMounted()) {
|
||||||
console.log('items store changed! by section');
|
|
||||||
this.setState({items: ItemStore.getBestSellingForSection()});
|
this.setState({items: ItemStore.getBestSellingForSection()});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,12 +35,15 @@ var AddToCart = React.createClass({
|
|||||||
// Add change listeners to stores
|
// Add change listeners to stores
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
CartStore.addChangeListener(this._onChange);
|
CartStore.addChangeListener(this._onChange);
|
||||||
CartActions.load();
|
|
||||||
|
if(!CartStore.dataStartedLoading()) {
|
||||||
|
CartActions.load();
|
||||||
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
var itemInCart = CartStore.getStateFor(this.props.itemId);
|
var itemInCart = CartStore.getStateFor(this.props.item.get('id'));
|
||||||
return {
|
return {
|
||||||
item: itemInCart,
|
item: itemInCart,
|
||||||
count: 0
|
count: 0
|
||||||
@@ -50,13 +53,13 @@ var AddToCart = React.createClass({
|
|||||||
|
|
||||||
_onChange: function () {
|
_onChange: function () {
|
||||||
if (this.isMounted()) {
|
if (this.isMounted()) {
|
||||||
var item = CartStore.getStateFor(this.props.itemId);
|
var item = CartStore.getStateFor(this.props.item.get('id'));
|
||||||
this.setState({ item: item, count: 0 });
|
this.setState({ item: item, count: 0 });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onIncreaseClick: function () {
|
_onIncreaseClick: function () {
|
||||||
//CartActions.addItem(this.props.itemId);
|
|
||||||
if (this.state.count < Globals.MaxNumberOfItemsToBeAdded ) {
|
if (this.state.count < Globals.MaxNumberOfItemsToBeAdded ) {
|
||||||
this.state.count = this.state.count + 1;
|
this.state.count = this.state.count + 1;
|
||||||
this.setState(this.state);
|
this.setState(this.state);
|
||||||
@@ -64,7 +67,7 @@ var AddToCart = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_onDecreaseClick: function () {
|
_onDecreaseClick: function () {
|
||||||
// CartActions.takeItemOut(this.props.itemId);
|
|
||||||
if (this.state.count > 0) {
|
if (this.state.count > 0) {
|
||||||
this.state.count = this.state.count - 1;
|
this.state.count = this.state.count - 1;
|
||||||
this.setState(this.state);
|
this.setState(this.state);
|
||||||
@@ -72,7 +75,7 @@ var AddToCart = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_addToCartClick: function () {
|
_addToCartClick: function () {
|
||||||
CartActions.setItemCount(this.props.itemId, this.state.count);
|
CartActions.setItemCount(this.props.item, this.state.count);
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillUnmount: function () {
|
componentWillUnmount: function () {
|
||||||
|
|||||||
@@ -40,7 +40,9 @@ var CartIcon = React.createClass({
|
|||||||
// Add change listeners to stores
|
// Add change listeners to stores
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
CartStore.addChangeListener(this._onChange);
|
CartStore.addChangeListener(this._onChange);
|
||||||
CartActions.load();
|
if(!CartStore.dataStartedLoading()) {
|
||||||
|
CartActions.load();
|
||||||
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
@@ -51,6 +53,7 @@ var CartIcon = React.createClass({
|
|||||||
|
|
||||||
_onChange: function () {
|
_onChange: function () {
|
||||||
if (this.isMounted()) {
|
if (this.isMounted()) {
|
||||||
|
|
||||||
this.setState(CartStore.getWholeCartState());
|
this.setState(CartStore.getWholeCartState());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ var CartPage = React.createClass({
|
|||||||
<div key={i.get('id')} className="row cart-items">
|
<div key={i.get('id')} className="row cart-items">
|
||||||
<div className="col-md-3"><SingleItem item={i} hidePrice={true}/> </div>
|
<div className="col-md-3"><SingleItem item={i} hidePrice={true}/> </div>
|
||||||
<div className="col-md-2"> { Globals.FormatCurrency(price) }</div>
|
<div className="col-md-2"> { Globals.FormatCurrency(price) }</div>
|
||||||
<div className="col-md-3"> <AddToCart itemId={i.get('id')} /> </div>
|
<div className="col-md-3">
|
||||||
|
42 </div>
|
||||||
<div className="col-md-2"> { Globals.FormatCurrency(count * price) }</div>
|
<div className="col-md-2"> { Globals.FormatCurrency(count * price) }</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -65,7 +66,7 @@ var CartPage = React.createClass({
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log("length :" , this.state.items.length);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
|
|||||||
@@ -10,40 +10,23 @@ var CartTotal = React.createClass({
|
|||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var counts = this.props.itemCounts;
|
var counts = this.props.itemCounts;
|
||||||
var total = 0;
|
var total = 0;
|
||||||
this.props.items.map(function (i) {
|
|
||||||
|
|
||||||
var count = counts[i.get('id')].get('count');
|
var items = this.props.items.models;
|
||||||
var price = i.get('list_price');
|
|
||||||
|
for (var i = 0; i < items.length; i++) {
|
||||||
|
var item = items[i];
|
||||||
|
var count = counts[item.get('id')].get('count');
|
||||||
|
var price = item.get('list_price');
|
||||||
total += (price * count)
|
total += (price * count)
|
||||||
return total;
|
};
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
var deliveryCosts = this.props.deliveryCosts.get('delivery_price');
|
|
||||||
|
|
||||||
if (!this.props.justMerchandise) {
|
return ( <span>{Globals.FormatCurrency(total)}</span>);
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="col-md-3 cart-total">
|
|
||||||
<div>
|
|
||||||
Roba: {Globals.FormatCurrency(total)}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
Dostava: {Globals.FormatCurrency(deliveryCosts)}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
Ukupno: {Globals.FormatCurrency(total + (+deliveryCosts))}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ( <span>{Globals.FormatCurrency(total)}</span>);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ var ItemWithDetailsPage = React.createClass({
|
|||||||
|
|
||||||
<div>Količina</div>
|
<div>Količina</div>
|
||||||
|
|
||||||
<div> <AddToCart itemId={this.state.item.get('id')} /></div>
|
<div> <AddToCart item={this.state.item} /></div>
|
||||||
<div> {this.state.item.get('description')}</div>
|
<div> {this.state.item.get('description')}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ var SingleItem = React.createClass({
|
|||||||
|
|
||||||
itemClick: function(e) {
|
itemClick: function(e) {
|
||||||
NavigationActions.goToItemDetails(this.props.item);
|
NavigationActions.goToItemDetails(this.props.item);
|
||||||
console.log(this.props.item)
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ var keyMirror = require('react/lib/keyMirror');
|
|||||||
// Define action constants
|
// Define action constants
|
||||||
module.exports = keyMirror({
|
module.exports = keyMirror({
|
||||||
LOAD_CART_CONTENTS: null,
|
LOAD_CART_CONTENTS: null,
|
||||||
ADD_ITEM: null,
|
|
||||||
TAKE_ITEM_OUT: null ,
|
|
||||||
CART_DATA_LOADED: null,
|
CART_DATA_LOADED: null,
|
||||||
SAVE_CART_STATE_FOR_ITEM: null,
|
SAVE_CART_STATE_FOR_ITEM: null,
|
||||||
CHANGE_DELIVERY_DESTINATION_PROPERTY: null,
|
CHANGE_DELIVERY_DESTINATION_PROPERTY: null,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ AppDispatcher.handleAction = function(action) {
|
|||||||
action: action
|
action: action
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("Dispatching:", action);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = AppDispatcher;
|
module.exports = AppDispatcher;
|
||||||
@@ -106,7 +106,7 @@ var BySubCategoryStore = _.extend({}, EventEmitter.prototype, {
|
|||||||
},
|
},
|
||||||
// Emit Change event
|
// Emit Change event
|
||||||
emitChange: function() {
|
emitChange: function() {
|
||||||
console.log("Emmiting BySubCategory change!");
|
|
||||||
this.emit('change');
|
this.emit('change');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,12 @@ var _deliveryCosts = new Place({
|
|||||||
postalCode: _deliveryDestination.get('place')
|
postalCode: _deliveryDestination.get('place')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
var _cartDataLoadCalled = false;
|
||||||
|
|
||||||
|
|
||||||
var loadCart = function() {
|
var loadCart = function() {
|
||||||
|
|
||||||
|
states = {};
|
||||||
_itemsInCart.fetch({
|
_itemsInCart.fetch({
|
||||||
success: function() {
|
success: function() {
|
||||||
states = {}
|
states = {}
|
||||||
@@ -51,6 +55,8 @@ var loadCart = function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
_cartDataLoadCalled = true;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -71,22 +77,12 @@ var saveCartStateForItem = function(itemId) {
|
|||||||
var item = CartStore.getStateFor(itemId);
|
var item = CartStore.getStateFor(itemId);
|
||||||
item.save({
|
item.save({
|
||||||
success: function() {
|
success: function() {
|
||||||
CartActions.dataLoaded();
|
loadCart();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var addItem = function(itemId) {
|
/* need it for delete - will delete it later
|
||||||
|
|
||||||
var state = states[itemId] || new ItemInCart({
|
|
||||||
item_id: itemId,
|
|
||||||
count: 0
|
|
||||||
})
|
|
||||||
state.set('count', state.get('count') + 1);
|
|
||||||
states[itemId] = state;
|
|
||||||
saveCartStateForItem(itemId);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
var takeItemOut = function(itemId) {
|
var takeItemOut = function(itemId) {
|
||||||
|
|
||||||
@@ -101,15 +97,20 @@ var takeItemOut = function(itemId) {
|
|||||||
saveCartStateForItem(itemId);
|
saveCartStateForItem(itemId);
|
||||||
};
|
};
|
||||||
|
|
||||||
var setItemCount = function(itemId, count) {
|
*/
|
||||||
|
|
||||||
|
var setItemCount = function(item, count) {
|
||||||
|
|
||||||
|
var itemId = item.get('id');
|
||||||
var state = states[itemId] || new ItemInCart({
|
var state = states[itemId] || new ItemInCart({
|
||||||
item_id: itemId,
|
item_id: itemId,
|
||||||
count: 0
|
count: 0
|
||||||
})
|
})
|
||||||
console.log("Old state", state.get('count'));
|
|
||||||
|
_itemsForDisplay.add(item);
|
||||||
|
|
||||||
state.set('count', state.get('count') + count);
|
state.set('count', state.get('count') + count);
|
||||||
console.log("New state", state.get('count'));
|
|
||||||
states[itemId] = state;
|
states[itemId] = state;
|
||||||
saveCartStateForItem(itemId);
|
saveCartStateForItem(itemId);
|
||||||
}
|
}
|
||||||
@@ -125,7 +126,7 @@ var changeDeliveryDestinationProperty = function(property, value) {
|
|||||||
|
|
||||||
|
|
||||||
var confirmOrder = function() {
|
var confirmOrder = function() {
|
||||||
console.log("confirming");
|
|
||||||
var oc = new OrderConfirmation({
|
var oc = new OrderConfirmation({
|
||||||
hamo: 'meho'
|
hamo: 'meho'
|
||||||
});
|
});
|
||||||
@@ -133,7 +134,7 @@ var confirmOrder = function() {
|
|||||||
b: 'b'
|
b: 'b'
|
||||||
}, {
|
}, {
|
||||||
success: function() {
|
success: function() {
|
||||||
console.log("done");
|
|
||||||
NavigationActions.goToThankYou();
|
NavigationActions.goToThankYou();
|
||||||
loadCart();
|
loadCart();
|
||||||
}
|
}
|
||||||
@@ -142,10 +143,9 @@ var confirmOrder = function() {
|
|||||||
|
|
||||||
|
|
||||||
var saveDeliveryDestination = function() {
|
var saveDeliveryDestination = function() {
|
||||||
console.log("saving delivery destination");
|
|
||||||
_deliveryDestination.save(null, {
|
_deliveryDestination.save(null, {
|
||||||
success: function() {
|
success: function() {
|
||||||
console.log("saved delivery destination");
|
|
||||||
confirmOrder();
|
confirmOrder();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -197,6 +197,10 @@ var isDeliveryDestinationValid = function() {
|
|||||||
// Extend CartStore with EventEmitter to add eventing capabilities
|
// Extend CartStore with EventEmitter to add eventing capabilities
|
||||||
var CartStore = _.extend({}, EventEmitter.prototype, {
|
var CartStore = _.extend({}, EventEmitter.prototype, {
|
||||||
|
|
||||||
|
dataStartedLoading: function() {
|
||||||
|
return _cartDataLoadCalled;
|
||||||
|
},
|
||||||
|
|
||||||
getStateFor: function(itemId) {
|
getStateFor: function(itemId) {
|
||||||
|
|
||||||
var state = states[itemId] || new ItemInCart({
|
var state = states[itemId] || new ItemInCart({
|
||||||
@@ -234,7 +238,6 @@ var CartStore = _.extend({}, EventEmitter.prototype, {
|
|||||||
|
|
||||||
// Emit Change event
|
// Emit Change event
|
||||||
emitChange: function() {
|
emitChange: function() {
|
||||||
console.log("Emitting cart change!");
|
|
||||||
this.emit('change');
|
this.emit('change');
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -288,7 +291,7 @@ AppDispatcher.register(function(payload) {
|
|||||||
saveDeliveryDestination();
|
saveDeliveryDestination();
|
||||||
break;
|
break;
|
||||||
case CartConstants.SET_ITEM_COUNT:
|
case CartConstants.SET_ITEM_COUNT:
|
||||||
setItemCount(action.itemId, action.count);
|
setItemCount(action.item, action.count);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ var CategoryStore = _.extend({}, EventEmitter.prototype, {
|
|||||||
},
|
},
|
||||||
// Emit Change event
|
// Emit Change event
|
||||||
emitChange: function() {
|
emitChange: function() {
|
||||||
console.log("Emmiting Section change!");
|
|
||||||
this.emit('change');
|
this.emit('change');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ var InitializationStore = _.extend({}, EventEmitter.prototype, {
|
|||||||
|
|
||||||
// Emit Change event
|
// Emit Change event
|
||||||
emitChange: function() {
|
emitChange: function() {
|
||||||
console.log("InitializationStore change!");
|
|
||||||
this.emit('change');
|
this.emit('change');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ var getItemIdFromUrl = function() {
|
|||||||
var url = document.URL;
|
var url = document.URL;
|
||||||
var itemIdRegex = /artikal\/(\d+)\//g;
|
var itemIdRegex = /artikal\/(\d+)\//g;
|
||||||
var match = itemIdRegex.exec(url);
|
var match = itemIdRegex.exec(url);
|
||||||
console.log(match);
|
|
||||||
return match[1];
|
return match[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -95,7 +95,6 @@ var ItemWithDetailsStore = _.extend({}, EventEmitter.prototype, {
|
|||||||
|
|
||||||
// Emit Change event
|
// Emit Change event
|
||||||
emitChange: function() {
|
emitChange: function() {
|
||||||
console.log("Emitting change!");
|
|
||||||
this.emit('change');
|
this.emit('change');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ var getItemIdFromUrl = function() {
|
|||||||
var url = document.URL;
|
var url = document.URL;
|
||||||
var itemIdRegex = /artikal\/(\d+)\//g;
|
var itemIdRegex = /artikal\/(\d+)\//g;
|
||||||
var match = itemIdRegex.exec(url);
|
var match = itemIdRegex.exec(url);
|
||||||
console.log(match);
|
|
||||||
return match[1];
|
return match[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ var fetchItemsByCategory = function(categoryId, offset, limit, query) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var fetchBestSellingItemsForSection = function(sectionId) {
|
var fetchBestSellingItemsForSection = function(sectionId) {
|
||||||
console.log('getting section', sectionId);
|
|
||||||
var items = _bestSellingForSection;
|
var items = _bestSellingForSection;
|
||||||
items.setClassificationType(1);
|
items.setClassificationType(1);
|
||||||
items.setClassificationId(sectionId);
|
items.setClassificationId(sectionId);
|
||||||
@@ -96,7 +96,7 @@ var fetchBestSellingItemsForSection = function(sectionId) {
|
|||||||
|
|
||||||
|
|
||||||
var fetchBestSellingItemsForGroup = function(groupId) {
|
var fetchBestSellingItemsForGroup = function(groupId) {
|
||||||
console.log('getting group', groupId);
|
|
||||||
var items = _bestSellingForGroup;
|
var items = _bestSellingForGroup;
|
||||||
items.setClassificationType(4);
|
items.setClassificationType(4);
|
||||||
items.setClassificationId(groupId);
|
items.setClassificationId(groupId);
|
||||||
@@ -138,7 +138,7 @@ var ItemStore = _.extend({}, EventEmitter.prototype, {
|
|||||||
|
|
||||||
// Emit Change event
|
// Emit Change event
|
||||||
emitChange: function() {
|
emitChange: function() {
|
||||||
console.log("Emitting change!");
|
|
||||||
this.emit('change');
|
this.emit('change');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ var MenuItemStore = _.extend({}, EventEmitter.prototype, {
|
|||||||
},
|
},
|
||||||
// Emit Change event
|
// Emit Change event
|
||||||
emitChange: function() {
|
emitChange: function() {
|
||||||
console.log("Emmiting MenuItemStore change!");
|
|
||||||
this.emit('change');
|
this.emit('change');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ var _ = require('underscore');
|
|||||||
|
|
||||||
|
|
||||||
var getGroupIdFromUrl = function() {
|
var getGroupIdFromUrl = function() {
|
||||||
console.log("yeee" , match);
|
|
||||||
// ugly but it seems to me that
|
// ugly but it seems to me that
|
||||||
// router does not want to expose its
|
// router does not want to expose its
|
||||||
// state (for phylosophical reasons)
|
// state (for phylosophical reasons)
|
||||||
@@ -31,7 +30,6 @@ var NavigationStore = _.extend({}, EventEmitter.prototype, {
|
|||||||
|
|
||||||
// Emit Change event
|
// Emit Change event
|
||||||
emitChange: function() {
|
emitChange: function() {
|
||||||
console.log("NavigationStore change!");
|
|
||||||
this.emit('change');
|
this.emit('change');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ var SearchStore = _.extend({}, EventEmitter.prototype, {
|
|||||||
},
|
},
|
||||||
// Emit Change event
|
// Emit Change event
|
||||||
emitChange: function() {
|
emitChange: function() {
|
||||||
console.log("SearchStore change!");
|
|
||||||
this.emit('change');
|
this.emit('change');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ var loadSectionDetails = function(sectionId) {
|
|||||||
section.fetch({
|
section.fetch({
|
||||||
success: function() {
|
success: function() {
|
||||||
_sectionDetails = section;
|
_sectionDetails = section;
|
||||||
console.log('section details', _sectionDetails);
|
|
||||||
SectionStore.emitChange();
|
SectionStore.emitChange();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -53,7 +53,7 @@ var SectionStore = _.extend({}, EventEmitter.prototype, {
|
|||||||
},
|
},
|
||||||
// Emit Change event
|
// Emit Change event
|
||||||
emitChange: function() {
|
emitChange: function() {
|
||||||
console.log("Emmiting Section change!");
|
|
||||||
this.emit('change');
|
this.emit('change');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ var handleRegistrationFailure = function(error) {
|
|||||||
error: error
|
error: error
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
console.log('ERROR JE: ', error);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var handleLoginSuccess = function(user) {
|
var handleLoginSuccess = function(user) {
|
||||||
@@ -92,7 +90,6 @@ var UserStore = _.extend({}, EventEmitter.prototype, {
|
|||||||
},
|
},
|
||||||
// Emit Change event
|
// Emit Change event
|
||||||
emitChange: function() {
|
emitChange: function() {
|
||||||
console.log("Emmiting Section change!");
|
|
||||||
this.emit('change');
|
this.emit('change');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user