refactor code

This commit is contained in:
MaysWind 2016-06-04 14:05:37 +08:00
parent 2dff6fd9c7
commit 244aac0f3a
6 changed files with 20 additions and 18 deletions

View file

@ -50,7 +50,6 @@
"Remain Time": "剩余时间", "Remain Time": "剩余时间",
"Download Speed": "下载速度", "Download Speed": "下载速度",
"Upload Speed": "上传速度", "Upload Speed": "上传速度",
"Files": "个文件",
"Overview": "总览", "Overview": "总览",
"Blocks": "区块信息", "Blocks": "区块信息",
"File List": "文件列表", "File List": "文件列表",
@ -83,7 +82,6 @@
"Loading": "正在加载...", "Loading": "正在加载...",
"More Than One Day": "超过1天", "More Than One Day": "超过1天",
"Unknown": "未知", "Unknown": "未知",
"Total Count": "共计",
"Bytes": "字节", "Bytes": "字节",
"Hours": "小时", "Hours": "小时",
"Minutes": "分", "Minutes": "分",
@ -114,7 +112,10 @@
"time.minute": "{{value}} 分钟", "time.minute": "{{value}} 分钟",
"time.minutes": "{{value}} 分钟", "time.minutes": "{{value}} 分钟",
"time.hour": "{{value}} 小时", "time.hour": "{{value}} 小时",
"time.hours": "{{value}} 小时" "time.hours": "{{value}} 小时",
"task.error-occurred": "发生错误 ({{errorcode}})",
"settings.file-count": "({{count}} 个文件)",
"settings.total-count": "(共计: {{count}}个)"
}, },
"options": { "options": {
"dir.name": "下载路径", "dir.name": "下载路径",

View file

@ -54,7 +54,6 @@
'Remain Time': 'Remain', 'Remain Time': 'Remain',
'Download Speed': 'Download Speed', 'Download Speed': 'Download Speed',
'Upload Speed': 'Upload Speed', 'Upload Speed': 'Upload Speed',
'Files': 'Files',
'Overview': 'Overview', 'Overview': 'Overview',
'Blocks': 'Blocks', 'Blocks': 'Blocks',
'File List': 'File List', 'File List': 'File List',
@ -87,7 +86,6 @@
'Loading': 'Loading...', 'Loading': 'Loading...',
'More Than One Day': 'More than 1 day', 'More Than One Day': 'More than 1 day',
'Unknown': 'Unknown', 'Unknown': 'Unknown',
'Total Count': 'Total Count',
'Bytes': 'Bytes', 'Bytes': 'Bytes',
'Hours': 'Hours', 'Hours': 'Hours',
'Minutes': 'Minutes', 'Minutes': 'Minutes',
@ -119,6 +117,9 @@
'time.minutes': '{{value}} Minutes', 'time.minutes': '{{value}} Minutes',
'time.hour': '{{value}} Hour', 'time.hour': '{{value}} Hour',
'time.hours': '{{value}} Hours', 'time.hours': '{{value}} Hours',
'task.error-occurred': 'Error Occurred ({{errorcode}})',
'settings.file-count': '({{count}} Files)',
'settings.total-count': '(Total Count: {{count}})'
}, },
'options': { 'options': {
'dir.name': 'Download Path', 'dir.name': 'Download Path',

View file

@ -1,7 +1,7 @@
(function () { (function () {
'use strict'; 'use strict';
angular.module("ariaNg").filter('taskStatus', ['$translate', function ($translate) { angular.module("ariaNg").filter('taskStatus', function () {
return function (task) { return function (task) {
if (!task) { if (!task) {
return ''; return '';
@ -9,23 +9,23 @@
if (task.status == 'active') { if (task.status == 'active') {
if (task.seeder === true || task.seeder === 'true') { if (task.seeder === true || task.seeder === 'true') {
return $translate.instant('Seeding'); return 'Seeding';
} else { } else {
return $translate.instant('Downloading'); return 'Downloading';
} }
} else if (task.status == 'waiting') { } else if (task.status == 'waiting') {
return $translate.instant('Waiting'); return 'Waiting';
} else if (task.status == 'paused') { } else if (task.status == 'paused') {
return $translate.instant('Paused'); return 'Paused';
} else if (task.status == 'complete') { } else if (task.status == 'complete') {
return $translate.instant('Completed'); return 'Completed';
} else if (task.status == 'error') { } else if (task.status == 'error') {
return $translate.instant('Error Occurred') + (task.errorCode ? ' (' + task.errorCode + ')' : ''); return (task.errorCode ? 'format.task.error-occurred' : 'Error Occurred');
} else if (task.status == 'removed') { } else if (task.status == 'removed') {
return $translate.instant('Removed'); return 'Removed';
} else { } else {
return ''; return '';
} }
} }
}]); });
})(); })();

View file

@ -44,7 +44,7 @@
<div class="task-files"> <div class="task-files">
<span ng-bind="task.totalLength | readableVolumn"></span> <span ng-bind="task.totalLength | readableVolumn"></span>
<a ng-href="#/task/detail/{{task.gid}}"> <a ng-href="#/task/detail/{{task.gid}}">
<span ng-bind="'(' + task.files.length + ' ' + ('Files' | translate) + ')'"></span> <span ng-if="task.files" ng-bind="('format.settings.file-count' | translate: {count: task.files.length})"></span>
</a> </a>
</div> </div>
</div> </div>

View file

@ -5,7 +5,7 @@
<i class="icon-primary fa fa-question-circle" data-toggle="tooltip" data-placement="right" <i class="icon-primary fa fa-question-circle" data-toggle="tooltip" data-placement="right"
title="{{option.descriptionKey | translate}}" ng-if="(option.descriptionKey | translate) != ''"></i> title="{{option.descriptionKey | translate}}" ng-if="(option.descriptionKey | translate) != ''"></i>
<span class="description" ng-if="option.showCount && option.split && optionValue" <span class="description" ng-if="option.showCount && option.split && optionValue"
ng-bind="'(' + ('Total Count' | translate) + ': ' + getTotalCount() + ')'"></span> ng-bind="'format.settings.total-count' | translate: {count: getTotalCount()}"></span>
</div> </div>
<div class="setting-value col-sm-8"> <div class="setting-value col-sm-8">
<div ng-class="{'input-group': option.suffix}"> <div ng-class="{'input-group': option.suffix}">

View file

@ -37,7 +37,7 @@
</div> </div>
<div class="setting-value col-sm-8"> <div class="setting-value col-sm-8">
<span ng-bind="task.totalLength | readableVolumn"></span> <span ng-bind="task.totalLength | readableVolumn"></span>
<span ng-bind="'(' + task.files.length + ' ' + ('Files' | translate) + ')'"></span> <span ng-if="task.files" ng-bind="('format.settings.file-count' | translate: {count: task.files.length})"></span>
</div> </div>
</div> </div>
<div class="row" ng-if="task"> <div class="row" ng-if="task">
@ -45,7 +45,7 @@
<span translate>Task Status</span> <span translate>Task Status</span>
</div> </div>
<div class="setting-value col-sm-8"> <div class="setting-value col-sm-8">
<span ng-bind="task | taskStatus"></span> <span ng-bind="task | taskStatus | translate: {errorcode: task.errorCode}"></span>
</div> </div>
</div> </div>
<div class="row" ng-if="task && task.status == 'error' && task.errorMessage"> <div class="row" ng-if="task && task.status == 'error' && task.errorMessage">