You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

commentsummarymodel.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright (c) 2016
  3. *
  4. * This file is licensed under the Affero General Public License version 3
  5. * or later.
  6. *
  7. * See the COPYING-README file.
  8. *
  9. */
  10. (function(OC, OCA) {
  11. var NS_OWNCLOUD = 'http://owncloud.org/ns';
  12. /**
  13. * @class OCA.Comments.CommentSummaryModel
  14. * @classdesc
  15. *
  16. * Model containing summary information related to comments
  17. * like the read marker.
  18. *
  19. */
  20. var CommentSummaryModel = OC.Backbone.Model.extend(
  21. /** @lends OCA.Comments.CommentSummaryModel.prototype */ {
  22. sync: OC.Backbone.davSync,
  23. /**
  24. * Object type
  25. *
  26. * @type string
  27. */
  28. _objectType: 'files',
  29. /**
  30. * Object id
  31. *
  32. * @type string
  33. */
  34. _objectId: null,
  35. davProperties: {
  36. 'readMarker': '{' + NS_OWNCLOUD + '}readMarker'
  37. },
  38. /**
  39. * Initializes the summary model
  40. *
  41. * @param {string} [options.objectType] object type
  42. * @param {string} [options.objectId] object id
  43. */
  44. initialize: function(attrs, options) {
  45. options = options || {};
  46. if (options.objectType) {
  47. this._objectType = options.objectType;
  48. }
  49. },
  50. url: function() {
  51. return OC.linkToRemote('dav') + '/comments/' +
  52. encodeURIComponent(this._objectType) + '/' +
  53. encodeURIComponent(this.id) + '/';
  54. }
  55. });
  56. OCA.Comments.CommentSummaryModel = CommentSummaryModel;
  57. })(OC, OCA);