WordCountModalController.js 961 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
  11. */
  12. import App from '../../../base'
  13. export default App.controller('WordCountModalController', function(
  14. $scope,
  15. $modalInstance,
  16. ide,
  17. $http
  18. ) {
  19. $scope.status = { loading: true }
  20. const opts = {
  21. url: `/project/${ide.project_id}/wordcount`,
  22. method: 'GET',
  23. params: {
  24. clsiserverid: ide.clsiServerId
  25. }
  26. }
  27. $http(opts)
  28. .then(function(response) {
  29. const { data } = response
  30. $scope.status.loading = false
  31. return ($scope.data = data.texcount)
  32. })
  33. .catch(() => ($scope.status.error = true))
  34. return ($scope.cancel = () => $modalInstance.dismiss('cancel'))
  35. })