Skip to content

add text buttons to variables (to be translated in other languages) #7

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/jw-pagination.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ import paginate = require('jw-paginate');
selector: 'jw-pagination',
template: `<ul *ngIf="pager.pages && pager.pages.length" class="pagination">
<li [ngClass]="{disabled:pager.currentPage === 1}" class="page-item first-item">
<a (click)="setPage(1)" class="page-link">First</a>
<a (click)="setPage(1)" class="page-link">{{ firstItemButton }}</a>
</li>
<li [ngClass]="{disabled:pager.currentPage === 1}" class="page-item previous-item">
<a (click)="setPage(pager.currentPage - 1)" class="page-link">Previous</a>
<a (click)="setPage(pager.currentPage - 1)" class="page-link">{{ previousItemButton }}</a>
</li>
<li *ngFor="let page of pager.pages" [ngClass]="{active:pager.currentPage === page}" class="page-item number-item">
<a (click)="setPage(page)" class="page-link">{{page}}</a>
</li>
<li [ngClass]="{disabled:pager.currentPage === pager.totalPages}" class="page-item next-item">
<a (click)="setPage(pager.currentPage + 1)" class="page-link">Next</a>
<a (click)="setPage(pager.currentPage + 1)" class="page-link">{{ nextItemButton }}</a>
</li>
<li [ngClass]="{disabled:pager.currentPage === pager.totalPages}" class="page-item last-item">
<a (click)="setPage(pager.totalPages)" class="page-link">Last</a>
<a (click)="setPage(pager.totalPages)" class="page-link">{{ lastItemButton }}</a>
</li>
</ul>`
})
Expand All @@ -30,6 +30,10 @@ export class JwPaginationComponent implements OnInit, OnChanges {
@Input() initialPage = 1;
@Input() pageSize = 10;
@Input() maxPages = 10;
@Input() firstItemButton = "First";
@Input() previousItemButton = "Previous";
@Input() nextItemButton = "Next";
@Input() lastItemButton = "Last";

pager: any = {};

Expand Down Expand Up @@ -57,4 +61,4 @@ export class JwPaginationComponent implements OnInit, OnChanges {
// call change page function in parent component
this.changePage.emit(pageOfItems);
}
}
}