-
-
Save j-mcnally/1e5783a87da3a8a471e7 to your computer and use it in GitHub Desktop.
Hiding first and last in pagination controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment