MCPcopy Index your code
hub / github.com/codecombat/codecombat / constructor

Method constructor

app/views/courses/TeacherClassView.js:60–163  ·  view source on GitHub ↗
(options, classroomID)

Source from the content-addressed store, hash-verified

58module.exports = (TeacherClassView = (function () {
59 TeacherClassView = class TeacherClassView extends RootView {
60 constructor (options, classroomID) {
61 if (!options) {
62 options = {}
63 }
64 super(options)
65 this.setCourseMembers = this.setCourseMembers.bind(this)
66 this.onMyClansLoaded = this.onMyClansLoaded.bind(this)
67 this.onClickAddStudents = this.onClickAddStudents.bind(this)
68
69 this.utils = utils
70
71 if (options.renderOnlyContent) {
72 this.template = viewContentTemplate
73 } else {
74 this.template = viewContentTemplateWithLayout
75 }
76
77 // wrap templates so they translate when called
78 const translateTemplateText = (template, context) => $('<div />').html(template(context)).i18n().html()
79 this.singleStudentCourseProgressDotTemplate = _.wrap(require('app/templates/teachers/hovers/progress-dot-single-student-course'), translateTemplateText)
80 this.singleStudentLevelProgressDotTemplate = _.wrap(require('app/templates/teachers/hovers/progress-dot-single-student-level'), translateTemplateText)
81 this.allStudentsLevelProgressDotTemplate = _.wrap(require('app/templates/teachers/hovers/progress-dot-all-students-single-level'), translateTemplateText)
82
83 this.urls = require('core/urls')
84
85 this.debouncedRender = _.debounce(this.render)
86 this.debouncedRenderSelectors = _.debounce(this.renderSelectors, 800)
87 this.calculateProgressAndLevels = _.debounce(this.calculateProgressAndLevelsAux, 800)
88
89 this.state = new State(this.getInitialState())
90
91 if (options.readOnly) {
92 this.state.set('readOnly', options.readOnly)
93 }
94 if (options.renderOnlyContent) {
95 this.state.set('renderOnlyContent', options.renderOnlyContent)
96 }
97
98 this.updateHash(this.state.get('activeTab')) // TODO: Don't push to URL history (maybe don't use url fragment for default tab)
99
100 this.classroom = new Classroom({ _id: classroomID })
101 this.supermodel.trackRequest(this.classroom.fetch())
102 this.onKeyPressStudentSearch = _.debounce(this.onKeyPressStudentSearch, 200)
103 this.sortedCourses = []
104 this.latestReleasedCourses = []
105
106 this.students = new Users()
107 this.classroom.sessions = new LevelSessions()
108 this.listenTo(this.classroom, 'sync', function () {
109 this.fetchStudents()
110 this.fetchSessions()
111 this.fetchPrepaids()
112 this.fetchClans()
113 this.classroom.language = __guard__(this.classroom.get('aceConfig'), x => x.language)
114 })
115
116 this.students.comparator = (s1, s2) => {
117 const dir = this.state.get('sortDirection')

Callers

nothing calls this directly

Calls 15

getInitialStateMethod · 0.95
updateHashMethod · 0.95
fetchStudentsMethod · 0.95
fetchSessionsMethod · 0.95
fetchPrepaidsMethod · 0.95
fetchClansMethod · 0.95
attachMediatorEventsMethod · 0.95
broadNameMethod · 0.80
prepaidStatusMethod · 0.80
__guard__Function · 0.70
setMethod · 0.45

Tested by

no test coverage detected