Added hero components projection for good hero stat comparison bars. Fixed overflow/scrolling on code language selector for play-heroes-modal.

This commit is contained in:
Nick Winter 2014-11-05 19:37:13 -08:00
parent 35f5fd1c84
commit ce8b3bc83c
2 changed files with 11 additions and 12 deletions

View file

@ -264,7 +264,6 @@ $heroCanvasHeight: 265px
.trigger, .options
background-color: rgb(239,232,217)
width: 100%
color: black
.trigger
@ -272,6 +271,7 @@ $heroCanvasHeight: 265px
border: 3px solid black
font-size: 16px
padding: 5px 10px
width: 100%
//- the little triangle on the right side of the fancy select box
&:after
@ -282,6 +282,7 @@ $heroCanvasHeight: 265px
.options
padding-left: 5px
overflow: visible
.selected
color: black
@ -295,6 +296,7 @@ $heroCanvasHeight: 265px
padding-left: 40px
background: transparent url(/images/common/code_languages/javascript_small.png) no-repeat left center
background-size: 32px 32px
margin-bottom: -1px
&[data-value="python"]
background-image: url(/images/common/code_languages/python_small.png)

View file

@ -27,12 +27,12 @@ module.exports = class PlayHeroesModal extends ModalView
@confirmButtonI18N = options.confirmButtonI18N ? "common.save"
@heroes = new CocoCollection([], {model: ThangType})
@heroes.url = '/db/thang.type?view=heroes'
@heroes.setProjection ['original','name','slug','soundTriggers','featureImage','gems','heroClass','description']
@heroes.setProjection ['original','name','slug','soundTriggers','featureImage','gems','heroClass','description','components']
@listenToOnce @heroes, 'sync', @onHeroesLoaded
@supermodel.loadCollection(@heroes, 'heroes')
@stages = {}
@session = options.session
onHeroesLoaded: ->
for hero in @heroes.models
hero.name = utils.i18n hero.attributes, 'extendedName' # or whatever the property name ends up being
@ -168,26 +168,26 @@ module.exports = class PlayHeroesModal extends ModalView
saveAndHide: ->
hero = @selectedHero.get('original')
if @session
changed = @updateHeroConfig(@session, hero)
if @session.get('codeLanguage') isnt @codeLanguage
@session.set('codeLanguage', @codeLanguage)
changed = true
@session.patch() if changed
changed = @updateHeroConfig(me, hero)
aceConfig = _.clone(me.get('aceConfig'))
if @codeLanguage isnt aceConfig.language
aceConfig.language = @codeLanguage
me.set 'aceConfig', aceConfig
changed = true
me.patch() if changed
@hide()
updateHeroConfig: (model, hero) ->
heroConfig = _.clone(model.get('heroConfig')) or {}
if heroConfig.thangType isnt hero
@ -204,6 +204,3 @@ module.exports = class PlayHeroesModal extends ModalView
createjs.Ticker.removeEventListener "tick", stage
stage.removeAllChildren()
super()