Sha256: cb977246820a46cff1ec3ce615d51c90161dd0bb517db1a8cbb9aabda0244d8b

Contents?: true

Size: 720 Bytes

Versions: 16

Compression:

Stored size: 720 Bytes

Contents

Dashboard.PaginableControllerMixin = Ember.Mixin.create
  actions:
    refreshPageData: (page)->
      query = $.extend(@get('model')['query'], { page: page })

      @store.findQuery(@get('model').type, query).then (records)=>
        @set('model', records)

    gotoPage: (page) ->
      @send('refreshPageData', page)

    nextPage: ->
      current = @get('model.meta.page') or 1
      @send('gotoPage', current + 1) unless current + 1 > @get('model.meta.total_pages')

    previousPage: ->
      current = @get('model.meta.page') or 2
      @send('gotoPage', current - 1)

    lastPage: ->
      last = @get('model.meta.total_pages') or 1
      @send('gotoPage', last)

    firstPage: ->
      @send('gotoPage', 1)

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
dune-dashboard-1.1.5 app/assets/javascripts/mixins/paginable.coffee
dune-dashboard-1.1.4 app/assets/javascripts/mixins/paginable.coffee
dune-dashboard-1.1.3 app/assets/javascripts/mixins/paginable.coffee
dune-dashboard-1.1.2 app/assets/javascripts/mixins/paginable.coffee
dune-dashboard-1.1.1 app/assets/javascripts/mixins/paginable.coffee
dune-dashboard-1.1.0 app/assets/javascripts/mixins/paginable.coffee
dune-dashboard-1.0.9 app/assets/javascripts/mixins/paginable.coffee
dune-dashboard-1.0.8 app/assets/javascripts/mixins/paginable.coffee
dune-dashboard-1.0.7 app/assets/javascripts/mixins/paginable.coffee
dune-dashboard-1.0.6 app/assets/javascripts/mixins/paginable.coffee
dune-dashboard-1.0.5 app/assets/javascripts/mixins/paginable.coffee
dune-dashboard-1.0.4 app/assets/javascripts/mixins/paginable.coffee
dune-dashboard-1.0.3 app/assets/javascripts/mixins/paginable.coffee
dune-dashboard-1.0.2 app/assets/javascripts/mixins/paginable.coffee
dune-dashboard-1.0.1 app/assets/javascripts/mixins/paginable.coffee
dune-dashboard-1.0.0 app/assets/javascripts/mixins/paginable.coffee