FileTreeRootFolderController.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. /* eslint-disable
  2. camelcase,
  3. max-len,
  4. no-return-assign,
  5. no-undef,
  6. */
  7. // TODO: This file was created by bulk-decaffeinate.
  8. // Fix any style issues and re-enable lint.
  9. /*
  10. * decaffeinate suggestions:
  11. * DS101: Remove unnecessary use of Array.from
  12. * DS102: Remove unnecessary code created because of implicit returns
  13. * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
  14. */
  15. define(['base'], App =>
  16. App.controller('FileTreeRootFolderController', function($scope, ide) {
  17. const { rootFolder } = $scope
  18. return ($scope.onDrop = function(events, ui) {
  19. let entities
  20. if (ide.fileTreeManager.multiSelectedCount()) {
  21. entities = ide.fileTreeManager.getMultiSelectedEntityChildNodes()
  22. } else {
  23. entities = [$(ui.draggable).scope().entity]
  24. }
  25. for (let dropped_entity of Array.from(entities)) {
  26. ide.fileTreeManager.moveEntity(dropped_entity, rootFolder)
  27. }
  28. $scope.$digest()
  29. // clear highlight explicitly
  30. return $('.file-tree-inner .droppable-hover').removeClass(
  31. 'droppable-hover'
  32. )
  33. })
  34. }))