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

Method constructor

app/views/teachers/EditStudentModal.js:35–62  ·  view source on GitHub ↗
({ user, classroom, students })

Source from the content-addressed store, hash-verified

33 }
34
35 constructor ({ user, classroom, students }) {
36 super(...arguments)
37 this.user = user
38 this.classroom = classroom
39 this.students = students
40 this.supermodel.trackRequest(this.user.fetch())
41 this.utils = require('core/utils')
42 this.state = new State({
43 emailSent: false,
44 passwordChanged: false,
45 newPassword: '',
46 errorMessage: ''
47 })
48 this.fetchPrepaids()
49 this.listenTo(this.state, 'change', this.render)
50 this.listenTo(this.classroom, 'save-password:success', function () {
51 this.state.set({ passwordChanged: true, errorMessage: '' })
52 })
53 this.listenTo(this.classroom, 'save-password:error', function (error) {
54 if (error.message === 'Data matches schema from "not"') {
55 error.message = $.i18n.t('signup.invalid_password')
56 }
57 this.state.set({ errorMessage: error.message })
58 })
59 // TODO: Show an error. (password too short)
60
61 __guard__(me.getClientCreatorPermissions(), x => x.then(() => (typeof this.render === 'function' ? this.render() : undefined)))
62 }
63
64 onLoaded () {
65 this.prepaids.reset(this.prepaids.filter(prepaid => prepaid.status() === 'available'))

Callers

nothing calls this directly

Calls 6

fetchPrepaidsMethod · 0.95
__guard__Function · 0.70
fetchMethod · 0.45
setMethod · 0.45
renderMethod · 0.45

Tested by

no test coverage detected