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
|
||||
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 ##############################################################################
|
||||
|
||||
parse: (data)->
|
||||
|
||||
@@ -60,7 +60,9 @@ module.exports = class CraftPageController extends PageController
|
||||
return c.text.craftDescription()
|
||||
|
||||
getTitle: ->
|
||||
return 'Craft'
|
||||
description = @model.craftsman.want.toDescription()
|
||||
return null unless description?
|
||||
return "Crafting Plan for #{description}"
|
||||
|
||||
# BaseController Overrides #####################################################################
|
||||
|
||||
@@ -114,6 +116,8 @@ module.exports = class CraftPageController extends PageController
|
||||
@model.craftsman.have.clear()
|
||||
@model.craftsman.have.parse @_storage.load('crafting-plan:have')
|
||||
@model.craftsman.have.on c.event.change, => @onHaveInventoryChanged()
|
||||
|
||||
@model.craftsman.want.on c.event.change, => @refresh()
|
||||
super
|
||||
|
||||
refresh: ->
|
||||
|
||||
@@ -99,8 +99,9 @@ module.exports = class StepController extends BaseController
|
||||
inventory.add toolStack.itemSlug, toolStack.quantity
|
||||
inventory.localize()
|
||||
|
||||
@$toolButton.attr 'href', "/craft/#{inventory.unparse()}"
|
||||
@$toolButton.attr 'target', 'new'
|
||||
inventoryText = inventory.unparse()
|
||||
@$toolButton.attr 'href', "/craft/#{inventoryText}"
|
||||
@$toolButton.attr 'target', inventoryText
|
||||
|
||||
if @canAddTools this
|
||||
@$toolButton.removeClass 'disabled'
|
||||
|
||||
Reference in New Issue
Block a user