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"
|
logger.error "Default render called for #{@constructor.name} without a template"
|
||||||
return this
|
return this
|
||||||
|
|
||||||
logger.verbose "#{this} rendering with data: #{util.inspect(data)}"
|
logger.verbose "#{this} rendering with data: #{data}"
|
||||||
@onWillRender()
|
@onWillRender()
|
||||||
$oldEl = @$el
|
$oldEl = @$el
|
||||||
$newEl = Backbone.$(@_template(data))
|
$newEl = Backbone.$(@_template(data))
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ module.exports = class CraftingGuideRouter extends Backbone.Router
|
|||||||
item: (name, quantity=1)->
|
item: (name, quantity=1)->
|
||||||
@_pageControllers.item ?= new ItemPageController @_defaultOptions
|
@_pageControllers.item ?= new ItemPageController @_defaultOptions
|
||||||
@_pageControllers.item.model.params = name:name, quantity:quantity
|
@_pageControllers.item.model.params = name:name, quantity:quantity
|
||||||
|
logger.debug "detected params.name: #{name}, params.quantity: #{quantity}"
|
||||||
@_setPage 'item'
|
@_setPage 'item'
|
||||||
|
|
||||||
mod: (slug)->
|
mod: (slug)->
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ module.exports = class BaseModel extends Backbone.Model
|
|||||||
try
|
try
|
||||||
@set @parse text
|
@set @parse text
|
||||||
@trigger Event.change, this
|
@trigger Event.change, this
|
||||||
@trigger Event.sync, this, text
|
@trigger Event.sync, this
|
||||||
logger.info "#{@constructor.name}.#{@cid} loaded successfully"
|
logger.info "#{@constructor.name}.#{@cid} loaded successfully"
|
||||||
catch e
|
catch e
|
||||||
logger.error "A parsing error occured: #{e.stack}"
|
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
|
attributes.table ?= new CraftingTable plan:attributes.plan
|
||||||
super attributes, options
|
super attributes, options
|
||||||
|
|
||||||
@modPack.on Event.add + ':mod', (mod)=> mod.on 'sync', => @_consumeParams()
|
@modPack.on Event.change, => @_consumeParams()
|
||||||
@plan.on Event.change, => @_updateLocation()
|
@plan.on Event.change, => @_updateLocation()
|
||||||
|
|
||||||
# Private Methods ##############################################################################
|
# Private Methods ##############################################################################
|
||||||
@@ -30,7 +30,7 @@ module.exports = class ItemPage extends BaseModel
|
|||||||
_consumeParams: ->
|
_consumeParams: ->
|
||||||
return unless @params?.name?
|
return unless @params?.name?
|
||||||
|
|
||||||
item = @modPack.findItemByName @params.name, includeDisabled:true
|
item = @modPack.findItemByName @params.name
|
||||||
return unless item? and item.isCraftable
|
return unless item? and item.isCraftable
|
||||||
|
|
||||||
quantity = if @params.quantity? then parseInt(@params.quantity) else 1
|
quantity = if @params.quantity? then parseInt(@params.quantity) else 1
|
||||||
|
|||||||
Reference in New Issue
Block a user