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

Method onClickChangeHeroButton

app/views/courses/CoursesView.js:591–612  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

589 }
590
591 onClickChangeHeroButton () {
592 if (window.tracker != null) {
593 window.tracker.trackEvent('Students Change Hero Started', { category: 'Students' })
594 }
595 let hasOnlyJuniorCourses = true
596 for (const courseInstance of this.courseInstances.models) {
597 if (courseInstance.get('courseID') !== utils.courseIDs.JUNIOR) {
598 hasOnlyJuniorCourses = false
599 break
600 }
601 }
602 const modal = new HeroSelectModal({ currentHeroID: this.hero.id, product: hasOnlyJuniorCourses ? 'codecombat-junior' : null })
603 this.openModalView(modal)
604 this.listenTo(modal, 'hero-select:success', newHero => {
605 // @hero.url = "/db/thang.type/#{me.get('heroConfig').thangType}/version"
606 // @hero.fetch()
607 return this.hero.set(newHero.attributes)
608 })
609 return this.listenTo(modal, 'hide', function () {
610 return this.stopListening(modal)
611 })
612 }
613
614 onSubmitJoinClassForm (e) {
615 e.preventDefault()

Callers

nothing calls this directly

Calls 3

trackEventMethod · 0.45
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected