removed redundant ribica name from subfolders
This commit is contained in:
38
front-ui/app/models/itemCollection.js
Normal file
38
front-ui/app/models/itemCollection.js
Normal file
@@ -0,0 +1,38 @@
|
||||
var Backbone = require('backbone'),
|
||||
Item = require('./item'),
|
||||
Globals = require('../globals');
|
||||
|
||||
var ItemCollection = Backbone.Collection.extend({
|
||||
|
||||
setLimit: function(limit) {
|
||||
this.queryLimit = limit;
|
||||
},
|
||||
|
||||
setOffset: function(offset) {
|
||||
this.offset = offset;
|
||||
},
|
||||
|
||||
classificationTypeUrlParts: ['','section','category','sub_category'],
|
||||
|
||||
setClassificationType: function(type) {
|
||||
this.classificationType = type;
|
||||
} ,
|
||||
|
||||
setClassificatonId: function(id) {
|
||||
this.classificationId = id;
|
||||
},
|
||||
|
||||
model: Item,
|
||||
url: function() {
|
||||
var path = '/item'
|
||||
if(this.classificationType > 0) {
|
||||
// eg. http://localhost:4567/item/section/1/offset/0/limit/10
|
||||
var urlPart = this.classificationTypeUrlParts[this.classificationType];
|
||||
path += "/" + urlPart + "/" + this.classificationId
|
||||
} // else eg. http://localhost:4567/item/offset/0/limit/10
|
||||
path += "/offset/" + this.offset + "/limit/" + this.queryLimit;
|
||||
return Globals.ApiUrl + path;
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = ItemCollection;
|
||||
Reference in New Issue
Block a user