MCPcopy Create free account
hub / github.com/codecombat/codecombat / afterRender

Method afterRender

app/views/courses/TeacherClassView.js:385–440  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

383 }
384
385 afterRender () {
386 super.afterRender(...arguments)
387 if (!this.courseNagSubview) {
388 this.courseNagSubview = new CourseNagSubview()
389 this.insertSubView(this.courseNagSubview)
390 }
391
392 if (this.classroom.hasAssessments()) {
393 let courseInstance
394 let levels = []
395 let course = this.state.get('selectedCourse')
396 if (course && !this.classroom.hasAssessments({ courseId: course.id })) {
397 course = this.courses.find(c => this.classroom.hasAssessments({ courseId: c.id }))
398 }
399 if (course) {
400 levels = __guard__(_.find(this.courseAssessmentPairs, pair => pair[0] === course), x => x[1]) || []
401 levels = levels.map(l => l.toJSON())
402 courseInstance = this.courseInstances.findWhere({ courseID: course.id, classroomID: this.classroom.id })
403 if (courseInstance) {
404 courseInstance = courseInstance.toJSON()
405 }
406 }
407 const students = this.state.get('students').toJSON()
408
409 const propsData = {
410 students,
411 levels,
412 course: (course != null ? course.toJSON() : undefined),
413 progress: __guard__(this.state.get('progressData'), x1 => x1.get({ classroom: this.classroom, course })),
414 courseInstance,
415 classroom: this.classroom.toJSON(),
416 readOnly: this.state.get('readOnly')
417 }
418 new TeacherClassAssessmentsTable({
419 el: this.$el.find('.assessments-table')[0],
420 propsData
421 })
422 new PieChart({
423 el: this.$el.find('.pie')[0],
424 propsData: {
425 percent: (100 * 2) / 3,
426 strokeWidth: 10,
427 color: '#20572B',
428 opacity: 1
429 }
430 })
431 }
432
433 $('.has-tooltip').off('mouseenter')
434 return $('.has-tooltip').mouseenter(function () {
435 $(this).tooltip({
436 html: true
437 })
438 return $(this).tooltip('show')
439 })
440 }
441
442 allStatsLoaded () {

Callers

nothing calls this directly

Calls 3

hasAssessmentsMethod · 0.80
__guard__Function · 0.70
getMethod · 0.45

Tested by

no test coverage detected