Hide course details progress from anonymous

This commit is contained in:
Matt Lott 2015-12-01 14:15:18 -08:00 committed by Nick Winter
parent 26e321d9e7
commit 56dadbf35a
2 changed files with 16 additions and 17 deletions
app
templates/courses
views/courses

View file

@ -43,7 +43,7 @@ block content
span(data-i18n='courses.unnamed_class')
| )
if !view.owner.isNew()
if !view.owner.isNew() && view.getOwnerName()
p
span.spr Creator:
a(href="/user/#{view.owner.id}")
@ -54,18 +54,19 @@ block content
each line in courseInstance.get('description').split('\n')
div= line
div.well.well-sm(role='tabpanel')
ul.nav.nav-pills(role='tablist')
if adminMode
li.active(role='presentation')
a(href='#progress', aria-controls='progress', role='tab', data-toggle='tab', data-i18n="courses.progress")
li(role='presentation')
a(href='#levels', aria-controls='levels', role='tab', data-toggle='tab', data-i18n="nav.play")
else
li.active(role='presentation')
a(href='#levels', aria-controls='levels', role='tab', data-toggle='tab', data-i18n="nav.play")
li(role='presentation')
a(href='#progress', aria-controls='progress', role='tab', data-toggle='tab', data-i18n="courses.progress")
if !me.isAnonymous()
div.well.well-sm(role='tabpanel')
ul.nav.nav-pills(role='tablist')
if adminMode
li.active(role='presentation')
a(href='#progress', aria-controls='progress', role='tab', data-toggle='tab', data-i18n="courses.progress")
li(role='presentation')
a(href='#levels', aria-controls='levels', role='tab', data-toggle='tab', data-i18n="nav.play")
else
li.active(role='presentation')
a(href='#levels', aria-controls='levels', role='tab', data-toggle='tab', data-i18n="nav.play")
li(role='presentation')
a(href='#progress', aria-controls='progress', role='tab', data-toggle='tab', data-i18n="courses.progress")
.tab-content
if adminMode
.tab-pane.active#progress(role='tabpanel')
@ -288,4 +289,3 @@ mixin levels-tab
each concept in course.get('concepts')
if levelConceptMap[levelID][concept]
span.spr.progress-level-cell.progress-level-cell-not-started(data-i18n="concepts." + concept)

View file

@ -300,8 +300,7 @@ module.exports = class CourseDetailsView extends RootView
aName.localeCompare(bName)
getOwnerName: ->
if @owner.isNew()
return '?'
return if @owner.isNew()
if @owner.get('firstName') and @owner.get('lastName')
return "#{@owner.get('firstName')} #{@owner.get('lastName')}"
return @owner.get('name') or @owner.get('email') or '?'
@owner.get('name') or @owner.get('email')