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

Method afterRender

app/views/HomeView.js:296–364  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

294 }
295
296 afterRender () {
297 if (me.isAnonymous()) {
298 if ((document.location.hash === '#create-account') || (utils.getQueryVariable('registering') === true)) {
299 _.defer(() => { if (!this.destroyed) { return this.openModalView(new CreateAccountModal()) } })
300 }
301 if (document.location.hash === '#create-account-individual') {
302 _.defer(() => { if (!this.destroyed) { return this.openModalView(new CreateAccountModal({ startOnPath: 'individual' })) } })
303 }
304 if (document.location.hash === '#create-account-home') {
305 _.defer(() => { if (!this.destroyed) { return this.openModalView(new CreateAccountModal({ startOnPath: 'individual-basic' })) } })
306 }
307 if (document.location.hash === '#create-account-student') {
308 _.defer(() => { if (!this.destroyed) { return this.openModalView(new CreateAccountModal({ startOnPath: 'student' })) } })
309 }
310 if (document.location.hash === '#create-account-teacher') {
311 _.defer(() => { if (!this.destroyed) { return this.openModalView(new CreateAccountModal({ startOnPath: 'teacher' })) } })
312 }
313 if (utils.getQueryVariable('create-account') === 'teacher') {
314 _.defer(() => { if (!this.destroyed) { return this.openModalView(new CreateAccountModal({ startOnPath: 'teacher' })) } })
315 }
316 if (document.location.hash === '#login') {
317 const AuthModal = require('app/views/core/AuthModal')
318 const url = new URLSearchParams(window.location.search)
319 _.defer(() => { if (!this.destroyed) { return this.openModalView(new AuthModal({ initialValues: { email: url.get('email') } })) } })
320 }
321 }
322
323 if (isCoco()) {
324 let needle, needle1, paymentResult, title, type
325 if ((needle = utils.getQueryVariable('payment-studentLicenses'), ['success', 'failed'].includes(needle)) && !this.renderedPaymentNoty) {
326 paymentResult = utils.getQueryVariable('payment-studentLicenses')
327 if (paymentResult === 'success') {
328 title = $.i18n.t('payments.studentLicense_successful')
329 type = 'success'
330 if (utils.getQueryVariable('tecmilenio')) {
331 title = '¡Felicidades! El alumno recibirá más información de su profesor para acceder a la licencia de CodeCombat.'
332 }
333 this.trackPurchase(`Student license purchase ${type}`)
334 } else {
335 title = $.i18n.t('payments.failed')
336 type = 'error'
337 }
338 noty({ text: title, type, timeout: 10000, killer: true })
339 this.renderedPaymentNoty = true
340 } else if ((needle1 = utils.getQueryVariable('payment-homeSubscriptions'), ['success', 'failed'].includes(needle1)) && !this.renderedPaymentNoty) {
341 paymentResult = utils.getQueryVariable('payment-homeSubscriptions')
342 if (paymentResult === 'success') {
343 title = $.i18n.t('payments.homeSubscriptions_successful')
344 type = 'success'
345 this.trackPurchase(`Home subscription purchase ${type}`)
346 } else {
347 title = $.i18n.t('payments.failed')
348 type = 'error'
349 }
350 noty({ text: title, type, timeout: 10000, killer: true })
351 this.renderedPaymentNoty = true
352 }
353 _.delay(this.activateCarousels, 1000)

Callers

nothing calls this directly

Calls 6

trackPurchaseMethod · 0.95
isCocoFunction · 0.85
isAnonymousMethod · 0.80
dataMethod · 0.80
__guard__Function · 0.70
getMethod · 0.45

Tested by

no test coverage detected