Refactor to use view in template for issue #3138

This removes getRenderData from: CareersView, SaveCampaignModal,
InfiniteLoopModal, SpellListEntryThangsView, SaveLoadView,
PlaySettingsModal and JobProfileCodeModal.
This commit is contained in:
Imperadeiro98 2015-11-09 21:29:27 +00:00
parent ab5038506a
commit 8e8a3103d5
12 changed files with 15 additions and 50 deletions

View file

@ -2,7 +2,7 @@ extends /templates/core/modal-base
block modal-header-content
h3 Applicant Code for
span.spl= session.get('levelName')
span.spl= view.session.get('levelName')
block modal-body-content
.level-session-code-view

View file

@ -7,10 +7,10 @@ block content
.center
img(src="/images/pages/careers/recruiting.png")
if position === 'software-engineer'
if view.position === 'software-engineer'
h1.center Software Engineer
+company-blurb
.big-side-margins
h3 Engineering at CodeCombat
@ -24,7 +24,7 @@ block content
h3 Upcoming Projects
.big-text
p
p
strong iPad app
div Bring the CodeCombat experience to the iPad
@ -46,7 +46,7 @@ block content
+next-steps
else if position === 'software-engineer-ios'
else if view.position === 'software-engineer-ios'
h1.center Software Engineer, iOS
+company-blurb
@ -64,7 +64,7 @@ block content
+next-steps
else if position === 'game-designer'
else if view.position === 'game-designer'
h1.center Game Designer
+company-blurb
@ -109,7 +109,7 @@ block content
a(href="/careers/game-designer") Game Designer
br
p Don't see a position that suits you, but still want to to contribute?
p
p
span.spr Please contact us at
a(href="mailto:careers@codecombat.com") careers@codecombat.com

View file

@ -4,14 +4,14 @@ block modal-header-content
h3 Save Changes to Campaign
block modal-body-content
if !modelsToSave.models.length
if !view.modelsToSave.models.length
.alert.alert-info(data-i18n="delta.no_changes") No changes
for model in modelsToSave.models
for model in view.modelsToSave.models
.panel.panel-default
.panel-heading
span.panel-title.spr= model.get('name')
span.text-muted= model.constructor.className
span.text-muted= model.constructor.className
.panel-body
.delta-view(data-model-id=model.id)

View file

@ -1,7 +1,7 @@
extends /templates/core/modal-base
block modal-header-content
if nonUserCodeProblem
if view.options.nonUserCodeProblem
h3(data-i18n="play_level.non_user_code_problem_title") Unable to Load Level
else
h3(data-i18n="play_level.infinite_loop_title") Infinite Loop Detected

View file

@ -1,3 +1,3 @@
h4
span(data-i18n="play_level.tome_select_a_thang") Select Someone for
code #{spell.name}(#{(spell.parameters || []).join(", ")})
span(data-i18n="play_level.tome_select_a_thang") Select Someone for
code #{view.spell.name}(#{(view.spell.parameters || []).join(", ")})

View file

@ -7,8 +7,3 @@ module.exports = class CareersView extends RootView
constructor: (options, @position) ->
super options
getRenderData: ->
context = super()
context.position = @position
context

View file

@ -13,11 +13,6 @@ module.exports = class SaveCampaignModal extends ModalView
constructor: (options, @modelsToSave) ->
super(options)
getRenderData: ->
c = super()
c.modelsToSave = @modelsToSave
c
afterRender: ->
@$el.find('.delta-view').each((i, el) =>
$el = $(el)

View file

@ -9,8 +9,3 @@ module.exports = class InfiniteLoopModal extends ModalView
'click #restart-level-infinite-loop-retry-button': -> Backbone.Mediator.publish 'tome:cast-spell', {}
'click #restart-level-infinite-loop-confirm-button': -> Backbone.Mediator.publish 'level:restart', {}
'click #restart-level-infinite-loop-comment-button': -> Backbone.Mediator.publish 'tome:comment-my-code', {}
getRenderData: ->
c = super()
c.nonUserCodeProblem = @options.nonUserCodeProblem
c

View file

@ -13,12 +13,6 @@ module.exports = class SpellListEntryThangsView extends CocoView
@spell = options.spell
@avatars = []
getRenderData: (context={}) ->
context = super context
context.thangs = @thangs
context.spell = @spell
context
afterRender: ->
super()
avatar.destroy() for avatar in @avatars if @avatars

View file

@ -11,10 +11,6 @@ module.exports = class SaveLoadView extends CocoView
events:
'change #save-granularity-toggle input': 'onSaveGranularityChanged'
getRenderData: (context={}) ->
context = super(context)
context
afterRender: ->
super()

View file

@ -14,10 +14,6 @@ module.exports = class PlaySettingsModal extends ModalView
constructor: (options) ->
super options
getRenderData: (context={}) ->
context = super(context)
context
afterRender: ->
super()
return unless @supermodel.finished()

View file

@ -7,18 +7,12 @@ module.exports = class JobProfileCodeModal extends ModalView
template: template
modalWidthPercent: 90
plain: true
constructor: (options) ->
super(arguments...)
@session = options.session
getRenderData: ->
c = super()
c.session = @session
c
afterRender: ->
super()
codeView = new LevelSessionCodeView({session:@session})
@insertSubView(codeView, @$el.find('.level-session-code-view'))