mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-31 07:12:49 -04:00
Fixed some bugs on job profile initialization.
This commit is contained in:
parent
8f6187125d
commit
f493f407c2
2 changed files with 5 additions and 1 deletions
app
|
@ -87,7 +87,7 @@ block content
|
|||
p.help-block Ex.: "https://github.com/nwinter"
|
||||
button.btn.btn-success.btn-block.save-section(data-i18n="common.save") Save
|
||||
|
||||
.editable-section.basic-info-container
|
||||
.editable-section#basic-info-container
|
||||
- var editableDefaults = editing && profile.city == jobProfileSchema.properties.city.default
|
||||
div(class="editable-display" + (editableDefaults ? " edit-example-text" : ""), title="Click to edit your basic info")
|
||||
.editable-icon.glyphicon.glyphicon-pencil
|
||||
|
@ -242,6 +242,7 @@ block content
|
|||
img.header-icon(src="/images/pages/account/profile/work.png", alt="")
|
||||
span(data-i18n="account_profile.work_experience") Work Experience
|
||||
| - #{profile.experience}
|
||||
|
|
||||
span(data-i18n=profile.experience == 1 ? "units.year" : "units.years")
|
||||
each job in profile.work
|
||||
if job.role && job.employer
|
||||
|
|
|
@ -48,6 +48,8 @@ module.exports = class ProfileView extends View
|
|||
jobProfile = {}
|
||||
for prop, schema of context.jobProfileSchema.properties
|
||||
jobProfile[prop] = _.clone schema.default if schema.default?
|
||||
for prop in context.jobProfileSchema.required
|
||||
jobProfile[prop] ?= {string: '', boolean: false, number: 0, integer: 0, array: []}[context.jobProfileSchema.properties[prop].type]
|
||||
@user.set 'jobProfile', jobProfile
|
||||
jobProfile.name ?= (@user.get('firstName') + ' ' + @user.get('lastName')).trim() if @user.get('firstName')
|
||||
context.profile = jobProfile
|
||||
|
@ -93,6 +95,7 @@ module.exports = class ProfileView extends View
|
|||
@render()
|
||||
|
||||
toggleJobProfileApproved: ->
|
||||
return unless me.isAdmin()
|
||||
approved = not @user.get 'jobProfileApproved'
|
||||
@user.set 'jobProfileApproved', approved
|
||||
res = @user.save {jobProfileApproved: approved}, {patch: true}
|
||||
|
|
Loading…
Add table
Reference in a new issue