CustomSaveLocationController.js 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. "use strict";
  2. define(['underscore', 'bi/commons/ui/core/Class'], function (_, Class) {
  3. 'use strict';
  4. var CustomSaveLocationController = Class.extend({
  5. init: function init(options) {
  6. CustomSaveLocationController.inherited('init', this, arguments);
  7. _.extend(this, options);
  8. this._previousValue = this.currentValue;
  9. },
  10. _isCurrentValueDefined: function _isCurrentValueDefined() {
  11. return !_.isUndefined(this.currentValue) && !_.isNull(this.currentValue) && this.currentValue && this.currentValue !== ".my_folders" && _.isString(this.currentValue);
  12. },
  13. _getRequestEndpoint: function _getRequestEndpoint(contentSvc) {
  14. return contentSvc.getSearchPathUrl(this.currentValue);
  15. },
  16. _setContentPath: function _setContentPath(selectedObject) {
  17. var searchPath = selectedObject[0].searchPath;
  18. this.currentValue = searchPath;
  19. },
  20. setDefaultValue: function setDefaultValue() {
  21. this.currentValue = ".my_folders";
  22. },
  23. isValueChanged: function isValueChanged() {
  24. return this._previousValue !== this.currentValue;
  25. }
  26. });
  27. return CustomSaveLocationController;
  28. });