Created
July 21, 2012 11:57
-
-
Save marten/3155616 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Devtool = new Backbone.Marionette.Application | |
Devtool.module 'Models' | |
Devtool.module 'Collections' | |
Devtool.module 'Views' | |
Devtool.module 'Controllers' | |
Devtool.module 'Routers' | |
Backbone.Marionette.Renderer.render = (template, data) -> | |
if !JST[template] | |
throw "Template '" + template + "' not found!" | |
JST[template](data); | |
Devtool.addInitializer (options) -> | |
Devtool.addRegions(content: "#content") | |
controller = new Devtool.Controllers.Discussions | |
new Devtool.Routers.Discussions(controller: controller) | |
Backbone.history.start() | |
$(document).ready -> | |
Devtool.start() | |
class Devtool.Views.Discussion extends Backbone.Marionette.ItemView | |
template: 'discussions/show' | |
class Devtool.Views.Discussions extends Backbone.Marionette.CompositeView | |
template: 'discussions/index' | |
className: 'discussions' | |
itemView: Devtool.Views.Discussion | |
appendHtml: (collectionView, itemView) -> | |
collectionView.$('.discussions table tr').append(itemView.el) | |
class Devtool.Controllers.Discussions | |
constructor: -> | |
@collection = new Devtool.Collections.Discussions | |
@collection.fetch | |
window.col = @collection | |
main = $('.container') | |
index: -> | |
view = new Devtool.Views.Discussions | |
collection: @collection | |
Devtool.content.show(view) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment