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

Method afterRender

app/views/editor/level/LevelEditView.js:222–256  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

220 }
221
222 afterRender () {
223 super.afterRender()
224 if (!this.supermodel.finished()) { return }
225 if (!this.fullyRenderedOnce) {
226 this.listenTo(this.level, 'change:tasks', () => this.renderSelectors('#tasks-tab'))
227 }
228 this.thangsTabView = this.insertSubView(new ThangsTabView({ world: this.world, supermodel: this.supermodel, level: this.level, previouslyLoadedData: this.previouslyLoadedSubviewData }))
229 this.insertSubView(new SettingsTabView({ supermodel: this.supermodel, previouslyLoadedData: this.previouslyLoadedSubviewData }))
230 this.insertSubView(new ScriptsTabView({ world: this.world, supermodel: this.supermodel, files: this.files }))
231 this.insertSubView(new ComponentsTabView({ supermodel: this.supermodel }))
232 this.insertSubView(new SystemsTabView({ supermodel: this.supermodel, world: this.world }))
233 this.insertKeyThangTabViews()
234 this.insertSubView(new TasksTabView({ world: this.world, supermodel: this.supermodel, level: this.level }))
235 this.insertSubView(new RelatedAchievementsView({ supermodel: this.supermodel, level: this.level }))
236 this.insertSubView(new ComponentsDocumentationView({ lazy: true })) // Don't give it the supermodel, it'll pollute it!
237 this.insertSubView(new SystemsDocumentationView({ lazy: true })) // Don't give it the supermodel, it'll pollute it!
238 this.insertSubView(new LevelFeedbackView({ level: this.level }))
239 this.$el.find('a[data-toggle="tab"]').on('shown.bs.tab', e => {
240 return Backbone.Mediator.publish('editor:view-switched', { targetURL: $(e.target).attr('href') })
241 })
242
243 Backbone.Mediator.publish('editor:level-loaded', { level: this.level })
244 if (!this.fullyRenderedOnce && me.get('anonymous')) { this.showReadOnly() }
245 this.patchesView = this.insertSubView(new PatchesView(this.level), this.$el.find('.patches-view'))
246 this.listenTo(this.patchesView, 'accepted-patch', function (attrs) {
247 if (attrs != null ? attrs.save : undefined) {
248 const f = () => this.startCommittingLevel(attrs)
249 return setTimeout(f, 400) // Give some time for closing patch modal
250 } else {
251 if (!key.shift) { return location.reload() }
252 }
253 }) // Reload to make sure changes propagate, unless secret shift shortcut
254 if (this.level.watching()) { return this.$el.find('#level-watch-button').find('> span').toggleClass('secret') }
255 this.fullyRenderedOnce = true
256 }
257
258 insertKeyThangTabViews () {
259 if (this.keyThangTabViews == null) { this.keyThangTabViews = {} }

Callers

nothing calls this directly

Calls 5

publishMethod · 0.80
reloadMethod · 0.80
watchingMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected