Skip to content

Instantly share code, notes, and snippets.

@gazs
Created May 2, 2011 09:31
Show Gist options
  • Select an option

  • Save gazs/951363 to your computer and use it in GitHub Desktop.

Select an option

Save gazs/951363 to your computer and use it in GitHub Desktop.
$(document).ready ->
class Page extends Backbone.View
render_template: (p) -> _.template($('#' + @template).html(), p)
render: ->
$(@el).html @render_template()
super
class Egyik extends Page
template: 'egyik'
class App extends Backbone.Controller
routes:
':page': 'show'
initialize: ->
@egyik = new Egyik()
replace_body: (page) ->
$('body').children().remove()
$('body').append(page)
show: (page) ->
@replace_body(@[page].render().el)
window.app = new App()
Backbone.history.start()
<script id="egyik" type="movealong/nothingtoseehere" charset="utf-8">
<div>egyik</div>
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment