Correct several small bugs found in user testing
* The "Show Plan for Tools" link should open a new window each time
it is clicked (i.e., don't re-use the same window)
* Further customize the title of the crafting page to give some
indication of what is being crafted
This commit is contained in:
@@ -141,6 +141,18 @@ module.exports = class Inventory extends BaseModel
|
|||||||
@trigger c.event.change, this
|
@trigger c.event.change, this
|
||||||
return this
|
return this
|
||||||
|
|
||||||
|
toDescription: ->
|
||||||
|
return null if @isEmpty
|
||||||
|
return null unless @modPack?
|
||||||
|
|
||||||
|
item = @modPack.findItem @_itemSlugs[0]
|
||||||
|
extras = @_itemSlugs.length - 1
|
||||||
|
|
||||||
|
result = "#{item.name}"
|
||||||
|
if extras > 0 then result += " and #{extras} more..."
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
# Parsing Methods ##############################################################################
|
# Parsing Methods ##############################################################################
|
||||||
|
|
||||||
parse: (data)->
|
parse: (data)->
|
||||||
|
|||||||
@@ -60,7 +60,9 @@ module.exports = class CraftPageController extends PageController
|
|||||||
return c.text.craftDescription()
|
return c.text.craftDescription()
|
||||||
|
|
||||||
getTitle: ->
|
getTitle: ->
|
||||||
return 'Craft'
|
description = @model.craftsman.want.toDescription()
|
||||||
|
return null unless description?
|
||||||
|
return "Crafting Plan for #{description}"
|
||||||
|
|
||||||
# BaseController Overrides #####################################################################
|
# BaseController Overrides #####################################################################
|
||||||
|
|
||||||
@@ -114,6 +116,8 @@ module.exports = class CraftPageController extends PageController
|
|||||||
@model.craftsman.have.clear()
|
@model.craftsman.have.clear()
|
||||||
@model.craftsman.have.parse @_storage.load('crafting-plan:have')
|
@model.craftsman.have.parse @_storage.load('crafting-plan:have')
|
||||||
@model.craftsman.have.on c.event.change, => @onHaveInventoryChanged()
|
@model.craftsman.have.on c.event.change, => @onHaveInventoryChanged()
|
||||||
|
|
||||||
|
@model.craftsman.want.on c.event.change, => @refresh()
|
||||||
super
|
super
|
||||||
|
|
||||||
refresh: ->
|
refresh: ->
|
||||||
|
|||||||
@@ -99,8 +99,9 @@ module.exports = class StepController extends BaseController
|
|||||||
inventory.add toolStack.itemSlug, toolStack.quantity
|
inventory.add toolStack.itemSlug, toolStack.quantity
|
||||||
inventory.localize()
|
inventory.localize()
|
||||||
|
|
||||||
@$toolButton.attr 'href', "/craft/#{inventory.unparse()}"
|
inventoryText = inventory.unparse()
|
||||||
@$toolButton.attr 'target', 'new'
|
@$toolButton.attr 'href', "/craft/#{inventoryText}"
|
||||||
|
@$toolButton.attr 'target', inventoryText
|
||||||
|
|
||||||
if @canAddTools this
|
if @canAddTools this
|
||||||
@$toolButton.removeClass 'disabled'
|
@$toolButton.removeClass 'disabled'
|
||||||
|
|||||||
Reference in New Issue
Block a user