Fix bug where deep links didn't connect

This commit is contained in:
Andrew Miner
2015-01-21 15:32:35 -08:00
parent e612cedf8d
commit 641f3f522b
4 changed files with 5 additions and 4 deletions
@@ -87,7 +87,7 @@ module.exports = class BaseController extends Backbone.View
logger.error "Default render called for #{@constructor.name} without a template"
return this
logger.verbose "#{this} rendering with data: #{util.inspect(data)}"
logger.verbose "#{this} rendering with data: #{data}"
@onWillRender()
$oldEl = @$el
$newEl = Backbone.$(@_template(data))
+1
View File
@@ -64,6 +64,7 @@ module.exports = class CraftingGuideRouter extends Backbone.Router
item: (name, quantity=1)->
@_pageControllers.item ?= new ItemPageController @_defaultOptions
@_pageControllers.item.model.params = name:name, quantity:quantity
logger.debug "detected params.name: #{name}, params.quantity: #{quantity}"
@_setPage 'item'
mod: (slug)->
+1 -1
View File
@@ -43,7 +43,7 @@ module.exports = class BaseModel extends Backbone.Model
try
@set @parse text
@trigger Event.change, this
@trigger Event.sync, this, text
@trigger Event.sync, this
logger.info "#{@constructor.name}.#{@cid} loaded successfully"
catch e
logger.error "A parsing error occured: #{e.stack}"
+2 -2
View File
@@ -22,7 +22,7 @@ module.exports = class ItemPage extends BaseModel
attributes.table ?= new CraftingTable plan:attributes.plan
super attributes, options
@modPack.on Event.add + ':mod', (mod)=> mod.on 'sync', => @_consumeParams()
@modPack.on Event.change, => @_consumeParams()
@plan.on Event.change, => @_updateLocation()
# Private Methods ##############################################################################
@@ -30,7 +30,7 @@ module.exports = class ItemPage extends BaseModel
_consumeParams: ->
return unless @params?.name?
item = @modPack.findItemByName @params.name, includeDisabled:true
item = @modPack.findItemByName @params.name
return unless item? and item.isCraftable
quantity = if @params.quantity? then parseInt(@params.quantity) else 1