Fixed item of range

This commit is contained in:
Michael Abashian 2017-07-18 17:37:36 -04:00
parent 5dc354ee4b
commit f3880e76a1
2 changed files with 3 additions and 7 deletions

View File

@ -41,10 +41,6 @@ export default ['$scope', '$stateParams', '$state', '$filter', 'GetBasePath', 'Q
$scope.toPage();
};
$scope.dataCount = function() {
return $filter('number')($scope.dataset.count);
};
$scope.toPage = function(page) {
if(page === 0 || page > $scope.last) {
return;
@ -132,7 +128,7 @@ export default ['$scope', '$stateParams', '$state', '$filter', 'GetBasePath', 'Q
return `1 - ${$scope.pageSize}`;
} else {
let floor = (($scope.current - 1) * parseInt($scope.pageSize)) + 1;
let ceil = floor + parseInt($scope.pageSize) < $scope.dataset.count ? floor + parseInt($scope.pageSize) : $scope.dataset.count;
let ceil = floor + parseInt($scope.pageSize) - 1 < $scope.dataset.count ? floor + parseInt($scope.pageSize) - 1 : $scope.dataset.count;
return `${floor} - ${ceil}`;
}
}

View File

@ -35,14 +35,14 @@
<span id="total-pages">{{last}}</span>
</span>
</div>
<div class="Paginate-total page-label" ng-hide="dataCount === 0">
<div class="Paginate-total page-label" ng-hide="dataset.count === 0">
<!-- TODO: Move the ITEMS line into paginate.directive.js
so that i18n.sprintf("A of B") can be used but
it seems $sce.trustAsHtml() does not work with html tag.
-->
<span class="Paginate-itemsOf" translate>ITEMS&nbsp;
<span>{{dataRange}}</span>
<span ng-hide="dataset.count <= basePageSize">of {{dataCount()}}</span>
<span ng-hide="dataset.count <= basePageSize">of {{dataset.count | number}}</span>
</span>
<div class="Paginate-filteringDropdowns" ng-hide="hideViewPerPage || dataset.count <= basePageSize">
<div class="Paginate-filterLabel" translate>VIEW PER PAGE</div>