mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Add owner name to course details page
This commit is contained in:
parent
9e04d425cc
commit
6e1cb8a1d1
2 changed files with 20 additions and 6 deletions
|
@ -31,13 +31,18 @@ block content
|
||||||
else if !course || !courseInstance
|
else if !course || !courseInstance
|
||||||
h1(data-i18n="common.loading") Loading...
|
h1(data-i18n="common.loading") Loading...
|
||||||
else
|
else
|
||||||
if courseInstance.get('name')
|
h1
|
||||||
h1= courseInstance.get('name')
|
if courseInstance.get('name')
|
||||||
small.spl (#{course.get('name')})
|
| #{courseInstance.get('name')}
|
||||||
else
|
else
|
||||||
h1
|
|
||||||
span(data-i18n='courses.unnamed_class')
|
span(data-i18n='courses.unnamed_class')
|
||||||
small.spl (#{course.get('name')})
|
small.spl (#{course.get('name')})
|
||||||
|
|
||||||
|
if !view.owner.isNew()
|
||||||
|
p
|
||||||
|
span.spr Creator:
|
||||||
|
a(href="/user/#{view.owner.id}")
|
||||||
|
strong= view.getOwnerName()
|
||||||
|
|
||||||
p
|
p
|
||||||
if courseInstance.get('description')
|
if courseInstance.get('description')
|
||||||
|
|
|
@ -133,6 +133,8 @@ module.exports = class CourseDetailsView extends RootView
|
||||||
})
|
})
|
||||||
me.patch()
|
me.patch()
|
||||||
@supermodel.loadCollection @members, 'members', cache: false
|
@supermodel.loadCollection @members, 'members', cache: false
|
||||||
|
@owner = new User({_id: @courseInstance.get('ownerID')})
|
||||||
|
@supermodel.loadModel @owner, 'user'
|
||||||
if @adminMode and prepaidID = @courseInstance.get('prepaidID')
|
if @adminMode and prepaidID = @courseInstance.get('prepaidID')
|
||||||
@prepaid = @supermodel.getModel(Prepaid, prepaidID) or new Prepaid _id: prepaidID
|
@prepaid = @supermodel.getModel(Prepaid, prepaidID) or new Prepaid _id: prepaidID
|
||||||
@listenTo @prepaid, 'sync', @onPrepaidSync
|
@listenTo @prepaid, 'sync', @onPrepaidSync
|
||||||
|
@ -320,3 +322,10 @@ module.exports = class CourseDetailsView extends RootView
|
||||||
aName = @memberUserMap[a]?.get('name') ? 'Anoner'
|
aName = @memberUserMap[a]?.get('name') ? 'Anoner'
|
||||||
bName = @memberUserMap[b]?.get('name') ? 'Anoner'
|
bName = @memberUserMap[b]?.get('name') ? 'Anoner'
|
||||||
aName.localeCompare(bName)
|
aName.localeCompare(bName)
|
||||||
|
|
||||||
|
getOwnerName: ->
|
||||||
|
if @owner.isNew()
|
||||||
|
return '?'
|
||||||
|
if @owner.get('firstName') and @owner.get('lastName')
|
||||||
|
return "#{@owner.get('firstName')} #{@owner.get('lastName')}"
|
||||||
|
return @owner.get('name') or @owner.get('email') or '?'
|
Loading…
Reference in a new issue