mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Fix CS1, CS2, GD1, WD2, CS3, etc. labeling in TeacherClassesView, too
This commit is contained in:
parent
6e65171a83
commit
f94cc2ec1f
5 changed files with 22 additions and 22 deletions
|
@ -195,6 +195,16 @@ module.exports =
|
|||
_.assign(progressData, progressMixin)
|
||||
return progressData
|
||||
|
||||
courseLabelsArray: (courses) ->
|
||||
labels = []
|
||||
courseLabelIndexes = CS: 0, GD: 0, WD: 0
|
||||
for course in courses
|
||||
acronym = switch
|
||||
when /game-dev/.test(course.get('slug')) then 'GD'
|
||||
when /web-dev/.test(course.get('slug')) then 'WD'
|
||||
else 'CS'
|
||||
labels.push acronym + ++courseLabelIndexes[acronym]
|
||||
labels
|
||||
|
||||
progressMixin =
|
||||
get: (options={}) ->
|
||||
|
|
|
@ -229,7 +229,7 @@ mixin studentRow(student)
|
|||
td
|
||||
if state.get('progressData')
|
||||
- var courses = view.classroom.get('courses').map(function(c) { return view.courses.get(c._id); });
|
||||
- var courseLabelsArray = view.courseLabelsArray(courses);
|
||||
- var courseLabelsArray = view.helper.courseLabelsArray(courses);
|
||||
each trimCourse, index in view.classroom.get('courses')
|
||||
- var course = view.courses.get(trimCourse._id);
|
||||
- var instance = view.courseInstances.findWhere({ courseID: course.id, classroomID: classroom.id })
|
||||
|
|
|
@ -76,10 +76,13 @@ mixin classRow(classroom)
|
|||
if classroom.get('members').length == 0
|
||||
+addStudentsButton(classroom)
|
||||
else
|
||||
- var courses = classroom.get('courses').map(function(c) { return view.courses.get(c._id); });
|
||||
- var courseLabelsArray = view.helper.courseLabelsArray(courses);
|
||||
each trimCourse, index in classroom.get('courses') || []
|
||||
- var course = view.courses.get(trimCourse._id);
|
||||
if view.courseInstances.findWhere({ classroomID: classroom.id, courseID: course.id })
|
||||
+progressDot(classroom, course, index)
|
||||
- var label = courseLabelsArray[index];
|
||||
+progressDot(classroom, course, label)
|
||||
.view-class-arrow.col-xs-1
|
||||
a.view-class-arrow-inner.glyphicon.glyphicon-chevron-right.view-class-btn(data-classroom-id=classroom.id data-event-action="Teachers Classes View Class Chevron")
|
||||
|
||||
|
@ -99,8 +102,7 @@ mixin createClassButton
|
|||
a.create-classroom-btn.btn.btn-lg.btn-primary(data-i18n='teacher.create_new_class')
|
||||
| Create a New Class
|
||||
|
||||
mixin progressDot(classroom, course, index)
|
||||
//- TODO: Give classes abbreviations instead of using index?
|
||||
mixin progressDot(classroom, course, label)
|
||||
//- TODO: inefficient. Cache this in the view?
|
||||
- courseInstance = view.courseInstances.findWhere({ courseID: course.id, classroomID: classroom.id })
|
||||
- var total = classroom.get('members').length
|
||||
|
@ -113,14 +115,11 @@ mixin progressDot(classroom, course, index)
|
|||
- dotClass = complete === total ? 'forest' : started ? 'gold' : '';
|
||||
- var progressDotContext = {total: total, complete: complete};
|
||||
.progress-dot(class=dotClass, data-title=view.progressDotTemplate(progressDotContext))
|
||||
+progressDotLabel(index)
|
||||
+progressDotLabel(label)
|
||||
|
||||
mixin progressDotLabel(index)
|
||||
mixin progressDotLabel(label)
|
||||
.dot-label
|
||||
.text-h6
|
||||
| CS
|
||||
span
|
||||
= index + 1
|
||||
.text-h6= label
|
||||
|
||||
mixin archivedClassRow(classroom)
|
||||
.class.row
|
||||
|
|
|
@ -23,6 +23,7 @@ CourseInstances = require 'collections/CourseInstances'
|
|||
module.exports = class TeacherClassView extends RootView
|
||||
id: 'teacher-class-view'
|
||||
template: template
|
||||
helper: helper
|
||||
|
||||
events:
|
||||
'click .nav-tabs a': 'onClickNavTabLink'
|
||||
|
@ -322,7 +323,7 @@ module.exports = class TeacherClassView extends RootView
|
|||
courseLabels = ""
|
||||
courseOrder = []
|
||||
courses = (@courses.get(c._id) for c in @classroom.get('courses'))
|
||||
courseLabelsArray = @courseLabelsArray courses
|
||||
courseLabelsArray = helper.courseLabelsArray courses
|
||||
for course, index in courses
|
||||
courseLabels += "#{courseLabelsArray[index]} Playtime,"
|
||||
courseOrder.push(course.id)
|
||||
|
@ -466,14 +467,3 @@ module.exports = class TeacherClassView extends RootView
|
|||
when 'enrolled' then (if expires then $.i18n.t('teacher.status_enrolled') else '-')
|
||||
when 'expired' then $.i18n.t('teacher.status_expired')
|
||||
return string.replace('{{date}}', moment(expires).utc().format('l'))
|
||||
|
||||
courseLabelsArray: (courses) ->
|
||||
labels = []
|
||||
courseLabelIndexes = CS: 0, GD: 0, WD: 0
|
||||
for course in courses
|
||||
acronym = switch
|
||||
when /game-dev/.test(course.get('slug')) then 'GD'
|
||||
when /web-dev/.test(course.get('slug')) then 'WD'
|
||||
else 'CS'
|
||||
labels.push acronym + ++courseLabelIndexes[acronym]
|
||||
labels
|
||||
|
|
|
@ -17,6 +17,7 @@ helper = require 'lib/coursesHelper'
|
|||
module.exports = class TeacherClassesView extends RootView
|
||||
id: 'teacher-classes-view'
|
||||
template: template
|
||||
helper: helper
|
||||
|
||||
events:
|
||||
'click .edit-classroom': 'onClickEditClassroom'
|
||||
|
|
Loading…
Reference in a new issue