Don't change stack quantity when not editable

When displaying an inventory list in read-only mode, it was possible
to reset the quantity to 9999 if the value was higher than that by
clicking the field. This accidentally triggered the validations
applied when editing the field even though editing wasn't possible.
This commit is contained in:
Andrew Miner
2015-04-13 10:26:24 -07:00
parent 5a4e9f8c7b
commit 7288f25d7d
@@ -40,6 +40,8 @@ module.exports = class StackController extends BaseController
# Event Methods ################################################################################
onQuantityFieldBlur: ->
return unless @editable
quantityText = @$quantityField.val().trim()
if quantityText.length is 0
quantity = @_priorValue
@@ -61,6 +63,8 @@ module.exports = class StackController extends BaseController
@onChange()
onQuantityFieldChanged: ->
return unless @editable
quantityText = @$quantityField.val().trim()
if not quantityText.match /^[0-9]*$/
@$quantityField.addClass 'error', 0
@@ -78,6 +82,8 @@ module.exports = class StackController extends BaseController
@$quantityField.blur()
onQuantityKeyUp: (event)->
return unless @editable
if event.which is Key.Return
@$quantityField.blur()