secret
Created

Hiding first and last in pagination controller

  • Download Gist
gistfile1.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
isFirst: true,
isLast: false,
prevPage: function() {
GWVideoApp.VideosController.set('currentPage', this.currentPage - 1);
},
nextPage: function() {
GWVideoApp.VideosController.set('currentPage', this.currentPage + 1);
},
currentPage: 1,
onCurrentPageChange: function() {
this.params.page = this.currentPage;
this.getPage(this.params);
GWVideoApp.VideosController.set('isFirst', false);
GWVideoApp.VideosController.set('isLast', false);
if (this.currentPage == 1) {
GWVideoApp.VideosController.set('isFirst', true);
}
if (this.currentPage == this.pages) {
GWVideoApp.VideosController.set('isLast', true)
}
}.observes('currentPage'),

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.