Clear recipeName field on focus

This commit is contained in:
Andrew Miner
2015-01-01 21:38:58 -08:00
parent 3493c41b39
commit f16c01ca3d
4 changed files with 6 additions and 9 deletions
@@ -6,6 +6,7 @@
###
BaseController = require './base_controller'
{Duration} = require '../constants'
{Event} = require '../constants'
InventoryParser = require '../models/inventory_parser'
{Key} = require '../constants'
@@ -47,13 +48,16 @@ module.exports = class CraftingTableController extends BaseController
onNameFieldChanged: ->
return unless @rendered
@model.name = @$nameField.val()
name = @$nameField.val()
@model.name = name
@_craft()
# @$nameField.blur()
if name.length is 0
setTimeout (=> @$nameField.blur()), Duration.snap
onNameFieldFocused: ->
return unless @rendered
@$nameField.val ""
@$nameField.autocomplete 'search'
@@ -24,7 +24,6 @@ module.exports = class ItemPageController extends BaseController
setParams: (params)->
@model.table.name = params.name if params.name?
@model.table.quantity = params.quantity if params.quantity?
logger.debug "quantity updated to: #{@model.table.quantity} with params: #{params.count}"
# BaseController Overrides #####################################################################
-5
View File
@@ -49,7 +49,6 @@ module.exports = class CraftingPlan
_processPending: ->
targetItem = @_pending.pop()
return unless targetItem?
logger.debug "Processing targetItem: #{targetItem}"
return if @modPack.isRawMaterial targetItem.name
@@ -57,13 +56,11 @@ module.exports = class CraftingPlan
return if not recipes.length > 0
recipe = recipes[0]
logger.debug "Using recipe: #{recipe}"
if @includingTools
for tool in recipe.tools
totalExpected = @result.quantityOf(tool.name) + @_expected.quantityOf(tool.name)
if totalExpected < tool.quantity
logger.debug "Need to build tool: #{tool}"
@_pending.add tool.name, tool.quantity
@_expected.add tool.name, tool.quantity
@@ -80,7 +77,6 @@ module.exports = class CraftingPlan
quantityAvailable = @result.quantityOf item.name
quantityUsed = Math.min quantityAvailable, item.quantity
quantityNeeded = item.quantity - quantityUsed
logger.debug "processing input item: #{item}, a:#{quantityAvailable}, u:#{quantityUsed}, n:#{quantityNeeded}"
@result.remove item.name, quantityUsed
@_pending.add item.name, quantityNeeded
@@ -90,7 +86,6 @@ module.exports = class CraftingPlan
quantityMissing = @need.quantityOf item.name
quantityUsed = Math.min quantityMissing, item.quantity
quantityLeft = item.quantity - quantityUsed
logger.debug "processing output item: #{item}, m:#{quantityMissing}, u:#{quantityUsed}, l:#{quantityLeft}"
@make.add item.name, item.quantity
@need.remove item.name, quantityUsed