Comparing version 0.2.6 to 0.2.7
@@ -1011,6 +1011,15 @@ // Generated by CoffeeScript 1.4.0 | ||
PaginatedCollection.prototype.parse = function(resp) { | ||
this.page = Number(resp.page); | ||
this.perPage = Number(resp.perPage); | ||
this.total = Number(resp.total); | ||
return resp.models; | ||
var result; | ||
if (resp.total && resp.models) { | ||
this.page = Number(resp.page); | ||
this.perPage = Number(resp.perPage); | ||
this.total = Number(resp.total); | ||
return resp.models; | ||
} else { | ||
result = Collection.prototype.parse.call(this, resp); | ||
this.page = 1; | ||
this.perPage = Math.MAX_VALUE; | ||
this.total = result.length; | ||
return result; | ||
} | ||
}; | ||
@@ -1280,5 +1289,2 @@ | ||
ItemView.__super__.constructor.apply(this, arguments); | ||
if (highbrow.browser && this.model) { | ||
this.binder = new Backbone.ModelBinder(); | ||
} | ||
} | ||
@@ -1389,41 +1395,4 @@ | ||
ItemView.prototype.convertBindings = function(bindings) { | ||
var result; | ||
result = {}; | ||
_.each(bindings, function(val, key) { | ||
var member; | ||
if (_.isString(val)) { | ||
return result[key] = val; | ||
} else { | ||
result[key] = { | ||
selector: val[0] | ||
}; | ||
if (member = val[1]) { | ||
return result[key].converter = function(dir, val, attr, model) { | ||
if (dir === 'ModelToView') { | ||
return model[member](); | ||
} else { | ||
return model[member](val); | ||
} | ||
}; | ||
} | ||
} | ||
}); | ||
return result; | ||
}; | ||
ItemView.prototype.onRender = function() {}; | ||
ItemView.prototype.initBindings = function() { | ||
var bindings; | ||
if (this.bindings) { | ||
bindings = this.convertBindings(this.bindings); | ||
return this.binder.bind(this.model, this.$el, bindings); | ||
} | ||
}; | ||
ItemView.prototype.onRender = function() { | ||
if (this.bindings) { | ||
return this.initBindings(); | ||
} | ||
}; | ||
ItemView.prototype.onShow = function() {}; | ||
@@ -1430,0 +1399,0 @@ |
@@ -1020,6 +1020,15 @@ /* | ||
PaginatedCollection.prototype.parse = function(resp) { | ||
this.page = Number(resp.page); | ||
this.perPage = Number(resp.perPage); | ||
this.total = Number(resp.total); | ||
return resp.models; | ||
var result; | ||
if (resp.total && resp.models) { | ||
this.page = Number(resp.page); | ||
this.perPage = Number(resp.perPage); | ||
this.total = Number(resp.total); | ||
return resp.models; | ||
} else { | ||
result = Collection.prototype.parse.call(this, resp); | ||
this.page = 1; | ||
this.perPage = Math.MAX_VALUE; | ||
this.total = result.length; | ||
return result; | ||
} | ||
}; | ||
@@ -1289,5 +1298,2 @@ | ||
ItemView.__super__.constructor.apply(this, arguments); | ||
if (highbrow.browser && this.model) { | ||
this.binder = new Backbone.ModelBinder(); | ||
} | ||
} | ||
@@ -1398,41 +1404,4 @@ | ||
ItemView.prototype.convertBindings = function(bindings) { | ||
var result; | ||
result = {}; | ||
_.each(bindings, function(val, key) { | ||
var member; | ||
if (_.isString(val)) { | ||
return result[key] = val; | ||
} else { | ||
result[key] = { | ||
selector: val[0] | ||
}; | ||
if (member = val[1]) { | ||
return result[key].converter = function(dir, val, attr, model) { | ||
if (dir === 'ModelToView') { | ||
return model[member](); | ||
} else { | ||
return model[member](val); | ||
} | ||
}; | ||
} | ||
} | ||
}); | ||
return result; | ||
}; | ||
ItemView.prototype.onRender = function() {}; | ||
ItemView.prototype.initBindings = function() { | ||
var bindings; | ||
if (this.bindings) { | ||
bindings = this.convertBindings(this.bindings); | ||
return this.binder.bind(this.model, this.$el, bindings); | ||
} | ||
}; | ||
ItemView.prototype.onRender = function() { | ||
if (this.bindings) { | ||
return this.initBindings(); | ||
} | ||
}; | ||
ItemView.prototype.onShow = function() {}; | ||
@@ -1439,0 +1408,0 @@ |
@@ -1021,6 +1021,15 @@ /* | ||
PaginatedCollection.prototype.parse = function(resp) { | ||
this.page = Number(resp.page); | ||
this.perPage = Number(resp.perPage); | ||
this.total = Number(resp.total); | ||
return resp.models; | ||
var result; | ||
if (resp.total && resp.models) { | ||
this.page = Number(resp.page); | ||
this.perPage = Number(resp.perPage); | ||
this.total = Number(resp.total); | ||
return resp.models; | ||
} else { | ||
result = Collection.prototype.parse.call(this, resp); | ||
this.page = 1; | ||
this.perPage = Math.MAX_VALUE; | ||
this.total = result.length; | ||
return result; | ||
} | ||
}; | ||
@@ -1290,5 +1299,2 @@ | ||
ItemView.__super__.constructor.apply(this, arguments); | ||
if (highbrow.browser && this.model) { | ||
this.binder = new Backbone.ModelBinder(); | ||
} | ||
} | ||
@@ -1399,41 +1405,4 @@ | ||
ItemView.prototype.convertBindings = function(bindings) { | ||
var result; | ||
result = {}; | ||
_.each(bindings, function(val, key) { | ||
var member; | ||
if (_.isString(val)) { | ||
return result[key] = val; | ||
} else { | ||
result[key] = { | ||
selector: val[0] | ||
}; | ||
if (member = val[1]) { | ||
return result[key].converter = function(dir, val, attr, model) { | ||
if (dir === 'ModelToView') { | ||
return model[member](); | ||
} else { | ||
return model[member](val); | ||
} | ||
}; | ||
} | ||
} | ||
}); | ||
return result; | ||
}; | ||
ItemView.prototype.onRender = function() {}; | ||
ItemView.prototype.initBindings = function() { | ||
var bindings; | ||
if (this.bindings) { | ||
bindings = this.convertBindings(this.bindings); | ||
return this.binder.bind(this.model, this.$el, bindings); | ||
} | ||
}; | ||
ItemView.prototype.onRender = function() { | ||
if (this.bindings) { | ||
return this.initBindings(); | ||
} | ||
}; | ||
ItemView.prototype.onShow = function() {}; | ||
@@ -1440,0 +1409,0 @@ |
{ "name": "highbrow" | ||
, "version": "0.2.6" | ||
, "version": "0.2.7" | ||
, "description": "A Backbone Base Framework" | ||
@@ -4,0 +4,0 @@ , "main": "lib/highbrow.js" |
322285
5446