Skip to content

Instantly share code, notes, and snippets.

@zhuqling
Created November 1, 2013 08:04
Show Gist options
  • Save zhuqling/7262201 to your computer and use it in GitHub Desktop.
Save zhuqling/7262201 to your computer and use it in GitHub Desktop.
class Panel extends Backbone.View
el: $('#test')
events:
'click #superZone': 'clickMyZone'
initialize: ->
$("#test").append '<span id="superZone">Panel initialized</span>, '
@foo = 'bar'
render: ->
$("#test").append 'super render'
@
clickMyZone: ->
alert 'click super zone'
class PanelAdvanced extends Panel
#el: $('#test')
events: ->
_.extend {}, Panel.prototype.events || {},
#'click #superZone': 'clickMyZone'
'click #childZone': 'clickZone'
initialize: ->
super
$("#test").append '<span id="childZone">PanelAdvanced initialized</span>, '
$("#test").append @foo
render: ->
super
$("#test").append 'child render'
@
clickZone: ->
#@clickMyZone()
alert 'click child zone'
p = new PanelAdvanced()
p.render()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment