From 781c99295ca6b0ef70968f595a395cd26b71fbb2 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Tue, 7 May 2013 18:35:22 -0400 Subject: [PATCH] fix so templates load when custom_tpl is 'undefined' --- public/src/templates.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/public/src/templates.js b/public/src/templates.js index aa537ee080..22e61ea554 100644 --- a/public/src/templates.js +++ b/public/src/templates.js @@ -156,10 +156,17 @@ function load_template(callback, custom_tpl) { jQuery.get(API_URL + url, function(data) { - var tpl = url.split('/')[0]; - tpl = templates.get_custom_map(tpl); - if (custom_tpl) tpl = custom_tpl; + var splits = url.split('/'); + var tpl = url; + + if(splits.length) { + tpl = splits[0]; + tpl = templates.get_custom_map(tpl); + } + + if (custom_tpl && custom_tpl != "undefined") + tpl = custom_tpl; document.getElementById('content').innerHTML = templates[tpl].parse(JSON.parse(data)); if (callback) callback();