codecombat/app/templates/courses/classroom-view.jade
2015-12-03 12:29:30 -08:00

88 lines
3.3 KiB
Text

extends /templates/base
block content
- var isOwner = view.classroom.get('ownerID') === me.id;
if isOwner
a(href="/courses/teachers") Back to my classrooms
else
a(href="/courses") Back to my courses
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')
// TODO: Add classroom statistics (grab from CourseDetailsView)
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
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
h2= user.broadName()
- var lastPlayedString = view.makeLastPlayedString(user);
- var playtime = view.makePlaytimeString(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);
- 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;
.row
.col-sm-3.text-right= campaign.get('fullName')
.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')
- var session = sessionMap[levelID];
if !session
- break;
a(href=view.getLevelURL(level, course, courseInstance, session))
- var content = view.levelPopoverContent(level, session, i);
if session && session.get('state').complete
.progress-bar.progress-bar-success(style=css, data-content=content, data-toggle='popover')= i + 1
else
.progress-bar.progress-bar-warning(style=css, data-content=content, data-toggle='popover')= i + 1
- 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
.text-center
p
em Activate a license to enable more courses for this student.
p
button.activate-single-license-btn.btn.btn-info.btn-sm(data-user-id=user.id) Activate
hr