Skip to content

Instantly share code, notes, and snippets.

@shanemcd
Created May 7, 2012 14:10
Show Gist options
  • Select an option

  • Save shanemcd/2627999 to your computer and use it in GitHub Desktop.

Select an option

Save shanemcd/2627999 to your computer and use it in GitHub Desktop.
window.App =
Models: {}
Collections: {}
Views: {}
Routers: {}
init: (options) ->
App.project = options.project
App.question_set = options.question_set
App.router = new App.Routers.QuestionsRouter()
Backbone.history.start();
class App.Routers.QuestionsRouter extends Backbone.Router
routes:
"": "index"
"test": "test"
test: ->
console.log "test
# The function that creates the view.
addNewQuestion: (e) ->
e.stopPropagation()
new_question = new App.Views.AddQuestion()
new_question.render()
$("#app").html(new_question.el)
# The view that is created.
class App.Views.AddQuestion extends Backbone.View
template: JST['question/add_question']
initialize: ->
App.router.navigate("test", {trigger: true})
render: ->
$("#content-container").hide()
@$el.html(@template())
return @
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment