Skip to content

Instantly share code, notes, and snippets.

@andrewseddon
Created June 13, 2011 23:35
Show Gist options
  • Select an option

  • Save andrewseddon/1023989 to your computer and use it in GitHub Desktop.

Select an option

Save andrewseddon/1023989 to your computer and use it in GitHub Desktop.
Waiting for Batman!
class SymbolCreator
constructor: (args = Object) ->
@host = args.host or $(document.body)
@model = new Symbol
@view = new SymbolViewController
saveToServer: ->
@model.save()
#
# Models
#
class Point
constructor: (args = Object) ->
@x = args.x ? 0
@y = args.y ? 0
class Pin
constructor: (args = Object) ->
@id = args.id ? null
@number = args.number ? "empty"
@name = args.name ? "empty"
@description = args.description ? "empty"
@type = args.type ? "empty"
@start = args.start ? new Point
@end = args.end ? new Point
@side = args.side ? "unplace"
class Symbol extends Batman.Model
@persist Batman.MongoNode
constructor: ->
@partnumber = 'empty'
@pins = []
addPin: ->
@pins.push new Pin
number: 'A1'
name: 'DATA0'
start: new Point(x: 10, y: 20)
end: new Point(x: 20, y: 10)
#
# ViewController
#
class SymbolViewController
constructor: (args = Object) ->
@host = args.host or $(document.body)
#
# Batman(http://batmanjs.org/alfred.html) place holder, waiting.....
#
class Batman.Model
constructor: ->
class Batman.MongoNode
save: ->
# Use socket.io / nowjs / mongoose to persist this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment