Skip to content

Commit

Permalink
VBID-1351 - render list view on sync
Browse files Browse the repository at this point in the history
--Also trim login email
  • Loading branch information
Chris McBride committed Mar 25, 2013
1 parent 4f2d354 commit a568377
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion models/collection.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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) ->
Expand Down
1 change: 1 addition & 0 deletions models/filtered_collection.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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) ->
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "quips",
"version": "0.1.1",
"version": "0.1.2",
"dependencies": {
"coffee-script": "1.3.3",
"jqueryify": "1.9.1",
Expand Down
10 changes: 5 additions & 5 deletions test/models/collection_spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -119,4 +119,4 @@ describe 'Collection', ->
for i in [1..100]
@modelSaved = false
model.save()
@clock.tick(300)
@clock.tick(500)
3 changes: 2 additions & 1 deletion views/login/login_view.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
View = require '../view'
$ = require 'jqueryify'


class LoginView extends View
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit a568377

Please sign in to comment.