codecombat/app/templates/courses/classroom-view.jade

139 lines
5.4 KiB
Text

extends /templates/base
block content
if !me.isAnonymous() && (me.isTeacher() || view.ownedClassrooms.size())
.alert.alert-danger.text-center
// DNT: Temporary
h3 ATTENTION TEACHERS:
p We are transitioning to a new classroom management system; this page will soon be student-only.
a(href="/teachers/classes") Go to teachers area.
- var isOwner = view.classroom ? view.classroom.get('ownerID') === me.id : false;
if isOwner
a(href="/teachers/classes", data-i18n="courses.back_classrooms")
else
a(href="/courses", data-i18n="courses.back_courses")
if !me.isAnonymous()
h1
span.spr= view.classroom.get('name')
if isOwner
a#edit-class-details-link
small(data-i18n="courses.edit_details")
if view.classroom.get('description')
p= view.classroom.get('description')
h3(data-i18n="courses.stats")
table.progress-stats-container
- var stats = view.classStats()
tr
td(data-i18n="courses.total_students")
td
span.spr= _.size(view.classroom.get('members'))
span (
span.spr(data-i18n="courses.enrolled_courses")
span= stats.enrolledUsers
span )
tr
td(data-i18n="courses.average_time")
td= stats.averagePlaytime
tr
td(data-i18n="courses.total_time")
td= stats.totalPlaytime
tr
td(data-i18n="courses.average_levels")
td= stats.averageLevelsComplete
tr
td(data-i18n="courses.total_levels")
td= stats.totalLevelsComplete
h1
span(data-i18n="courses.students")
if view.teacherMode
.pull-right#main-button-area
button#add-students-btn.btn.btn-primary.text-uppercase(data-i18n="courses.add_students")
button#activate-licenses-btn.btn.btn-info.text-uppercase(data-i18n="courses.enroll_paid")
a.btn.btn-success.text-uppercase(href="/courses/purchase?from-classroom="+view.classroom.id, data-i18n="courses.purchase_enrollments")
hr
for user in view.users.models
.row
.col-md-6
.student-name= user.broadName()
.col-md-6
if view.teacherMode
a.remove-student-link.pull-right.text-uppercase(data-user-id=user.id)
span.glyphicon.glyphicon-remove
span.spl(data-i18n="courses.remove_student")
- var lastPlayedString = view.userLastPlayedString(user);
- var playtime = view.userPlaytimeString(user);
if lastPlayedString || playtime
#student-stats-row.row
if lastPlayedString
.col-sm-6
span(data-i18n="user.last_played")
span.spr :
span= lastPlayedString
if playtime
.col-sm-6
span(data-i18n="clans.playtime")
span.spr :
span= playtime
- 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] || [];
if !(course.get('free') || paidFor)
- continue;
if inCourse
.row
.col-sm-3.text-right= course.get('name')
.col-sm-9
if inCourse
- var levels = campaign.get('levels');
- var numLevels = Object.keys(levels).length;
- var sessionMap = _.zipObject(_.map(sessions, function(s) { return s.get('level').original; }), sessions);
- var levelCellWidth = 100.00;
if numLevels > 0
- levelCellWidth = 100.00 / numLevels;
- var css = "width:"+levelCellWidth+"%;"
- var i = 0;
.progress
each level, levelID in campaign.get('levels')
- i++
- var session = sessionMap[levelID];
a(href=view.getLevelURL(level, course, courseInstance, session))
- var content = view.levelPopoverContent(level, session, i);
if session && session.get('state') && session.get('state').complete
.progress-bar.progress-bar-complete(style=css, data-content=content, data-toggle='popover')= i
else if session
.progress-bar.progress-bar-started(style=css, data-content=content, data-toggle='popover')= i
else
.progress-bar.progress-bar-default(style=css, data-content=content, data-toggle='popover')= i
else if paidFor
.text-center
button.enable-btn.btn.btn-info.btn-sm.text-uppercase(data-user-id=user.id, data-course-instance-cid=courseInstance.cid)
span.spr(data-i18n="courses.assign")
span= course.get('name')
if view.teacherMode && !paidFor
.text-center
p
em
span.spr(data-i18n="courses.enroll")
strong= user.broadName()
span.spl(data-i18n="courses.to_assign")
p
button.activate-single-license-btn.btn.btn-info.btn-sm.text-uppercase(data-user-id=user.id)
span.spr(data-i18n="courses.enroll")
span= user.broadName()
hr