Did some tweaking of UserView to handle slugs for ids.

This commit is contained in:
Scott Erickson 2014-09-30 10:53:01 -07:00
parent adbfa42f25
commit 8f29d0ee7f
2 changed files with 3 additions and 2 deletions

View file

@ -25,13 +25,14 @@ module.exports = class UserView extends RootView
context.user = @user unless @user?.isAnonymous()
context
isMe: -> @userID is me.id
isMe: -> @userID in [me.id, me.get('slug')]
onLoaded: ->
@onUserLoaded @user if @user.loaded and not @userLoaded
super()
onUserLoaded: ->
@userID = @user.id
@userLoaded = true
ifUserNotFound: ->

View file

@ -84,7 +84,7 @@ module.exports = class JobProfileView extends UserView
if me.isAdmin() or 'employer' in me.get('permissions', true)
$.post "/db/user/#{me.id}/track/view_candidate"
$.post "/db/user/#{@userID}/track/viewed_by_employer" unless me.isAdmin()
@sessions = @supermodel.loadCollection(new LevelSessionsCollection(@userID), 'candidate_sessions').model
@sessions = @supermodel.loadCollection(new LevelSessionsCollection(@user.id), 'candidate_sessions').model
@listenToOnce @sessions, 'sync', => @render?()
if me.isAdmin()
# Mimicking how the VictoryModal fetches LevelFeedback