From cbe836086af25d61892368c267c234580e6f0f8e Mon Sep 17 00:00:00 2001 From: Andrew Miner Date: Sat, 10 Jan 2015 10:52:23 -0800 Subject: [PATCH] Change crafting table name to show step count --- src/scripts/controllers/crafting_table_controller.coffee | 6 ++++++ src/scripts/models/crafting_table.coffee | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/src/scripts/controllers/crafting_table_controller.coffee b/src/scripts/controllers/crafting_table_controller.coffee index ba40b2405..209a3b356 100644 --- a/src/scripts/controllers/crafting_table_controller.coffee +++ b/src/scripts/controllers/crafting_table_controller.coffee @@ -42,7 +42,10 @@ module.exports = class CraftingTableController extends BaseController @$outputLink = @$('.output a') @$outputQuantity = @$('.quantity') @$prev = @$('.prev') + @$title = @$('h2 p') @$tool = @$('.tool p') + + @defaultTitle = @$title.html() super refresh: -> @@ -52,6 +55,9 @@ module.exports = class CraftingTableController extends BaseController if @model.hasSteps if @model.hasPrevStep then @$prev.addClass 'enabled' if @model.hasNextStep then @$next.addClass 'enabled' + @$title.html "Step #{@model.step + 1} of #{@model.stepCount}" + else + @$title.html @defaultTitle @$tool.html @model.toolNames diff --git a/src/scripts/models/crafting_table.coffee b/src/scripts/models/crafting_table.coffee index 673d66c04..429ee694d 100644 --- a/src/scripts/models/crafting_table.coffee +++ b/src/scripts/models/crafting_table.coffee @@ -29,6 +29,7 @@ module.exports = class CraftingTable extends BaseModel multiplier: { get:@getMultiplier } output: { get:@getOutput } step: { get:@getStep, set:@setStep } + stepCount: { get:@getStepCount } toolNames: { get:@getToolNames } } @@ -73,6 +74,10 @@ module.exports = class CraftingTable extends BaseModel return this + getStepCount: -> + return 0 unless @_steps? + return @_steps.length + getToolNames: -> recipe = @_steps[@_step]?.recipe return '' unless recipe?