Permalink
Browse files

use plugin api of jqueryify to use list extension

  • Loading branch information...
1 parent f8b5e00 commit 857560cd77be56f2e32d52672ae603b777c9878e @dodo committed May 22, 2012
Showing with 2 additions and 16 deletions.
  1. +1 −9 example/backbone.coffee
  2. +1 −7 example/list.coffee
View
@@ -10,14 +10,6 @@ adiff = window.adiff({ # npm i adiff - https://github.com/dominictarr/adiff
return a is b
}, window.adiff)
-# patch JQueryAdapter to use the list extension
-
-JQueryAdapter = jqueryify.Adapter
-jqueryify = (opts, tpl) ->
- [tpl, opts] = [opts, null] unless tpl?
- List.jqueryify new JQueryAdapter(tpl, opts)
- return tpl
-
# helpers
EventHandler = (handler) ->
@@ -67,7 +59,7 @@ class BackboneExample extends Backbone.View
# embbeded template
- template: (view) -> jqueryify new Template schema:5, ->
+ template: (view) -> jqueryify use:List.jqueryify, new Template schema:5, ->
@$div class:'controls', ->
input this, 'button', "add", "collection.add({value:Math.random()})"
View
@@ -1,20 +1,14 @@
{ Template, List, jqueryify } = window.dynamictemplate
EventEmitter = Template.__super__.constructor # i prefer nodejs eventemitter
-JQueryAdapter = jqueryify.Adapter
-jqueryify = (opts, tpl) ->
- [tpl, opts] = [opts, null] unless tpl?
- List.jqueryify new JQueryAdapter(tpl, opts)
- return tpl
-
# the templates
input = (tag, type, id, value, opts) ->
tag.$input(_.extend({class:type, name:id, type, id, value}, opts))
items = null # all our list entries
tplapi = new EventEmitter # every other event system should be suitable as well
-list = jqueryify new Template schema:5, ->
+list = jqueryify use:List.jqueryify, new Template schema:5, ->
@$div class:'controls', ->
input this, 'button', "add", "list.push(Math.random())",

0 comments on commit 857560c

Please sign in to comment.