Skip to content

Node.js based forum software built for the modern web

resolved some todo that's been in there for many months

psychobunny69e0aa338d06
diff --git a/app.js b/app.js
index e1201f1bd1..c27163ffa4 100644
--- a/app.js
+++ b/app.js
@@ -27,8 +27,9 @@
async = require('async'),
semver = require('semver'),
winston = require('winston'),
- pkg = require('./package.json'),
path = require('path'),
+ pkg = require('./package.json'),
+ utils = require('./public/src/utils.js'),
meta;
// Runtime environment
@@ -108,16 +109,11 @@
var customTemplates = meta.config['theme:templates'] ? path.join(__dirname, 'node_modules', meta.config['theme:id'], meta.config['theme:templates']) : false;
- // todo: replace below with read directory code, derp.
- templates.init([
- 'header', 'footer', 'logout', 'outgoing', 'admin/header', 'admin/footer', 'admin/index',
- 'emails/reset', 'emails/reset_plaintext', 'emails/email_confirm', 'emails/email_confirm_plaintext',
- 'emails/header', 'emails/footer',
-
- 'noscript/header', 'noscript/home', 'noscript/category', 'noscript/topic'
- ], customTemplates);
-
-
+
+ utils.walk(path.join(__dirname, 'public/templates'), function (err, tplsToLoad) {
+ templates.init(tplsToLoad, customTemplates);
+ });
+
plugins.ready(function() {
templates.ready(webserver.init);
});
diff --git a/public/src/templates.js b/public/src/templates.js
index 87c86b3052..0c90900d9c 100644
--- a/public/src/templates.js
+++ b/public/src/templates.js
@@ -78,7 +78,9 @@
global.templates[file] = new template;
loaded--;
- if (loaded == 0) templates.ready();
+ if (loaded === 0) {
+ templates.ready();
+ }
});
}(templatesToLoad[t]));
}