mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Hide teacher controls in ClassroomView when a student is viewing
This commit is contained in:
parent
fac71e64c9
commit
afbfc69fd5
2 changed files with 17 additions and 11 deletions
|
@ -21,17 +21,19 @@ block content
|
|||
|
||||
h1
|
||||
| Students
|
||||
.pull-right#main-button-area
|
||||
button#add-students-btn.btn.btn-success Add Students
|
||||
button#activate-licenses-btn.btn.btn-warning Activate Licenses
|
||||
a.btn.btn-warning(href="/courses/purchase?from-classroom="+view.classroom.id) Purchase Licenses
|
||||
if view.teacherMode
|
||||
.pull-right#main-button-area
|
||||
button#add-students-btn.btn.btn-success Add Students
|
||||
button#activate-licenses-btn.btn.btn-warning Activate Licenses
|
||||
a.btn.btn-warning(href="/courses/purchase?from-classroom="+view.classroom.id) Purchase Licenses
|
||||
|
||||
hr
|
||||
|
||||
for user in view.users.models
|
||||
a.remove-student-link.pull-right.text-uppercase(data-user-id=user.id)
|
||||
span.glyphicon.glyphicon-remove
|
||||
span.spl remove student
|
||||
if view.teacherMode
|
||||
a.remove-student-link.pull-right.text-uppercase(data-user-id=user.id)
|
||||
span.glyphicon.glyphicon-remove
|
||||
span.spl remove student
|
||||
|
||||
h2= user.broadName()
|
||||
- var lastPlayedString = view.makeLastPlayedString(user);
|
||||
|
@ -46,6 +48,8 @@ block content
|
|||
- var paidFor = user.get('coursePrepaidID');
|
||||
for courseInstance in view.courseInstances.models
|
||||
- var inCourse = _.contains(courseInstance.get('members'), user.id);
|
||||
if !(inCourse || view.teacherMode)
|
||||
- continue;
|
||||
- var course = view.courses.get(courseInstance.get('courseID'));
|
||||
- var campaign = view.campaigns.get(course.get('campaignID'));
|
||||
- var sessions = courseInstance.sessionsByUser[user.id] || [];
|
||||
|
@ -77,8 +81,9 @@ block content
|
|||
- i++
|
||||
else if paidFor
|
||||
button.enable-btn.btn.btn-info.btn-sm(data-user-id=user.id, data-course-instance-cid=courseInstance.cid) Enable
|
||||
|
||||
|
||||
if !paidFor
|
||||
if view.teacherMode && !paidFor
|
||||
.text-center
|
||||
p
|
||||
em Activate a license to enable more courses for this student.
|
||||
|
|
|
@ -69,6 +69,7 @@ module.exports = class ClassroomView extends RootView
|
|||
courseInstance.sessionsByUser = {}
|
||||
|
||||
onLoaded: ->
|
||||
@teacherMode = me.isAdmin() or @classroom.get('ownerID') is me.id
|
||||
userSessions = @sessions.groupBy('creator')
|
||||
for user in @users.models
|
||||
user.sessions = new CocoCollection(userSessions[user.id], { model: LevelSession })
|
||||
|
@ -162,16 +163,16 @@ module.exports = class ClassroomView extends RootView
|
|||
@render()
|
||||
|
||||
levelPopoverContent: (level, session, i) ->
|
||||
return '' unless level and session
|
||||
return null unless level and session
|
||||
context = {
|
||||
moment: moment
|
||||
level: level
|
||||
session: session
|
||||
i: i
|
||||
canViewSolution: me.isAdmin() or @classroom.get('ownerID') is me.id
|
||||
canViewSolution: @teacherMode
|
||||
}
|
||||
return popoverTemplate(context)
|
||||
|
||||
getLevelURL: (level, course, courseInstance, session) ->
|
||||
return '#' unless _.all(arguments)
|
||||
return null unless @teacherMode and _.all(arguments)
|
||||
"/play/level/#{level.slug}?course=#{course.id}&course-instance=#{courseInstance.id}&session=#{session.id}&observing=true"
|
Loading…
Reference in a new issue