Fix bug where deep links didn't connect
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -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)->
|
||||
|
||||
@@ -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}"
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user