Skip to content

Instantly share code, notes, and snippets.

@j-mcnally
Created March 23, 2012 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j-mcnally/1e5783a87da3a8a471e7 to your computer and use it in GitHub Desktop.
Save j-mcnally/1e5783a87da3a8a471e7 to your computer and use it in GitHub Desktop.
Hiding first and last in pagination controller
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