fileEntity.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* eslint-disable
  2. max-len,
  3. no-return-assign,
  4. */
  5. // TODO: This file was created by bulk-decaffeinate.
  6. // Fix any style issues and re-enable lint.
  7. /*
  8. * decaffeinate suggestions:
  9. * DS102: Remove unnecessary code created because of implicit returns
  10. * DS207: Consider shorter variations of null checks
  11. * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
  12. */
  13. import App from '../../../base'
  14. export default App.directive('fileEntity', RecursionHelper => ({
  15. restrict: 'E',
  16. scope: {
  17. entity: '=',
  18. permissions: '=',
  19. depth: '=?',
  20. },
  21. templateUrl: 'entityListItemTemplate',
  22. compile(element) {
  23. return RecursionHelper.compile(
  24. element,
  25. function (scope, element, attrs, ctrl) {
  26. // Don't freak out if we're already in an apply callback
  27. scope.$originalApply = scope.$apply
  28. return (scope.$apply = function (fn) {
  29. if (fn == null) {
  30. fn = function () {}
  31. }
  32. const phase = this.$root.$$phase
  33. if (phase === '$apply' || phase === '$digest') {
  34. return fn()
  35. } else {
  36. return this.$originalApply(fn)
  37. }
  38. })
  39. }
  40. )
  41. },
  42. }))