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

Method onClickModulePortal

app/views/play/CampaignView.js:2275–2294  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

2273 }
2274
2275 onClickModulePortal (e) {
2276 e.preventDefault()
2277 e.stopPropagation()
2278 if (this.editorMode) { return }
2279 const $target = $(e.currentTarget)
2280 const moduleSlug = $target.data('module-slug')
2281 if (!moduleSlug) { return }
2282 if ($target.hasClass('locked')) {
2283 const lockReason = $target.data('lock-reason')
2284 if (lockReason === 'need-premium') {
2285 return this.promptForSubscription(moduleSlug, 'locked module clicked')
2286 }
2287 return
2288 }
2289 Backbone.Mediator.publish('router:navigate', {
2290 route: `/play/${moduleSlug}`,
2291 viewClass: CampaignView,
2292 viewArgs: [{ supermodel: this.supermodel }, moduleSlug],
2293 })
2294 }
2295
2296 onClickCampaignSwitch (e) {
2297 const campaignSlug = $(e.target).data('campaign-slug')

Callers

nothing calls this directly

Calls 3

promptForSubscriptionMethod · 0.95
dataMethod · 0.80
publishMethod · 0.80

Tested by

no test coverage detected