From fca9987a6ad890d3b3e7854fae157f51fac54ed8 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Mon, 1 Oct 2018 20:07:09 +0200 Subject: [PATCH] Move mainfileinfodetailsview to commpiled handlebars Signed-off-by: Roeland Jago Douma --- apps/files/js/mainfileinfodetailview.js | 28 +---------- apps/files/js/templates.js | 47 +++++++++++++++++++ .../mainfileinfodetailsview.handlebars | 21 +++++++++ 3 files changed, 69 insertions(+), 27 deletions(-) create mode 100644 apps/files/js/templates/mainfileinfodetailsview.handlebars diff --git a/apps/files/js/mainfileinfodetailview.js b/apps/files/js/mainfileinfodetailview.js index 626ab86ded..82860780d3 100644 --- a/apps/files/js/mainfileinfodetailview.js +++ b/apps/files/js/mainfileinfodetailview.js @@ -9,29 +9,6 @@ */ (function() { - var TEMPLATE = - '
' + - '
' + - '
' + - '

{{name}}

' + - '' + - '
' + - '
' + - ' {{#if hasFavoriteAction}}' + - ' ' + - ' ' + - ' ' + - ' {{/if}}' + - ' {{#if hasSize}}{{size}}, {{/if}}{{date}}' + - '
' + - '
' + - ''; - /** * @class OCA.Files.MainFileInfoDetailView * @classdesc @@ -71,10 +48,7 @@ }, template: function(data) { - if (!this._template) { - this._template = Handlebars.compile(TEMPLATE); - } - return this._template(data); + return OCA.Files.Templates['mainfileinfodetailsview'](data); }, initialize: function(options) { diff --git a/apps/files/js/templates.js b/apps/files/js/templates.js index ac36f0098a..c5522d8407 100644 --- a/apps/files/js/templates.js +++ b/apps/files/js/templates.js @@ -117,6 +117,53 @@ templates['filesummary'] = template({"compiler":[7,">= 4.0.0"],"main":function(c + container.escapeExpression(((helper = (helper = helpers.connectorLabel || (depth0 != null ? depth0.connectorLabel : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"connectorLabel","hash":{},"data":data}) : helper))) + "\n \n \n \n\n"; },"useData":true}); +templates['mainfileinfodetailsview'] = template({"1":function(container,depth0,helpers,partials,data) { + var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; + + return " \n \n \n"; +},"3":function(container,depth0,helpers,partials,data) { + var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; + + return "" + + alias4(((helper = (helper = helpers.size || (depth0 != null ? depth0.size : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"size","hash":{},"data":data}) : helper))) + + ", "; +},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { + var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; + + return "
\n
\n
\n

" + + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper))) + + "

\n \n \n " + + alias4(((helper = (helper = helpers.permalinkTitle || (depth0 != null ? depth0.permalinkTitle : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"permalinkTitle","hash":{},"data":data}) : helper))) + + "\n \n
\n
\n" + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.hasFavoriteAction : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + " " + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.hasSize : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "" + + alias4(((helper = (helper = helpers.date || (depth0 != null ? depth0.date : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"date","hash":{},"data":data}) : helper))) + + "\n
\n
\n
\n \n
\n"; +},"useData":true}); templates['template_addbutton'] = template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; diff --git a/apps/files/js/templates/mainfileinfodetailsview.handlebars b/apps/files/js/templates/mainfileinfodetailsview.handlebars new file mode 100644 index 0000000000..02a4cdb641 --- /dev/null +++ b/apps/files/js/templates/mainfileinfodetailsview.handlebars @@ -0,0 +1,21 @@ +
+
+ +
+ {{#if hasFavoriteAction}} + + + + {{/if}} + {{#if hasSize}}{{size}}, {{/if}}{{date}} +
+
+