81:c67e1a77c996
Anton Shestakov <av6@dwimlabs.net>, Wed, 06 Apr 2016 13:23:50 +0800
provision: gzip static files (.css and .js)

next change 140:2e975ca4302e
previous change 43:d1ff547fa61d

static/js/framework/models.js

Permissions: -rw-r--r--

Other formats: Feeds:
var Model = Backbone.Model.extend({
url: function() {
var url = Backbone.Model.prototype.url.call(this);
return url[url.length - 1] == '/' ? url : url + '/';
},
adhoc: function(data) {
var model = this;
var options = {
contentType: 'application/json',
data: JSON.stringify(data)
};
return (this.sync || Backbone.sync).call(this, 'update', model, options).then(function(serverAttrs) {
model.set(serverAttrs);
});
}
});
var Workspace = Backbone.Model.extend({
idAttribute: 'name'
});
var Project = Model.extend({
idAttribute: '_id',
switchColor: function() {
var colorChain = [null, 'info', 'success', 'warning', 'danger'];
var currentColorIndex = colorChain.indexOf(this.get('color') || null);
var nextColor = colorChain[(currentColorIndex + 1) % colorChain.length];
return this.adhoc({color: nextColor});
}
});
var Task = Model.extend({
idAttribute: '_id'
});