WordCountModalController.js 998 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* eslint-disable
  2. max-len,
  3. no-return-assign,
  4. no-undef,
  5. */
  6. // TODO: This file was created by bulk-decaffeinate.
  7. // Fix any style issues and re-enable lint.
  8. /*
  9. * decaffeinate suggestions:
  10. * DS102: Remove unnecessary code created because of implicit returns
  11. * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
  12. */
  13. define(['base'], App =>
  14. App.controller('WordCountModalController', function(
  15. $scope,
  16. $modalInstance,
  17. ide,
  18. $http
  19. ) {
  20. $scope.status = { loading: true }
  21. const opts = {
  22. url: `/project/${ide.project_id}/wordcount`,
  23. method: 'GET',
  24. params: {
  25. clsiserverid: ide.clsiServerId
  26. }
  27. }
  28. $http(opts)
  29. .then(function(response) {
  30. const { data } = response
  31. $scope.status.loading = false
  32. return ($scope.data = data.texcount)
  33. })
  34. .catch(() => ($scope.status.error = true))
  35. return ($scope.cancel = () => $modalInstance.dismiss('cancel'))
  36. }))