Adding some logging for crazy save validation bugs. Swapping in flag item slot.

This commit is contained in:
Nick Winter 2014-10-21 13:57:49 -07:00
parent ba79d59190
commit 7c2982d3f1
6 changed files with 16 additions and 8 deletions

View file

@ -109,6 +109,7 @@ class CocoModel extends Backbone.Model
console.debug "Validation failed for #{@constructor.className}: '#{@get('name') or @}'."
for error in errors
console.debug "\t", error.dataPath, ':', error.message
console.trace()
return errors
save: (attrs, options) ->
@ -335,8 +336,8 @@ class CocoModel extends Backbone.Model
console.error 'Miserably failed to fetch unnotified achievements', arguments
CocoModel.pollAchievements = _.debounce CocoModel.pollAchievements, 500
#- Internationalization
updateI18NCoverage: ->
@ -346,18 +347,18 @@ class CocoModel extends Backbone.Model
console.log 'lang code arrays', langCodeArrays
window.codes = langCodeArrays
@set('i18nCoverage', _.intersection(langCodeArrays...))
findI18NObjects: (data, results) ->
data ?= @attributes
results ?= []
if _.isPlainObject(data) or _.isArray(data)
for [key, value] in _.pairs data
if key is 'i18n'
results.push value
else if _.isPlainObject(value) or _.isArray(value)
@findI18NObjects(value, results)
return results
module.exports = CocoModel

View file

@ -139,6 +139,10 @@ $stashWidth: $totalWidth - $equippedWidth - $stashMargin
&[data-slot="right-hand"] .placeholder
background-position: (-17 * $itemSlotInnerWidth) 0px
&[data-slot="flag"] .placeholder
//background-position: (-18 * $itemSlotInnerWidth) 0px
background-position: (-2 * $itemSlotInnerWidth) 0px
.item-container
position: absolute
left: 0

View file

@ -8,7 +8,8 @@
.replace-me(data-item-id=equipment[slot].get('original'))
.item-slot-column.pull-left
for slot in ['minion', 'torso', 'gloves', 'left-hand', 'misc-0']
// TODO: add in 'misc-0' again somehow? Used to be where 'flag' is now.
for slot in ['minion', 'torso', 'gloves', 'left-hand', 'flag']
.item-slot(data-slot=slot)
.placeholder
.item-container

View file

@ -10,7 +10,7 @@ module.exports = class InventoryView extends CocoView
id: 'inventory-view'
className: 'tab-pane'
template: template
slots: ['head', 'eyes', 'neck', 'torso', 'wrists', 'gloves', 'left-ring', 'right-ring', 'right-hand', 'left-hand', 'waist', 'feet', 'programming-book', 'pet', 'minion', 'misc-0', 'misc-1']
slots: ['head', 'eyes', 'neck', 'torso', 'wrists', 'gloves', 'left-ring', 'right-ring', 'right-hand', 'left-hand', 'waist', 'feet', 'programming-book', 'pet', 'minion', 'flag'] #, 'misc-0', 'misc-1'] # TODO: bring in misc slot(s) again when we have space
events:
'click .item-slot': 'onItemSlotClick'

View file

@ -15,7 +15,7 @@ module.exports = class PlayItemsModal extends ModalView
hands: ['right-hand', 'left-hand']
accessories: ['eyes', 'neck', 'left-ring', 'right-ring', 'waist']
minions: ['minion', 'pet']
misc: ['programming-book', 'misc-0', 'misc-1']
misc: ['programming-book', 'flag', 'misc-0', 'misc-1']
#events:
# 'change input.select': 'onSelectionChanged'

View file

@ -83,9 +83,11 @@ module.exports = class PlayLevelModal extends ModalView
aceConfig.language = codeLanguage
me.set 'aceConfig', aceConfig
if patchMe
console.log 'setting me.heroConfig to', lastHeroConfig
me.set 'heroConfig', lastHeroConfig
me.patch()
if patchSession
console.log 'setting session.heroConfig to', sessionHeroConfig
@options.session.set 'heroConfig', sessionHeroConfig
@options.session.patch success: callback unless skipSessionSave
else