From ae1250f422126808691a99de45ec1ae0574678da Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Thu, 27 Sep 2018 13:18:26 +0200 Subject: Compile filesummary handlebars Fixes #11030 For https://github.com/orgs/nextcloud/projects/18 This template is now compiled so this no longer has to happen in the browser. Another step towards a stricter CSP. Signed-off-by: Roeland Jago Douma --- apps/files/js/filesummary.js | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'apps/files/js/filesummary.js') diff --git a/apps/files/js/filesummary.js b/apps/files/js/filesummary.js index 7545654ec44..ed369ff0723 100644 --- a/apps/files/js/filesummary.js +++ b/apps/files/js/filesummary.js @@ -20,15 +20,6 @@ */ (function() { - var INFO_TEMPLATE = - '' + - '' + - '{{connectorLabel}}' + - '' + - '' + - '' + - ''; - /** * The FileSummary class encapsulates the file summary values and * the logic to render it in the given container @@ -200,10 +191,12 @@ }, _infoTemplate: function(data) { - if (!this._infoTemplateCompiled) { - this._infoTemplateCompiled = Handlebars.compile(INFO_TEMPLATE); - } - return this._infoTemplateCompiled(_.extend({ + /* NOTE: To update the template make changes in filesummary.handlebars + * and run: + * + * handlebars -n OCA.Files.FileSummary.Templates filesummary.handlebars -f filesummary_template.js + */ + return OCA.Files.FileSummary.Templates['filesummary'](_.extend({ connectorLabel: t('files', '{dirs} and {files}', {dirs: '', files: ''}) }, data)); }, -- cgit v1.2.3