Permalink
Browse files

VBID-1351 - render list view on sync

--Also trim login email
  • Loading branch information...
1 parent 4f2d354 commit a56837723d42861b42f7e1d6918940e5253706b0 Chris McBride committed Mar 25, 2013
View
@@ -13,7 +13,7 @@ class Collection extends Backbone.Collection
# the timeout is used to account for eventual consistency. This can be removed
# if we are using an ACID database.
- syncTo: (otherCol, timeout=300) ->
+ syncTo: (otherCol, timeout=500) ->
events = 'sync add remove'
syncThis = (model, resp, opts) ->
@@ -14,6 +14,7 @@ class FilteredCollection extends Collection
@collection.on('add', @addUnfiltered, this)
@collection.on('remove', @remove, this)
@collection.on('reset', @collectionReset, this)
+ @collection.on('sync', (-> @trigger('sync')), this)
@reset(@collection.models)
collectionReset: (c) ->
View
@@ -1,6 +1,6 @@
{
"name": "quips",
- "version": "0.1.1",
+ "version": "0.1.2",
"dependencies": {
"coffee-script": "1.3.3",
"jqueryify": "1.9.1",
@@ -53,7 +53,7 @@ describe 'Collection', ->
@mock1.add(new MockModel1())
@mock1.add(new MockModel1())
- @clock.tick(300)
+ @clock.tick(500)
expect(@mock1FetchCount).to.equal 1
expect(@mock2FetchCount).to.equal 2
@@ -65,7 +65,7 @@ describe 'Collection', ->
@mock1.syncTo(@mock2, 0)
@mock2.remove([1])
@mock1.remove([2, 3])
- @clock.tick(300)
+ @clock.tick(500)
expect(@mock1FetchCount).to.equal 1
expect(@mock2FetchCount).to.equal 2
@@ -82,7 +82,7 @@ describe 'Collection', ->
@mock1.syncTo(@mock2, 0)
model.save()
- @clock.tick(300)
+ @clock.tick(500)
expect(@mock1FetchCount).to.equal 0
expect(@mock2FetchCount).to.equal 1
@@ -96,7 +96,7 @@ describe 'Collection', ->
@mock1.syncTo(@mock2, 0)
model.set(name: 'test')
- @clock.tick(300)
+ @clock.tick(500)
expect(@mock1FetchCount).to.equal 0
expect(@mock2FetchCount).to.equal 0
@@ -119,4 +119,4 @@ describe 'Collection', ->
for i in [1..100]
@modelSaved = false
model.save()
- @clock.tick(300)
+ @clock.tick(500)
@@ -1,4 +1,5 @@
View = require '../view'
+$ = require 'jqueryify'
class LoginView extends View
@@ -26,7 +27,7 @@ class LoginView extends View
_login: (e) ->
e?.preventDefault()
credentials =
- email: @$email.val()
+ email: $.trim(@$email.val())
password: @$password.val()
opts: @options

0 comments on commit a568377

Please sign in to comment.