Fix two bugs found by @TiuTalk
* When redirecting internal links, double-check that they actually are internal before doing so. * Avoid double-adding items to the /browse mod list
This commit is contained in:
@@ -63,6 +63,9 @@ module.exports = class BaseController extends Backbone.View
|
|||||||
href = $(event.target).attr 'href'
|
href = $(event.target).attr 'href'
|
||||||
href ?= $(event.currentTarget).attr 'href'
|
href ?= $(event.currentTarget).attr 'href'
|
||||||
logger.info "Re-routing link to internal navigation: #{href}"
|
logger.info "Re-routing link to internal navigation: #{href}"
|
||||||
|
if href? and href.match /^http/
|
||||||
|
window.location.href = href
|
||||||
|
|
||||||
router.navigate href, trigger:true
|
router.navigate href, trigger:true
|
||||||
|
|
||||||
show: (args...)->
|
show: (args...)->
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ module.exports = class BrowsePageController extends PageController
|
|||||||
controller = @_controllers[controllerIndex]
|
controller = @_controllers[controllerIndex]
|
||||||
if not controller?
|
if not controller?
|
||||||
controller = new ModController model:mod
|
controller = new ModController model:mod
|
||||||
|
@_controllers.push controller
|
||||||
controller.render()
|
controller.render()
|
||||||
@$modContainer.append controller.$el
|
@$modContainer.append controller.$el
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -68,5 +68,4 @@ module.exports = class ModPackController extends BaseController
|
|||||||
index += 1
|
index += 1
|
||||||
|
|
||||||
while @_modControllers.length > index
|
while @_modControllers.length > index
|
||||||
controller = @_modControllers.pop()
|
@_modControllers.pop().remove()
|
||||||
controller.$el.fadeOut duration:Duration.normal, complete:-> @remove()
|
|
||||||
|
|||||||
Reference in New Issue
Block a user