Requires

Provides

Resource.js

Make various requests to back end

License:
Public domain (http://unlicense.org).
  1. 22
  2. 23
  3. 24
  4. 25
  5. 26
  6. 27
  7. 28
  8. 29
  9. 30
  10. 31
  11. 32
  12. 33
  13. 34
  14. 35
  15. 36
  16. 37
  17. 38
  18. 39
  19. 40
  20. 41
  21. 42
  22. 43
  23. 44
  24. 45
  25. 46
  26. 47
  27. 48
  28. 49
  29. 50
  30. 51
  31. 52
  32. 53
  33. 54
  34. 55
  35. 56
  36. 57
  37. 58
  38. 59
  39. 60
  40. 61
  41. 62
  42. 63
  43. 64
  44. 65
LSD.Mixin.Resource = new Class({ behaviour: ":resourceful, [itemscope]", options: { resource: { prefix: null, name: null } }, getResource: function(options) { if (!options) options = this.options.resource if (!this.resource) { var name = options.name; var prefix = options.prefix; if (!name || !prefix) { var uri = this.attributes.itemscope; if (uri) { if (uri.toURI) uri = uri.toURI(); prefix = uri.get('directory'); name = uri.get('file'); if (!name) { var dirs = prefix.split('/'); name = dirs.pop(); prefix = dirs.join('/') } name = name.singularize(); } } var options = Object.clone(this.options.resource); if (prefix) options.prefix = prefix; this.resource = new Resource(name, options); } return this.resource; }, getResourceID: function() { return this.attributes.itemid; }, getModel: function() { return this.getResource().init(this.getResourceID() || this.element); } });