created a route for item details

This commit is contained in:
Senad Uka
2015-01-24 08:20:11 +01:00
parent 848394ea92
commit f5eca4a758
8 changed files with 60 additions and 13 deletions

View File

@@ -2,7 +2,19 @@ var Backbone = require('backbone');
var Globals = require('../globals');
var Item = Backbone.Model.extend({
urlRoot : Globals.ApiUrl + '/item'
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;