From 55466d97a07d4736fb10e8feb47bbca0b7af5760 Mon Sep 17 00:00:00 2001 From: Florian Kraft Date: Tue, 21 Jul 2015 17:15:15 +0200 Subject: [PATCH] show file uploads in kilobytes Signed-off-by: Florian Kraft --- frontend/app/services/conversion-service.js | 6 ++++++ frontend/app/templates/work_packages/attachments.html | 4 ++-- .../directives/work-package-attachments-directive.js | 1 + .../services/work-package-attachments-service.js | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/frontend/app/services/conversion-service.js b/frontend/app/services/conversion-service.js index 1b8a82fe14..06458920ef 100644 --- a/frontend/app/services/conversion-service.js +++ b/frontend/app/services/conversion-service.js @@ -33,6 +33,12 @@ module.exports = function() { return Math.round(bytes / 1000000); } return bytes; + }, + kilobytes: function(bytes) { + if (angular.isNumber(bytes)) { + return Math.round(bytes / 1000); + } + return bytes; } }; }; diff --git a/frontend/app/templates/work_packages/attachments.html b/frontend/app/templates/work_packages/attachments.html index 8995019401..81e8634d45 100644 --- a/frontend/app/templates/work_packages/attachments.html +++ b/frontend/app/templates/work_packages/attachments.html @@ -8,7 +8,7 @@
+ data-ng-disabled="fetchingConfiguration" data-ngf-keep="true">

{{ ::I18n.t('js.label_drop_files') }}

{{ ::I18n.t('js.label_drop_files_hint') }}

{{ ::I18n.t('js.label_wait') }}

@@ -18,7 +18,7 @@ diff --git a/frontend/app/work_packages/directives/work-package-attachments-directive.js b/frontend/app/work_packages/directives/work-package-attachments-directive.js index a090a0bcde..695f83b833 100644 --- a/frontend/app/work_packages/directives/work-package-attachments-directive.js +++ b/frontend/app/work_packages/directives/work-package-attachments-directive.js @@ -71,6 +71,7 @@ module.exports = function( scope.$on('uploadPendingAttachments', upload); scope.I18n = I18n; scope.megabytes = ConversionService.megabytes; + scope.kilobytes = ConversionService.kilobytes; scope.fetchingConfiguration = true; ConfigurationService.api().then(function(settings) { diff --git a/frontend/app/work_packages/services/work-package-attachments-service.js b/frontend/app/work_packages/services/work-package-attachments-service.js index 39388385e5..9dcc93952e 100644 --- a/frontend/app/work_packages/services/work-package-attachments-service.js +++ b/frontend/app/work_packages/services/work-package-attachments-service.js @@ -83,7 +83,7 @@ module.exports = function(Upload, PathHelper, I18n, NotificationsService, $q, $t removal.resolve(fileOrAttachment); }).error(function(err) { removal.reject(err); - }) + }); } else { removal.resolve(fileOrAttachment); }