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

Method showPoll

app/views/play/CampaignView.js:2379–2397  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2377 }
2378
2379 showPoll () {
2380 if (!this.shouldShow('poll')) { return false }
2381 if (this.poll.get('slug') === 'how-old-are-you' && userUtils.isCreatedViaLibrary()) {
2382 return false // since the answers of how-old-are-you poll do no have nextPoll, so just return is fine
2383 }
2384 const pollModal = new PollModal({ supermodel: this.supermodel, poll: this.poll, userPollsRecord: this.userPollsRecord })
2385 this.openModalView(pollModal)
2386 const $pollButton = this.$el.find('button.poll')
2387 pollModal.on('vote-updated', () => $pollButton.removeClass('highlighted').tooltip('hide'))
2388 pollModal.once('trigger-next-poll', nextPollId => {
2389 this.loadPoll('/db/poll/' + nextPollId, true)
2390 })
2391 pollModal.once('trigger-show-live-classes', () => {
2392 this.openModalView(new LiveClassroomModal())
2393 })
2394 pollModal.once('trigger-codequest-modal', () => {
2395 this.openModalView(new Codequest2020Modal())
2396 })
2397 }
2398
2399 onClickPremiumButton (e) {
2400 const trackProperties = { category: 'Subscription', label: 'campaignview premium button' }

Callers 1

activatePollMethod · 0.95

Calls 3

shouldShowMethod · 0.95
loadPollMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected