Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Update app/lib/view_helper.coffee #43

Merged
merged 2 commits into from

2 participants

@andriijas

You are never intressted in the actual user object in template context, just it attributes. 

Took the change from ost.io and added in ? after mediator.user so that it works with mediator.user = null as well.

@andriijas andriijas Update app/lib/view_helper.coffee
You are never intressted in the actual user object in template context, just it attributes. 

Took the change from ost.io and added in ? after mediator.user so that it works with mediator.user = null as well.
f5b0e5e
@paulmillr
Owner

Perhaps, it should be mediator.user.serialize() instead?

@andriijas

Perhaps! I dont know, Im new to chaplin, just took what ost.io was using and modified it :) When I started out with backbone half year ago I used to do .toJSON()

@paulmillr
Owner

Think about serialize() as an a lot faster toJSON that uses prototypes for less memory usage.

@andriijas

I think then we should use it!

@paulmillr paulmillr merged commit 5a38751 into from
@paulmillr
Owner

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 10, 2012
  1. @andriijas

    Update app/lib/view_helper.coffee

    andriijas authored
    You are never intressted in the actual user object in template context, just it attributes. 
    
    Took the change from ost.io and added in ? after mediator.user so that it works with mediator.user = null as well.
Commits on Oct 11, 2012
  1. @andriijas
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  app/lib/view_helper.coffee
View
2  app/lib/view_helper.coffee
@@ -35,5 +35,5 @@ Handlebars.registerHelper 'without', (context, options) ->
# Evaluate block with context being current user
Handlebars.registerHelper 'with_user', (options) ->
- context = mediator.user or {}
+ context = mediator.user?.serialize() or {}
Handlebars.helpers.with.call(this, context, options)
Something went wrong with that request. Please try again.