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

123 lines
4.8 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") Back to my classrooms
else
a(href="/courses") Back to my 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 Edit class 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 enrolled in paid 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
| Students
if view.teacherMode
.pull-right#main-button-area
button#add-students-btn.btn.btn-primary.text-uppercase Add Students
button#activate-licenses-btn.btn.btn-info.text-uppercase Enroll Students in Paid Courses
a.btn.btn-success.text-uppercase(href="/courses/purchase?from-classroom="+view.classroom.id) Purchase Enrollments
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() || 'Anoner'
.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 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 Last Played: #{lastPlayedString}
if playtime
.col-sm-6 Playtime: #{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
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) Assign #{course.get('name')}
2015-12-04 19:37:13 -05:00
if view.teacherMode && !paidFor
.text-center
p
em
span.spr Enroll
strong.spr= user.broadName()
span to assign paid courses.
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) Enroll #{user.broadName()}
2015-12-04 19:37:13 -05:00
hr