/js/models/ProjectModel.js
http://github.com/ging/horizon-js · JavaScript · 35 lines · 31 code · 4 blank · 0 comment · 0 complexity · bd39bdc49f4c13a772876ea86654a2b2 MD5 · raw file
- var Project = Backbone.Model.extend({
- sync: function(method, model, options) {
- switch(method) {
- case "read":
- JSTACK.Keystone.gettenants(model.get("id"), options.success);
- break;
- case "delete":
- JSTACK.Keystone.deletetenant(model.get("id"), options.success);
- break;
- case "create":
- JSTACK.Keystone.createtenant(model.get("id"), options.success);
- break;
- case "filter":
- JSTACK.Keystone.filtertenant(model.get("id"), options.success);
- break;
- }
- }
- });
- var Projects = Backbone.Collection.extend({
- model: Project,
-
- sync: function(method, model, options) {
- switch(method) {
- case "read":
- JSTACK.Keystone.gettenants(options.success);
- break;
- }
- },
-
- parse: function(resp) {
- return resp.tenants;
- }
-
- });