/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

  1. var Project = Backbone.Model.extend({
  2. sync: function(method, model, options) {
  3. switch(method) {
  4. case "read":
  5. JSTACK.Keystone.gettenants(model.get("id"), options.success);
  6. break;
  7. case "delete":
  8. JSTACK.Keystone.deletetenant(model.get("id"), options.success);
  9. break;
  10. case "create":
  11. JSTACK.Keystone.createtenant(model.get("id"), options.success);
  12. break;
  13. case "filter":
  14. JSTACK.Keystone.filtertenant(model.get("id"), options.success);
  15. break;
  16. }
  17. }
  18. });
  19. var Projects = Backbone.Collection.extend({
  20. model: Project,
  21. sync: function(method, model, options) {
  22. switch(method) {
  23. case "read":
  24. JSTACK.Keystone.gettenants(options.success);
  25. break;
  26. }
  27. },
  28. parse: function(resp) {
  29. return resp.tenants;
  30. }
  31. });