sharetabview.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (c) 2015
  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() {
  11. var TEMPLATE =
  12. '<div><ul>{{#if owner}}<li>Owner: {{owner}}</li>{{/if}}</ul></div>';
  13. /**
  14. * @memberof OCA.Sharing
  15. */
  16. var ShareTabView = OCA.Files.DetailTabView.extend(
  17. /** @lends OCA.Sharing.ShareTabView.prototype */ {
  18. id: 'shareTabView',
  19. className: 'tab shareTabView',
  20. _template: null,
  21. getLabel: function() {
  22. return t('files_sharing', 'Sharing');
  23. },
  24. /**
  25. * Renders this details view
  26. */
  27. render: function() {
  28. this.$el.empty();
  29. if (!this._template) {
  30. this._template = Handlebars.compile(TEMPLATE);
  31. }
  32. if (this.model) {
  33. console.log(this.model);
  34. var owner = this.model.get('shareOwner');
  35. if (owner === OC.currentUser) {
  36. owner = null;
  37. }
  38. this.$el.append(this._template({
  39. owner: owner
  40. }));
  41. } else {
  42. // TODO: render placeholder text?
  43. }
  44. }
  45. });
  46. OCA.Sharing.ShareTabView = ShareTabView;
  47. })();