(param)
| 24 | } |
| 25 | |
| 26 | constructor (param) { |
| 27 | if (param == null) { param = {} } |
| 28 | super(param) |
| 29 | const { classCode } = param |
| 30 | this.classCode = classCode |
| 31 | this.classroom = new Classroom() |
| 32 | this.teacher = new User() |
| 33 | const jqxhr = this.supermodel.trackRequest(this.classroom.fetchByCode(this.classCode)) |
| 34 | if (!me.get('emailVerified')) { |
| 35 | this.supermodel.trackRequest($.post(`/db/user/${me.id}/request-verify-email`)) |
| 36 | } |
| 37 | this.listenTo(this.classroom, 'error', function (classroom, response) { |
| 38 | let errorMessage = `${response.responseText}` |
| 39 | |
| 40 | if (response.status === 422) { |
| 41 | errorMessage = 'Please enter a code.' |
| 42 | } else if (jqxhr.status === 404) { |
| 43 | errorMessage = $.t('signup.classroom_not_found') |
| 44 | } else if (jqxhr.status === 403) { |
| 45 | errorMessage = $.t('signup.activation_code_used') |
| 46 | } |
| 47 | |
| 48 | return noty({ |
| 49 | type: 'error', |
| 50 | layout: 'topCenter', |
| 51 | text: errorMessage, |
| 52 | timeout: '3000' |
| 53 | }) |
| 54 | }) |
| 55 | this.listenTo(this.classroom, 'sync', function () { |
| 56 | return this.render |
| 57 | }) |
| 58 | this.listenTo(this.classroom, 'join:success', function () { |
| 59 | return this.trigger('join:success', this.classroom) |
| 60 | }) |
| 61 | this.listenTo(this.classroom, 'join:error', function () { |
| 62 | return this.trigger('join:error', this.classroom, jqxhr) |
| 63 | }) |
| 64 | } |
| 65 | // @close() |
| 66 | |
| 67 | onClickJoinClassButton () { |
nothing calls this directly
no test coverage detected