fixed angular waiting downloads bug

This commit is contained in:
hamza zia 2013-03-18 10:51:03 +01:00
parent aa84b4cafa
commit 8b3b30dd4a
2 changed files with 13 additions and 7 deletions

View File

@ -339,25 +339,25 @@
<!-- }}} --> <!-- }}} -->
<!-- {{{ paused download statistics --> <!-- {{{ paused download statistics -->
<li <li
ng-show="hasStatus(download, 'paused')" ng-show="hasStatus(download, ['paused', 'waiting'])"
class="label label-info"> class="label label-info">
<span>Status: {{download.status}}</span> <span>Status: {{download.status}}</span>
</li> </li>
<li <li
ng-show="hasStatus(download, 'paused')" ng-show="hasStatus(download, ['paused', 'waiting'])"
class="label label-info"> class="label label-info">
<span>Size: {{download.totalLength | blength}}</span> <span>Size: {{download.totalLength | blength}}</span>
</li> </li>
<li <li
ng-show="hasStatus(download, 'paused')" ng-show="hasStatus(download, ['paused', 'waiting'])"
class="label label-info hidden-phone"> class="label label-info hidden-phone">
<span>Downloaded: {{download.completedLength | blength}}</span> <span>Downloaded: {{download.completedLength | blength}}</span>
</li> </li>
<li <li
ng-show="hasStatus(download, 'paused')" ng-show="hasStatus(download, ['paused', 'waiting'])"
class="label label-info hidden-phone"> class="label label-info hidden-phone">
<span>Path: {{download.dir}}</span> <span>Path: {{download.dir}}</span>
</li> </li>
@ -433,7 +433,7 @@
<div class="bar" style="width: {{getProgress(download)}}%;"></div> <div class="bar" style="width: {{getProgress(download)}}%;"></div>
</div> </div>
<div ng-show="hasStatus(download, 'paused')" class="progress progress-info progress-striped" style="width: 100%; margin: 0; padding: 0;"> <div ng-show="hasStatus(download, ['paused', 'waiting'])" class="progress progress-info progress-striped" style="width: 100%; margin: 0; padding: 0;">
<div class="bar" style="width: {{getProgress(download)}}%;"></div> <div class="bar" style="width: {{getProgress(download)}}%;"></div>
</div> </div>

View File

@ -147,8 +147,14 @@ function(
return false; return false;
}; };
scope.hasStatus = function(d, status) { scope.hasStatus = function hasStatus(d, status) {
if (_.isArray(status)) {
if (status.length == 0) return false;
return hasStatus(d, status[0]) || hasStatus(d, status.slice(1));
}
else {
return d.status == status; return d.status == status;
}
}; };
// get time left for the download with // get time left for the download with