mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 06:55:46 +01:00
fixes to template parser: hide block if no data exists (prevents the default tpl skeleton from showing up)
This commit is contained in:
@@ -62,6 +62,10 @@ var templates = {};
|
||||
var template = this.html, regex, block;
|
||||
|
||||
return (function parse(data, namespace, template) {
|
||||
if (data.length == 0) {
|
||||
regex = makeRegex('[^]*');
|
||||
template = template.replace(regex, '');
|
||||
}
|
||||
|
||||
for (var d in data) {
|
||||
if (data.hasOwnProperty(d)) {
|
||||
|
||||
@@ -60,6 +60,10 @@ var fs = require('fs');
|
||||
var template = this.html, regex, block;
|
||||
|
||||
return (function parse(data, namespace, template) {
|
||||
if (data.length == 0) {
|
||||
regex = makeRegex('[^]*');
|
||||
template = template.replace(regex, '');
|
||||
}
|
||||
|
||||
for (var d in data) {
|
||||
if (data.hasOwnProperty(d)) {
|
||||
|
||||
Reference in New Issue
Block a user