diff --git a/customize.dist/application_config.js b/customize.dist/application_config.js
index 63cc96f18..cb5fdb91b 100644
--- a/customize.dist/application_config.js
+++ b/customize.dist/application_config.js
@@ -30,6 +30,7 @@ define(function() {
'#FF00C0', // hot pink
'#800080', // purple
];
+ config.enableTemplates = true;
return config;
});
diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js
index 2f5755ce3..e7dbc02dc 100644
--- a/www/common/cryptpad-common.js
+++ b/www/common/cryptpad-common.js
@@ -572,12 +572,15 @@ define([
});
};
var selectTemplate = common.selectTemplate = function (type, rt, Crypt) {
+ if (!AppConfig.enableTemplates) { return; }
+ var temps = listTemplates(type);
+ if (temps.length === 0) { return; }
var $content = $('
');
$('
').text(Messages.selectTemplate).appendTo($content);
$('', {id:"selectTemplate"}).appendTo($content);
Cryptpad.alert($content.html(), null, true);
var $p = $('#selectTemplate');
- listTemplates(type).forEach(function (t) {
+ temps.forEach(function (t, i) {
$('', {href: t.href, title: t.title}).text(t.title).click(function (e) {
e.preventDefault();
var parsed = parsePadUrl(t.href);
@@ -592,6 +595,7 @@ define([
});
});
}).appendTo($p);
+ if (i !== temps.length) { $('
').appendTo($p); }
});
common.findOKButton().text(Messages.cancelButton);
};
@@ -1101,6 +1105,7 @@ define([
}
break;
case 'template':
+ if (!AppConfig.enableTemplates) { return; }
button = $('