Skip to content

Instantly share code, notes, and snippets.

@micahroberson
Last active August 29, 2015 13:57
Show Gist options
  • Save micahroberson/9420417 to your computer and use it in GitHub Desktop.
Save micahroberson/9420417 to your computer and use it in GitHub Desktop.
Backbone Layout Manager View
define [
'jquery'
'underscore'
'backbone'
'models/session'
'text!templates/sessions/new.html'
], ($, _, Backbone, Session, template) ->
SessionsNewView = Backbone.View.extend
template: _.template(template)
events:
'submit form' : 'signIn'
initialize: () ->
@listenTo Session, 'change:authorized', () ->
Backbone.history.navigate '/', true
signIn: (e) ->
e.stopPropagation()
e.preventDefault()
Session.signIn
email: @$('.email').val()
password: @$('.password').val()
serialize: () ->
testvar: "TESTVAR"
beforeRender: () ->
console.log "BEFORE"
afterRender: () ->
console.log "AFTER"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment