VGlossaryList.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. define([ "require", "utils/Globals", "collection/BaseCollection", "models/VGlossary", "utils/UrlLinks" ], function(require, Globals, BaseCollection, VGlossary, UrlLinks) {
  2. "use strict";
  3. var VGlossaryList = BaseCollection.extend({
  4. url: UrlLinks.glossaryApiUrl(),
  5. model: VGlossary,
  6. initialize: function() {
  7. this.modelName = "VGlossary", this.modelAttrName = "";
  8. },
  9. parseRecords: function(resp, options) {
  10. return _.isEmpty(this.modelAttrName) ? resp : resp[this.modelAttrName];
  11. },
  12. getCategory: function(options) {
  13. var url = UrlLinks.categoryApiUrl({
  14. guid: options.guid,
  15. related: options.related
  16. }), apiOptions = _.extend({
  17. contentType: "application/json",
  18. dataType: "json"
  19. }, options.ajaxOptions);
  20. return this.constructor.nonCrudOperation.call(this, url, "GET", apiOptions);
  21. },
  22. getTerm: function(options) {
  23. var url = UrlLinks.termApiUrl({
  24. guid: options.guid,
  25. related: options.related
  26. }), apiOptions = _.extend({
  27. contentType: "application/json",
  28. dataType: "json"
  29. }, options.ajaxOptions);
  30. return this.constructor.nonCrudOperation.call(this, url, "GET", apiOptions);
  31. }
  32. }, {
  33. tableCols: {}
  34. });
  35. return VGlossaryList;
  36. });