diff --git a/README.md b/README.md
index 36c8253255..ab02209c57 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,6 @@
#
[](https://david-dm.org/designcreateplay/nodebb)
+[](https://codeclimate.com/github/designcreateplay/NodeBB)
**NodeBB Forum Software** is powered by Node.js and built on a Redis database. It utilizes web sockets for instant interactions and real-time notifications. NodeBB is compatible down to IE8 and has many modern features out of the box such as social network integration and streaming discussions.
diff --git a/public/src/templates.js b/public/src/templates.js
index 243bc59d68..2ac8f0b7fb 100644
--- a/public/src/templates.js
+++ b/public/src/templates.js
@@ -3,6 +3,7 @@
var config = {},
templates,
fs = null,
+ path = null,
available_templates = [],
parsed_variables = {},
apiXHR;
@@ -12,7 +13,8 @@
};
try {
- fs = require('fs');
+ fs = require('fs'),
+ path = require('path');
} catch (e) {}
templates.force_refresh = function (tpl) {
@@ -127,6 +129,27 @@
loadTemplates(templates_to_load || [], custom_templates || false);
}
+ templates.render = function(filename, options, fn) {
+ if ('function' === typeof options) {
+ fn = options, options = false;
+ }
+
+ var tpl = filename
+ .replace(path.join(__dirname + '/../templates/'), '')
+ .replace('.' + options.settings['view engine'], '');
+
+ if (!templates[tpl]) {
+ fs.readFile(filename, function (err, html) {
+ templates[tpl] = html.toString();
+ templates.prepare(templates[tpl]);
+
+ return fn(err, templates[tpl].parse(options));
+ });
+ } else {
+ return fn(null, templates[tpl].parse(options));
+ }
+ }
+
templates.getTemplateNameFromUrl = function (url) {
var parts = url.split('?')[0].split('/');
@@ -419,6 +442,8 @@
})(data, "", template);
}
+ module.exports.__express = module.exports.render;
+
if ('undefined' !== typeof window) {
window.templates = module.exports;
templates.init();
diff --git a/public/templates/category.tpl b/public/templates/category.tpl
index 24afd18f2d..25bc8c0a31 100644
--- a/public/templates/category.tpl
+++ b/public/templates/category.tpl
@@ -1,9 +1,15 @@
+
+
+
+
+
+
{topic_name}
+{title}