fixed a bug in templates, introduced categories, added default setup script onload, moved home.tpl code over to category, created hierachies

This commit is contained in:
psychobunny
2013-05-06 22:05:42 +00:00
parent 178bc82a55
commit fa64e84dcc
8 changed files with 72 additions and 48 deletions

View File

@@ -49,7 +49,7 @@ var templates = {};
function init() {
loadTemplates([
'header', 'footer', 'register', 'home', 'topic','account',
'header', 'footer', 'register', 'home', 'topic','account', 'category',
'login', 'reset', 'reset_code', 'account',
'confirm',
'emails/reset', 'emails/reset_plaintext', 'emails/email_confirm', 'emails/email_confirm_plaintext'
@@ -90,9 +90,8 @@ var templates = {};
var template = this.html, regex, block;
return (function parse(data, namespace, template) {
if (data.length == 0) {
regex = makeRegex('[^]*');
template = template.replace(regex, '');
if (!data || data.length == 0) {
template = '';
}
for (var d in data) {
@@ -147,6 +146,7 @@ function load_template(callback) {
url = (url === '' || url === '/') ? 'home' : url;
jQuery.get(API_URL + url, function(data) {
console.log(data)
document.getElementById('content').innerHTML = templates[url.split('/')[0]].parse(JSON.parse(data));
if (callback) callback();
});