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

133 lines
5.1 KiB
Text
Raw Normal View History

2015-11-30 14:14:27 -05:00
extends /templates/base
block content
2015-12-04 19:37:13 -05:00
- var isOwner = view.classroom ? view.classroom.get('ownerID') === me.id : false;
2015-11-30 14:14:27 -05:00
if isOwner
a(href="/courses/teachers", data-i18n="courses.back_classrooms")
2015-11-30 14:14:27 -05:00
else
a(href="/courses", data-i18n="courses.back_courses")
2015-12-04 19:37:13 -05:00
if !me.isAnonymous()
h1
span.spr= view.classroom.get('name')
if isOwner
a#edit-class-details-link
small(data-i18n="courses.edit_details")
2015-12-04 19:37:13 -05:00
if view.classroom.get('description')
p= view.classroom.get('description')
2015-12-04 19:37:13 -05:00
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")
2015-12-04 19:37:13 -05:00
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
2015-12-04 19:37:13 -05:00
h1
span(data-i18n="courses.students")
2015-12-04 19:37:13 -05:00
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")
2015-12-04 19:37:13 -05:00
hr
2015-12-04 19:37:13 -05:00
for user in view.users.models
2015-12-06 23:35:54 -05:00
.row
.col-md-6
.student-name= user.broadName()
2015-12-06 23:35:54 -05:00
.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")
2015-12-04 19:37:13 -05:00
- 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
2015-12-04 19:37:13 -05:00
if playtime
.col-sm-6
span(data-i18n="clans.playtime")
span.spr :
span= playtime
2015-12-04 19:37:13 -05:00
- 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
2015-12-06 18:00:00 -05:00
.progress-bar.progress-bar-complete(style=css, data-content=content, data-toggle='popover')= i
else if session
2015-12-06 18:00:00 -05:00
.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')
2015-12-04 19:37:13 -05:00
if view.teacherMode && !paidFor
.text-center
p
em
span.spr(data-i18n="courses.enroll")
strong= user.broadName()
span.spl(data-i18n="courses.to_assign")
2015-12-04 19:37:13 -05:00
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()
2015-12-04 19:37:13 -05:00
hr