From 32e32d3934d8aa0a77eaf35ce6ba0e48b8fc5d1d Mon Sep 17 00:00:00 2001 From: jlukic Date: Fri, 20 Feb 2015 12:24:37 -0500 Subject: [PATCH] Related #1840, force removing duplicate slashes from path when auto: true --- src/definitions/modules/tab.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/definitions/modules/tab.js b/src/definitions/modules/tab.js index 7080b1e15..56ad47b77 100644 --- a/src/definitions/modules/tab.js +++ b/src/definitions/modules/tab.js @@ -75,10 +75,7 @@ $.fn.tab = function(parameters) { // set up automatic routing if(settings.auto) { - module.verbose('Setting up automatic tab retrieval from server'); - settings.apiSettings = { - url: (settings.path || '') + '/{$tab}' - }; + module.set.auto(); } // attach events if navigation wasn't set to window @@ -238,6 +235,22 @@ $.fn.tab = function(parameters) { }, set: { + auto: function() { + var + url = (typeof settings.path == 'string') + ? settings.path.replace(/\/$/, '') + '/{$tab}' + : '/{$tab}' + ; + module.verbose('Setting up automatic tab retrieval from server', url); + if($.isPlainObject(settings.apiSettings)) { + settings.apiSettings.url = url; + } + else { + settings.apiSettings = { + url: url + }; + } + }, state: function(state) { $.address.value(state); }