Skip to content

Commit

Permalink
Update to v0.8.0
Browse files Browse the repository at this point in the history
See release notes
  • Loading branch information
michaelbromley committed Jun 2, 2015
1 parent e86e074 commit 03a308a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 4 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angularUtils-pagination",
"version": "0.7.0",
"version": "0.8.0",
"homepage": "https://github.com/michaelbromley/angularUtils/tree/master/src/directives/pagination",
"authors": [
"Michael Bromley <michael@michaelbromley.co.uk>"
Expand All @@ -10,6 +10,9 @@
"moduleType": [
"globals"
],
"dependencies": [
"angular": ">=1.1.4"
],
"keywords": [
"angularjs",
"pagination",
Expand Down
8 changes: 5 additions & 3 deletions dirPagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
// regex taken directly from https://github.com/angular/angular.js/blob/master/src/ng/directive/ngRepeat.js#L211
var match = expression.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);

var filterPattern = /\|\s*itemsPerPage\s*:[^|]*/;
var filterPattern = /\|\s*itemsPerPage\s*:[^|\)]*/;
if (match[2].match(filterPattern) === null) {
throw 'pagination directive: the \'itemsPerPage\' filter must be set.';
}
Expand Down Expand Up @@ -210,7 +210,7 @@
}

function dirPaginationControlsTemplateInstaller($templateCache) {
$templateCache.put('angularUtils.directives.dirPagination.template', '<ul class="pagination" ng-if="1 < pages.length"><li ng-if="boundaryLinks" ng-class="{ disabled : pagination.current == 1 }"><a href="" ng-click="setCurrent(1)">&laquo;</a></li><li ng-if="directionLinks" ng-class="{ disabled : pagination.current == 1 }"><a href="" ng-click="setCurrent(pagination.current - 1)">&lsaquo;</a></li><li ng-repeat="pageNumber in pages track by $index" ng-class="{ active : pagination.current == pageNumber, disabled : pageNumber == \'...\' }"><a href="" ng-click="setCurrent(pageNumber)">{{ pageNumber }}</a></li><li ng-if="directionLinks" ng-class="{ disabled : pagination.current == pagination.last }"><a href="" ng-click="setCurrent(pagination.current + 1)">&rsaquo;</a></li><li ng-if="boundaryLinks" ng-class="{ disabled : pagination.current == pagination.last }"><a href="" ng-click="setCurrent(pagination.last)">&raquo;</a></li></ul>');
$templateCache.put('angularUtils.directives.dirPagination.template', '<ul class="pagination" ng-if="1 < pages.length || !autoHide"><li ng-if="boundaryLinks" ng-class="{ disabled : pagination.current == 1 }"><a href="" ng-click="setCurrent(1)">&laquo;</a></li><li ng-if="directionLinks" ng-class="{ disabled : pagination.current == 1 }"><a href="" ng-click="setCurrent(pagination.current - 1)">&lsaquo;</a></li><li ng-repeat="pageNumber in pages track by $index" ng-class="{ active : pagination.current == pageNumber, disabled : pageNumber == \'...\' || ( ! autoHide && pages.length === 1 ) }"><a href="" ng-click="setCurrent(pageNumber)">{{ pageNumber }}</a></li><li ng-if="directionLinks" ng-class="{ disabled : pagination.current == pagination.last }"><a href="" ng-click="setCurrent(pagination.current + 1)">&rsaquo;</a></li><li ng-if="boundaryLinks" ng-class="{ disabled : pagination.current == pagination.last }"><a href="" ng-click="setCurrent(pagination.last)">&raquo;</a></li></ul>');
}

function dirPaginationControlsDirective(paginationService, paginationTemplate) {
Expand All @@ -225,7 +225,8 @@
scope: {
maxSize: '=?',
onPageChange: '&?',
paginationId: '=?'
paginationId: '=?',
autoHide: '=?'
},
link: dirPaginationControlsLinkFn
};
Expand All @@ -244,6 +245,7 @@
}

if (!scope.maxSize) { scope.maxSize = 9; }
scope.autoHide = scope.autoHide === undefined ? true : scope.autoHide;
scope.directionLinks = angular.isDefined(attrs.directionLinks) ? scope.$parent.$eval(attrs.directionLinks) : true;
scope.boundaryLinks = angular.isDefined(attrs.boundaryLinks) ? scope.$parent.$eval(attrs.boundaryLinks) : false;

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-utils-pagination",
"version": "0.7.0",
"version": "0.8.0",
"description": "Magical automatic pagination for anything in AngularJS",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 03a308a

Please sign in to comment.