From 1161b838d78a7a77d68b17664759766e49c9bb46 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Mon, 1 Oct 2018 22:40:26 +0200 Subject: Move newfilemenu to compiled handlebars Signed-off-by: Roeland Jago Douma --- apps/files/js/newfilemenu.js | 28 ++--------------- apps/files/js/templates.js | 36 ++++++++++++++++++++++ apps/files/js/templates/newfilemenu.handlebars | 10 ++++++ .../templates/newfilemenu_filename_form.handlebars | 4 +++ 4 files changed, 52 insertions(+), 26 deletions(-) create mode 100644 apps/files/js/templates/newfilemenu.handlebars create mode 100644 apps/files/js/templates/newfilemenu_filename_form.handlebars diff --git a/apps/files/js/newfilemenu.js b/apps/files/js/newfilemenu.js index 0ad7312c985..109a2fed67e 100644 --- a/apps/files/js/newfilemenu.js +++ b/apps/files/js/newfilemenu.js @@ -12,24 +12,6 @@ (function() { - var TEMPLATE_MENU = - ''; - - var TEMPLATE_FILENAME_FORM = - '
' + - '' + - '' - '
'; - /** * Construct a new NewFileMenu instance * @constructs NewFileMenu @@ -78,10 +60,7 @@ }, template: function(data) { - if (!OCA.Files.NewFileMenu._TEMPLATE) { - OCA.Files.NewFileMenu._TEMPLATE = Handlebars.compile(TEMPLATE_MENU); - } - return OCA.Files.NewFileMenu._TEMPLATE(data); + return OCA.Files.Templates['newfilemenu'](data); }, /** @@ -111,9 +90,6 @@ _promptFileName: function($target) { var self = this; - if (!OCA.Files.NewFileMenu._TEMPLATE_FORM) { - OCA.Files.NewFileMenu._TEMPLATE_FORM = Handlebars.compile(TEMPLATE_FILENAME_FORM); - } if ($target.find('form').length) { $target.find('input[type=\'text\']').focus(); @@ -128,7 +104,7 @@ var newName = $target.attr('data-templatename'); var fileType = $target.attr('data-filetype'); - var $form = $(OCA.Files.NewFileMenu._TEMPLATE_FORM({ + var $form = $(OCA.Files.Templates['newfilemenu_filename_form']({ fileName: newName, cid: this.cid, fileType: fileType diff --git a/apps/files/js/templates.js b/apps/files/js/templates.js index c5522d8407a..1433b240700 100644 --- a/apps/files/js/templates.js +++ b/apps/files/js/templates.js @@ -164,6 +164,42 @@ templates['mainfileinfodetailsview'] = template({"1":function(container,depth0,h + 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))) + "\" readonly=\"readonly\"/>\n\n"; },"useData":true}); +templates['newfilemenu'] = 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 " + + alias4(((helper = (helper = helpers.displayName || (depth0 != null ? depth0.displayName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"displayName","hash":{},"data":data}) : helper))) + + "\n
  • \n"; +},"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"; +},"useData":true}); +templates['newfilemenu_filename_form'] = 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; + + return "
    \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/newfilemenu.handlebars b/apps/files/js/templates/newfilemenu.handlebars new file mode 100644 index 00000000000..0d9ad9682ca --- /dev/null +++ b/apps/files/js/templates/newfilemenu.handlebars @@ -0,0 +1,10 @@ + diff --git a/apps/files/js/templates/newfilemenu_filename_form.handlebars b/apps/files/js/templates/newfilemenu_filename_form.handlebars new file mode 100644 index 00000000000..cf18b28cad2 --- /dev/null +++ b/apps/files/js/templates/newfilemenu_filename_form.handlebars @@ -0,0 +1,4 @@ +
    + + ' +
    -- cgit v1.2.3