This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, I have the following coffee script file which uses spine:
TaskApp = Spine.Controller.create proxied: ["addOne", "addAll", "renderCount"]
events: "submit form": "create", "click .clear": "clear"
elements: ".items": "items", ".countVal": "count", ".clear": "clear", "form input": "input"
init: -> Task.bind("create", @addOne) Task.bind("refresh", @addAll) Task.bind("refresh change", @renderCount) Task.fetch()
addOne: (task) -> view = Tasks.init({item: task}) @items.append(view.render().el)
addAll: -> Task.each(@addOne)
create: (e) -> e.preventDefault() Task.create({name: @input.val()}) @input.val("")
clear: -> Task.destroyDone()
renderCount: -> active = Task.active().length @count.text(active)
inactive = Task.done().length if inactive @clear.show() else @clear.hide()
jQuery -> TaskApp.init(el: $("#tasks"))
In the 'events' add a new lie in the middle e.g.
"submit form": "create", "test .test": "test", "click .clear": "clear"
Take a look at the JS generated for the events. I would expect to see all the 3 lines rendered in the events block like this:
events: { "submit form": "create", "test .test": "test", "click .clear": "clear" }
However, the rendering looks like this:
events: { "submit form": "create" }, "test .test": "test" }, { "click .clear": "clear" }
Thanks |
|