groups of articles now shown on ribica.ba/group/1/, background is in cloudinary
This commit is contained in:
@@ -9,7 +9,8 @@ var _ = require('underscore');
|
||||
var _items = new ItemCollection(),
|
||||
_itemWithDetails = new ItemWithDetails(),
|
||||
_bestSellingForSection = new ItemCollection(),
|
||||
_itemsByCategory = new ItemCollection();
|
||||
_itemsByCategory = new ItemCollection(),
|
||||
_bestSellingForGroup = new ItemCollection();
|
||||
|
||||
|
||||
var loadItemsForFrontpage = function() {
|
||||
@@ -93,6 +94,22 @@ var fetchBestSellingItemsForSection = function(sectionId) {
|
||||
};
|
||||
|
||||
|
||||
var fetchBestSellingItemsForGroup = function(groupId) {
|
||||
console.log('getting group', groupId);
|
||||
var items = _bestSellingForGroup;
|
||||
items.setClassificationType(4);
|
||||
items.setClassificationId(groupId);
|
||||
items.setLimit(30);
|
||||
items.setOffset(0);
|
||||
|
||||
items.fetch({
|
||||
success: function() {
|
||||
ItemStore.emitChange();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// Extend ItemStore with EventEmitter to add eventing capabilities
|
||||
var ItemStore = _.extend({}, EventEmitter.prototype, {
|
||||
|
||||
@@ -108,6 +125,10 @@ var ItemStore = _.extend({}, EventEmitter.prototype, {
|
||||
return _itemWithDetails;
|
||||
},
|
||||
|
||||
getItemsForGroup: function () {
|
||||
return _bestSellingForGroup;
|
||||
},
|
||||
|
||||
|
||||
// Return All Items
|
||||
getItems: function() {
|
||||
@@ -148,6 +169,10 @@ AppDispatcher.register(function(payload) {
|
||||
fetchBestSellingItemsForSection(action.sectionId);
|
||||
break;
|
||||
|
||||
case ItemConstants.LOAD_BSI_FOR_ITEM_GROUP:
|
||||
fetchBestSellingItemsForGroup(action.groupId);
|
||||
break;
|
||||
|
||||
case ItemConstants.LOAD_FOR_FRONTPAGE:
|
||||
loadItemsForFrontpage();
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user