Files
old-ribica/front-ui/app/models/item.js
2015-01-24 08:20:11 +01:00

22 lines
440 B
JavaScript

var Backbone = require('backbone');
var Globals = require('../globals');
var Item = Backbone.Model.extend({
urlRoot : Globals.ApiUrl + '/item',
getFrontEndUrl : function(withHashPrefix) {
var hashPrefix = "";
if (withHashPrefix) {
hashPrefix = "#!/";
}
var slug = this.get('name').toLowerCase().replace(/\s+/g,"-");
return hashPrefix + "artikal/" + this.get('id') + "/" + slug
}
});
module.exports = Item;