TeamFolderController.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. "use strict";
  2. define(['underscore', 'bi/commons/ui/core/Class'], function (_, Class) {
  3. 'use strict';
  4. var TeamFolderController = Class.extend({
  5. init: function init(options) {
  6. TeamFolderController.inherited('init', this, arguments);
  7. _.extend(this, options);
  8. this._previousValue = this.currentValue;
  9. },
  10. _isCurrentValueDefined: function _isCurrentValueDefined() {
  11. return this.currentValue && this.currentValue.pathRef;
  12. },
  13. _getRequestEndpoint: function _getRequestEndpoint(contentSvc) {
  14. return contentSvc.getPathUrl(this.currentValue.pathRef);
  15. },
  16. _setContentPath: function _setContentPath(selectedObject) {
  17. var pathUrl = selectedObject[0]._meta.links.path.url;
  18. var pathRef = decodeURIComponent(pathUrl.substring(pathUrl.indexOf('=') + 1));
  19. this.currentValue = {
  20. pathRef: pathRef
  21. };
  22. },
  23. setDefaultValue: function setDefaultValue() {
  24. this.currentValue = {};
  25. },
  26. isValueChanged: function isValueChanged() {
  27. return this._previousValue.pathRef !== this.currentValue.pathRef;
  28. }
  29. });
  30. return TeamFolderController;
  31. });