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:
@@ -40,6 +40,8 @@ module.exports = class StackController extends BaseController
|
|||||||
# Event Methods ################################################################################
|
# Event Methods ################################################################################
|
||||||
|
|
||||||
onQuantityFieldBlur: ->
|
onQuantityFieldBlur: ->
|
||||||
|
return unless @editable
|
||||||
|
|
||||||
quantityText = @$quantityField.val().trim()
|
quantityText = @$quantityField.val().trim()
|
||||||
if quantityText.length is 0
|
if quantityText.length is 0
|
||||||
quantity = @_priorValue
|
quantity = @_priorValue
|
||||||
@@ -61,6 +63,8 @@ module.exports = class StackController extends BaseController
|
|||||||
@onChange()
|
@onChange()
|
||||||
|
|
||||||
onQuantityFieldChanged: ->
|
onQuantityFieldChanged: ->
|
||||||
|
return unless @editable
|
||||||
|
|
||||||
quantityText = @$quantityField.val().trim()
|
quantityText = @$quantityField.val().trim()
|
||||||
if not quantityText.match /^[0-9]*$/
|
if not quantityText.match /^[0-9]*$/
|
||||||
@$quantityField.addClass 'error', 0
|
@$quantityField.addClass 'error', 0
|
||||||
@@ -78,6 +82,8 @@ module.exports = class StackController extends BaseController
|
|||||||
@$quantityField.blur()
|
@$quantityField.blur()
|
||||||
|
|
||||||
onQuantityKeyUp: (event)->
|
onQuantityKeyUp: (event)->
|
||||||
|
return unless @editable
|
||||||
|
|
||||||
if event.which is Key.Return
|
if event.which is Key.Return
|
||||||
@$quantityField.blur()
|
@$quantityField.blur()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user