mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-12 00:45:47 +01:00
temporary templateMapping fix for admin side; will come back to this after merging this branch
This commit is contained in:
@@ -127,23 +127,33 @@ var ajaxify = {};
|
|||||||
$('#footer, #content').removeClass('hide').addClass('ajaxifying');
|
$('#footer, #content').removeClass('hide').addClass('ajaxifying');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* this is complete hax and needs to be looked at. (fixing this is out of scope for what I'm currently refactoring)
|
||||||
|
* -- psychobunny
|
||||||
|
*/
|
||||||
ajaxify.getTemplateMapping = function(url) {
|
ajaxify.getTemplateMapping = function(url) {
|
||||||
var tpl_url = templates.get_custom_map(url.split('?')[0]);
|
var tpl_url = templates.get_custom_map(url.split('?')[0]);
|
||||||
|
|
||||||
if (tpl_url == false && !templates[url]) {
|
if (tpl_url == false && !templates[url]) {
|
||||||
// todo: regex
|
|
||||||
if (url === '' || url === '/') {
|
if (url === '' || url === '/') {
|
||||||
tpl_url = 'home';
|
tpl_url = 'home';
|
||||||
} else if (url === 'admin' || url === 'admin/') {
|
} else if (url === 'admin' || url === 'admin/') {
|
||||||
tpl_url = 'admin/index';
|
tpl_url = 'admin/index';
|
||||||
} else {
|
} else {
|
||||||
tpl_url = url.split('/')[0].split('?')[0];
|
tpl_url = url.split('/');
|
||||||
|
|
||||||
|
if (tpl_url[0] === 'admin') {
|
||||||
|
tpl_url = tpl_url[0] + '/' + tpl_url[1];
|
||||||
|
} else {
|
||||||
|
tpl_url = tpl_url[0].split('?')[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (templates[url]) {
|
} else if (templates[url]) {
|
||||||
tpl_url = url;
|
tpl_url = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(tpl_url);
|
||||||
return tpl_url;
|
return tpl_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,11 +69,17 @@
|
|||||||
templates.getTemplateNameFromUrl = function(url) {
|
templates.getTemplateNameFromUrl = function(url) {
|
||||||
var parts = url.split('?')[0].split('/');
|
var parts = url.split('?')[0].split('/');
|
||||||
|
|
||||||
for (var i = 0; i < parts.length; ++i) {
|
if (parts[0] === 'admin') {
|
||||||
if (templates.is_available(parts[i])) {
|
return parts = parts[0] + '/' + parts[1];
|
||||||
return parts[i];
|
} else {
|
||||||
|
for (var i = 0; i < parts.length; ++i) {
|
||||||
|
if (templates.is_available(parts[i])) {
|
||||||
|
return parts[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -112,6 +118,8 @@
|
|||||||
tpl_url = templates.getTemplateNameFromUrl(api_url);
|
tpl_url = templates.getTemplateNameFromUrl(api_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(tpl_url);
|
||||||
|
|
||||||
var template_data = null;
|
var template_data = null;
|
||||||
|
|
||||||
if (!templates[tpl_url]) {
|
if (!templates[tpl_url]) {
|
||||||
|
|||||||
Reference in New Issue
Block a user