Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Commit

Permalink
feat(pagination): support bootstrap3
Browse files Browse the repository at this point in the history
  • Loading branch information
bekos authored and pkozlowski-opensource committed Dec 28, 2013
1 parent c409fdc commit 3db699d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 20 deletions.
12 changes: 7 additions & 5 deletions src/pagination/docs/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@
<h4>Default</h4>

<pagination total-items="totalItems" page="currentPage"></pagination>
<pagination boundary-links="true" total-items="totalItems" page="currentPage" class="pagination-small" previous-text="&lsaquo;" next-text="&rsaquo;" first-text="&laquo;" last-text="&raquo;"></pagination>
<pagination boundary-links="true" total-items="totalItems" page="currentPage" class="pagination-sm" previous-text="&lsaquo;" next-text="&rsaquo;" first-text="&laquo;" last-text="&raquo;"></pagination>
<pagination direction-links="false" boundary-links="true" total-items="totalItems" page="currentPage"></pagination>
<pagination direction-links="false" total-items="totalItems" page="currentPage" num-pages="smallnumPages"></pagination>

<button class="btn" ng-click="setPage(3)">Set current page to: 3</button>
The selected page no: {{currentPage}}
<div>
<button class="btn btn-info" ng-click="setPage(3)">Set current page to: 3</button>
The selected page no: {{currentPage}}
</div>

<hr />
<h4>Pager</h4>
<pager total-items="totalItems" page="currentPage"></pager>

<hr />
<h4>Limit the maximum visible buttons</h4>
<pagination total-items="bigTotalItems" page="bigCurrentPage" max-size="maxSize" class="pagination-small" boundary-links="true"></pagination>
<pagination total-items="bigTotalItems" page="bigCurrentPage" max-size="maxSize" class="pagination-small" boundary-links="true" rotate="false" num-pages="numPages"></pagination>
<pagination total-items="bigTotalItems" page="bigCurrentPage" max-size="maxSize" class="pagination-sm" boundary-links="true"></pagination>
<pagination total-items="bigTotalItems" page="bigCurrentPage" max-size="maxSize" class="pagination-sm" boundary-links="true" rotate="false" num-pages="numPages"></pagination>

<pre>Page: {{bigCurrentPage}} / {{numPages}}</pre>
</div>
11 changes: 4 additions & 7 deletions src/pagination/test/pagination.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ describe('pagination directive', function () {
expect(element.hasClass('pagination')).toBe(true);
});

it('contains one ul and num-pages + 2 li elements', function() {
expect(element.find('ul').length).toBe(1);
it('contains num-pages + 2 li elements', function() {
expect(getPaginationBarSize()).toBe(7);
expect(getPaginationEl(0).text()).toBe('Previous');
expect(getPaginationEl(-1).text()).toBe('Next');
Expand Down Expand Up @@ -267,8 +266,7 @@ describe('pagination directive', function () {
$rootScope.$digest();
}));

it('contains one ul and maxsize + 4 elements', function() {
expect(element.find('ul').length).toBe(1);
it('contains maxsize + 4 elements', function() {
expect(getPaginationBarSize()).toBe($rootScope.maxSize + 4);
expect(getPaginationEl(0).text()).toBe('Previous');
expect(getPaginationEl(1).text()).toBe('...');
Expand Down Expand Up @@ -327,8 +325,7 @@ describe('pagination directive', function () {
$rootScope.$digest();
}));

it('contains one ul and num-pages + 4 li elements', function() {
expect(element.find('ul').length).toBe(1);
it('contains num-pages + 4 li elements', function() {
expect(getPaginationBarSize()).toBe(9);
expect(getPaginationEl(0).text()).toBe('First');
expect(getPaginationEl(1).text()).toBe('Previous');
Expand Down Expand Up @@ -421,7 +418,7 @@ describe('pagination directive', function () {
$rootScope.$digest();
}));

it('contains one ul and num-pages li elements', function() {
it('contains num-pages li elements', function() {
expect(getPaginationBarSize()).toBe(5);
expect(getPaginationEl(0).text()).toBe('1');
expect(getPaginationEl(-1).text()).toBe('5');
Expand Down
8 changes: 3 additions & 5 deletions template/pagination/pager.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<div class="pager">
<ul>
<li ng-repeat="page in pages" ng-class="{disabled: page.disabled, previous: page.previous, next: page.next}"><a ng-click="selectPage(page.number)">{{page.text}}</a></li>
</ul>
</div>
<ul class="pager">
<li ng-repeat="page in pages" ng-class="{disabled: page.disabled, previous: page.previous, next: page.next}"><a ng-click="selectPage(page.number)">{{page.text}}</a></li>
</ul>
5 changes: 2 additions & 3 deletions template/pagination/pagination.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<div class="pagination"><ul>
<ul class="pagination">
<li ng-repeat="page in pages" ng-class="{active: page.active, disabled: page.disabled}"><a ng-click="selectPage(page.number)">{{page.text}}</a></li>
</ul>
</div>
</ul>

0 comments on commit 3db699d

Please sign in to comment.