Sha256: 26a12c609348b195fc1391e067ca73b636e67fcc347f65ab03e8a6fdd64a640f

Contents?: true

Size: 581 Bytes

Versions: 1

Compression:

Stored size: 581 Bytes

Contents

CATARSE.PaginatedCollection = Backbone.Collection.extend({
  initialize: function(options){
    typeof(options) != 'undefined' || (options = {})
    if(options.url)
      this.url = options.url
    if(options.search)
      this.search = options.search
    this.initializePages()
  },
  
  initializePages: function(){
    _.bindAll(this, "nextPage")
    this.page = 1
  },
  
  fetchPage: function(){
    return this.fetch({data: {page: this.page, locale: CATARSE.locale, search: this.search}})
  },
  
  nextPage: function(){
    this.page++
    return this.fetchPage()
  }
  
})

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
catarse_core-1.0.0.beta app/assets/javascripts/app/collections/paginated.js