From 0c554c20e6f6eb749f5422c774d7ef0e9bc08cf7 Mon Sep 17 00:00:00 2001 From: llj Date: Fri, 7 Dec 2012 16:46:53 +0800 Subject: [PATCH] improved file uploading progress text --- locale/zh_CN/LC_MESSAGES/django.po | 9 ++++++--- media/js/utils.js | 2 +- templates/file_upload_progress_page.html | 2 +- templates/repo.html | 4 ++-- templates/snippets/file_upload_progress_js.html | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/locale/zh_CN/LC_MESSAGES/django.po b/locale/zh_CN/LC_MESSAGES/django.po index 6be4c41176..e5f31244bf 100644 --- a/locale/zh_CN/LC_MESSAGES/django.po +++ b/locale/zh_CN/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-12-06 18:08+0800\n" +"POT-Creation-Date: 2012-12-07 16:31+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -932,8 +932,8 @@ msgid "smaller than" msgstr "文件总大小小于" #: templates/repo.html:183 templates/repo.html.py:206 -msgid "Uploading rate:" -msgstr "上传速度:" +msgid "Uploaded:" +msgstr "上传进度:" #: templates/repo.html:183 msgid "Fetching ..." @@ -1886,6 +1886,9 @@ msgstr "名字(可选)" msgid "Note(optional)" msgstr "备注(可选)" +#~ msgid "Uploading rate:" +#~ msgstr "上传速度:" + #~ msgid "Selected files will be populated here..." #~ msgstr "所选的文件会显示在这里..." diff --git a/media/js/utils.js b/media/js/utils.js index 93fe402d63..1e134d864e 100644 --- a/media/js/utils.js +++ b/media/js/utils.js @@ -228,7 +228,7 @@ function filesizeformat(bytes, precision) { var gigabyte = megabyte * 1024; var terabyte = gigabyte * 1024; - precision = precision || 0; + var precision = precision || 0; if ((bytes >= 0) && (bytes < kilobyte)) { return bytes + ' B'; diff --git a/templates/file_upload_progress_page.html b/templates/file_upload_progress_page.html index c2ab539517..977a4b042b 100644 --- a/templates/file_upload_progress_page.html +++ b/templates/file_upload_progress_page.html @@ -11,7 +11,7 @@ cache: false, success: function(data) { if (data) { - $(dialog_id + ' #upload-progress-text', window.parent.document).html(filesizeformat(data.uploaded) + ' / ' + filesizeformat(data.length)); + $(dialog_id + ' #upload-progress-text', window.parent.document).html(filesizeformat(data.uploaded, 2) + ' / ' + filesizeformat(data.length, 2)); $(dialog_id + ' #task-progress-bar', window.parent.document).removeClass('hide').progressbar({ value: data.uploaded / data.length * 100 }); diff --git a/templates/repo.html b/templates/repo.html index ed70db6b45..a136ff431e 100644 --- a/templates/repo.html +++ b/templates/repo.html @@ -180,7 +180,7 @@
-

{% trans "Uploading rate:" %} {% trans "Fetching ..." %}

+

{% trans "Uploaded:" %} {% trans "Fetching ..." %}

@@ -203,7 +203,7 @@
-

{% trans "Uploading rate:" %} {% trans "Fetching..." %}

+

{% trans "Uploaded:" %} {% trans "Fetching..." %}

diff --git a/templates/snippets/file_upload_progress_js.html b/templates/snippets/file_upload_progress_js.html index 6d796ac4a6..c45db6ebf7 100644 --- a/templates/snippets/file_upload_progress_js.html +++ b/templates/snippets/file_upload_progress_js.html @@ -27,7 +27,7 @@ function submit_and_real_time_show (dialog_id) { cache: false, success: function(data) { if (data) { - $(dialog_id + ' #upload-progress-text').html(filesizeformat(data.uploaded) + ' / ' + filesizeformat(data.length)); + $(dialog_id + ' #upload-progress-text').html(filesizeformat(data.uploaded, 2) + ' / ' + filesizeformat(data.length, 2)); $(dialog_id + ' #task-progress-bar').removeClass('hide').progressbar({ value: data.uploaded / data.length * 100 });