show file uploads in kilobytes

Signed-off-by: Florian Kraft <f.kraft@finn.de>
pull/3245/head
Florian Kraft 9 years ago
parent 66e359e66d
commit 55466d97a0
  1. 6
      frontend/app/services/conversion-service.js
  2. 4
      frontend/app/templates/work_packages/attachments.html
  3. 1
      frontend/app/work_packages/directives/work-package-attachments-directive.js
  4. 2
      frontend/app/work_packages/services/work-package-attachments-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;
}
};
};

@ -8,7 +8,7 @@
</div>
<div data-ngf-drop data-ng-model="files" data-ng-model-rejected="rejectedFiles" data-ngf-select class="work-package--attachments--drop-box"
data-ngf-multiple="true" data-ngf-allow-dir="true" data-ngf-keep-distinct data-ngf-max-size="{{::maximumFileSize}}"
data-ng-disabled="fetchingConfiguration" data-ngf-keep>
data-ng-disabled="fetchingConfiguration" data-ngf-keep="true">
<p data-ng-hide="fetchingConfiguration" class="work-package--attachments--label">{{ ::I18n.t('js.label_drop_files') }}</p>
<p data-ng-hide="fetchingConfiguration" class="work-package--attachments--hint">{{ ::I18n.t('js.label_drop_files_hint') }}</p>
<p data-ng-show="fetchingConfiguration" class="work-package--attachments--label">{{ ::I18n.t('js.label_wait') }}</p>
@ -18,7 +18,7 @@
<ul>
<li data-ng-repeat="file in files">
<attachment-icon type="file.type"></attachment-icon>
<span class="filename">{{::file.name}}</span> <span class="filesize">({{::megabytes(file.size)}}MB)</span>
<span class="filename">{{::file.name}}</span> <span class="filesize">({{::kilobytes(file.size)}}kB)</span>
<a data-ng-click="remove(file)" class="button -with-icon icon-delete -tiny" title="{{::I18n.t('js.label_remove_file')}}">{{::I18n.t('js.label_remove_file')}}</a>
</li>
</ul>

@ -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) {

@ -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);
}

Loading…
Cancel
Save