Skip to content

Instantly share code, notes, and snippets.

@validkeys
Created September 18, 2013 19:02
Show Gist options
  • Select an option

  • Save validkeys/6613930 to your computer and use it in GitHub Desktop.

Select an option

Save validkeys/6613930 to your computer and use it in GitHub Desktop.
# backbone/entities/user.js.coffe
@Aplat.module "Entities", (Entities, App, Backbone, Marionette, $, _) ->
class Entities.User extends Entities.Model
class Entities.Users.Collection extends Entities.Collection
model: Entities.User
API =
setCurrentUser: (currentUser) ->
new Entities.User currentUser
App.reqres.setHandler "set:current:user", (currentUser) ->
API.setCurrentUser currentUser
# backbone/app.js.coffee
@Aplat = do (Backbone, Marionette) ->
App = new Marionette.Application
App.on "initialize:before", (options) ->
@currentUser = App.request "set:current:user", options.currentUser
App.addRegions
globalNavRegion: "#global-nav-region"
commandCenterRegion: "#command-center-region"
mainRegion: "#main-region"
parentRegion: "#parent-region"
firstChildRegion: "#first-child-region"
secondChildRegion: "second-child-region"
App.addInitializer ->
App.module("CommandCenterApp").start()
App.module("GlobalNavApp").start()
App.on "initialize:after", ->
if Backbone.history
Backbone.history.start()
App
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment