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

Method initClass

app/core/Router.js:40–600  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38module.exports = (CocoRouter = (function () {
39 CocoRouter = class CocoRouter extends Backbone.Router {
40 static initClass () {
41 this.prototype.routes = {
42 '' () {
43 if (utils.getQueryVariable('hour_of_code')) {
44 delete window.alreadyLoadedView
45 return this.navigate('/play?hour_of_code=true', { trigger: true, replace: true })
46 }
47
48 if (utils.isCodeCombat) {
49 if (utils.getQueryVariable('payment-homeSubscriptions')) {
50 return this.routeDirectly('HomeView')
51 }
52 if (!me.isAnonymous() && !me.isStudent() && !me.isTeacher() && !me.isAdmin() && !me.hasSubscription() && !me.isAPIClient() && !paymentUtils.hasTemporaryPremiumAccess() && !me.isParentHome()) {
53 delete window.alreadyLoadedView
54 return this.navigate('/premium', { trigger: true, replace: true })
55 }
56 if (me.isAPIClient()) {
57 delete window.alreadyLoadedView
58 // return @navigate "/league/#{me.get('clans')?[0] ? ''}apiclient-data", {trigger: true, replace: true} # Once we make sure all students have been associated with their API creators
59 return this.navigate('/partner-dashboard', { trigger: true, replace: true })
60 }
61 if (me.useChinaHomeView()) {
62 delete window.alreadyLoadedView
63 return this.routeDirectly('HomeCNView', [])
64 }
65 }
66 if (utils.isCodeCombat) {
67 return this.routeDirectly('HomeBeta', [], { vueRoute: true, baseTemplate: 'base-flat-vue' })
68 } else {
69 return this.routeDirectly('HomeView', [])
70 }
71 },
72
73 about: go('AboutView'),
74 'contact-cn': go('ContactCNView'),
75 'china-bridge': go('ChinaBridgeView'),
76
77 account: go('account/MainAccountView'),
78 'account/oauth-aiyouth': go('account/OAuthAIYouthView'),
79
80 'account/settings': go('account/AccountSettingsRootView'),
81 'account/unsubscribe': go('account/UnsubscribeView'),
82 'account/payments': go('account/PaymentsView'),
83 'account/subscription': go('account/SubscriptionView', { redirectStudents: true, redirectTeachers: true }),
84 'account/invoices': go('account/InvoicesView'),
85 'account/prepaid': go('account/PrepaidView'),
86
87 ai: go('ai/AIView'),
88 'ai/*path': go('ai/AIView'),
89
90 'ai-junior': go('core/SingletonAppVueComponentView'),
91 'ai-junior/project/:scenarioId': go('core/SingletonAppVueComponentView'),
92 'ai-junior/project/:scenarioId/:userId': go('core/SingletonAppVueComponentView'),
93 'ai-junior/project/:scenarioId/:userId/:projectId': go('core/SingletonAppVueComponentView'),
94
95 'ai-junior/demo': go('core/SingletonAppVueComponentView'),
96
97 licensor: go('LicensorView'),

Callers 1

Router.jsFile · 0.45

Calls 4

goFunction · 0.85
redirectFunction · 0.85
teacherProxyRouteFunction · 0.85
useChinaHomeViewMethod · 0.80

Tested by

no test coverage detected