Skip to content

Instantly share code, notes, and snippets.

@vladtsf
Created November 11, 2013 15:05
Show Gist options
  • Save vladtsf/7414480 to your computer and use it in GitHub Desktop.
Save vladtsf/7414480 to your computer and use it in GitHub Desktop.
HomeController = require 'controllers/home-controller'
NotificationsCollection = require 'models/notifications'
NotificationsView = require 'views/notifications-index-view'
module.exports = class NotificationsController extends HomeController
limit: 2
offset: 0
index: ( params ) ->
@offset = if params.page? then @limit * params.page
@collection = new NotificationsCollection()
@view = new NotificationsView collection: @collection
@collection.offset = @offset
@collection.limit = @limit
fetch = @collection.fetch
data:
limit: @limit
offset: @offset
fetch.then =>
@view.render()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment