Skip to content

Instantly share code, notes, and snippets.

@dagda1
Created May 13, 2012 07:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dagda1/2686649 to your computer and use it in GitHub Desktop.
Save dagda1/2686649 to your computer and use it in GitHub Desktop.
binding.js.coffee
LO.Controllers.ContactsController = Ember.ArrayProxy.extend
init: ->
@_super()
@set 'content', LO.get('backend_store').findAll LO.Models.Contact
@view = Ember.View.create
templateName: 'app/templates/contacts'
@view.appendTo 'body'
queryBinding: Ember.Binding.transform((value, binding) ->
value.map (item, index, self) ->
{name: item.firstName + ' ' + item.lastName}
).from 'LO.query_controller.content'
queryDidChange: ( ->
return unless @get('query').length > 0
query = @get 'query'
query.forEach (item) ->
LO.Models.Contact.createOrUpdate item
LO.get('radium_store').commit()
).observes('query')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment