mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-14 07:00:01 -04:00
Job profile view works once again
This commit is contained in:
parent
5f7ef825f8
commit
dbff3e04d5
3 changed files with 13 additions and 9 deletions
|
@ -7,7 +7,7 @@ block content
|
|||
|Please
|
||||
a.auth-button login
|
||||
| to view this profile.
|
||||
else
|
||||
else if user.loaded
|
||||
if allowedToEditJobProfile
|
||||
.profile-control-bar
|
||||
if editing
|
||||
|
@ -486,8 +486,9 @@ block content
|
|||
span(data-i18n="account_profile.profile_for_prefix") Profile for
|
||||
span= user.get('name') || "Anonymous Wizard"
|
||||
span(data-i18n="account_profile.profile_for_suffix")
|
||||
|
||||
img.profile-photo(src=user.getPhotoURL(256))
|
||||
|
||||
if user.loaded
|
||||
img.profile-photo(src=user.getPhotoURL(256))
|
||||
|
||||
p To see a private user profile, you may need to log in.
|
||||
|
||||
|
|
|
@ -9,15 +9,14 @@ module.exports = class UserView extends RootView
|
|||
|
||||
constructor: (@userID, options) ->
|
||||
super options
|
||||
@userID ?= me.id
|
||||
@listenTo @, 'userNotFound', @ifUserNotFound
|
||||
@fetchUser @userID
|
||||
|
||||
fetchUser: (id) ->
|
||||
fetchUser: ->
|
||||
if @isMe()
|
||||
@user = me
|
||||
@onLoaded()
|
||||
@user = new User _id: id
|
||||
@user = new User _id: @userID
|
||||
@supermodel.loadModel @user, 'user'
|
||||
|
||||
getRenderData: ->
|
||||
|
@ -29,8 +28,12 @@ module.exports = class UserView extends RootView
|
|||
isMe: -> @userID is me.id
|
||||
|
||||
onLoaded: ->
|
||||
@onUserLoaded @user if @user.loaded and not @userLoaded
|
||||
super()
|
||||
|
||||
onUserLoaded: ->
|
||||
@userLoaded = true
|
||||
|
||||
ifUserNotFound: ->
|
||||
console.warn 'user not found'
|
||||
@render()
|
||||
|
|
|
@ -54,7 +54,7 @@ module.exports = class JobProfileView extends UserView
|
|||
'change #admin-contact': 'onAdminContactChanged'
|
||||
'click .session-link': 'onSessionLinkPressed'
|
||||
|
||||
constructor: (userID, options) ->
|
||||
constructor: (options, userID) ->
|
||||
@onJobProfileNotesChanged = _.debounce @onJobProfileNotesChanged, 1000
|
||||
@onRemarkChanged = _.debounce @onRemarkChanged, 1000
|
||||
@authorizedWithLinkedIn = IN?.User?.isAuthorized()
|
||||
|
@ -63,7 +63,7 @@ module.exports = class JobProfileView extends UserView
|
|||
window.contractCallback = =>
|
||||
@authorizedWithLinkedIn = IN?.User?.isAuthorized()
|
||||
@render()
|
||||
super options, userID
|
||||
super userID, options
|
||||
|
||||
onLoaded: ->
|
||||
@finishInit() unless @destroyed
|
||||
|
@ -530,7 +530,7 @@ module.exports = class JobProfileView extends UserView
|
|||
console.log 'Saved UserRemark', @remark, 'with response', response
|
||||
|
||||
updateProgress: (highlightNext) ->
|
||||
return unless @user?.loaded
|
||||
return unless @user?.loaded and @sessions?.loaded
|
||||
completed = 0
|
||||
totalWeight = 0
|
||||
next = null
|
||||
|
|
Loading…
Reference in a new issue