Skip to content

Instantly share code, notes, and snippets.

@sakal
Created February 16, 2012 19:41
Show Gist options
  • Save sakal/1847217 to your computer and use it in GitHub Desktop.
Save sakal/1847217 to your computer and use it in GitHub Desktop.
Spine = require('spine')
Milk = require('milk/milk')
$ = Spine.$
Ticket = require('models/ticket')
class Payforms extends Spine.Controller
constructor: ->
super
@current = null
@tpl_bayticket = require('views/bayticket')('')
$("#modal_box").on('hidden', =>
@navigate '/games', @current.id
)
@routes {
"/sandpay": ->
}
events: {
"submit": "bay",
"reset": "close"
}
show: (current) ->
params = {
name: current.params.name,
tickets: current.params.tickets,
action: '/games/bayticket'
}
@current = current
form_tpl = Milk.render @tpl_bayticket, params
$("#modal_box form").html(form_tpl)
$("#modal_box").modal('show')
bay: (e) ->
ticket = Ticket.fromForm e.target
ticket.save()
e.preventDefault()
close: ->
$("#modal_box").modal('hide')
@navigate "/games/", @current.id
module.exports = Payforms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment