From e7443ee892f2ef49fed327cef6770ce11cd1fc0b Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Mon, 15 Oct 2018 19:52:22 +0200 Subject: [PATCH] Move more comments to compiled handlebars Signed-off-by: Roeland Jago Douma --- apps/comments/js/commentsmodifymenu.js | 20 ++--------- apps/comments/js/filesplugin.js | 10 +----- apps/comments/js/templates.js | 36 +++++++++++++++++++ .../templates/commentsmodifymenu.handlebars | 14 ++++++++ .../js/templates/filesplugin.handlebars | 3 ++ 5 files changed, 56 insertions(+), 27 deletions(-) create mode 100644 apps/comments/js/templates/commentsmodifymenu.handlebars create mode 100644 apps/comments/js/templates/filesplugin.handlebars diff --git a/apps/comments/js/commentsmodifymenu.js b/apps/comments/js/commentsmodifymenu.js index 4b17cbbfbf0..fd1e3d80bd0 100644 --- a/apps/comments/js/commentsmodifymenu.js +++ b/apps/comments/js/commentsmodifymenu.js @@ -10,20 +10,6 @@ /* global Handlebars */ (function() { - var TEMPLATE_MENU = - ''; /** * Construct a new CommentsModifyMenuinstance @@ -52,8 +38,6 @@ 'click a.action': '_onClickAction' }, - template: Handlebars.compile(TEMPLATE_MENU), - /** * Event handler whenever an action has been clicked within the menu * @@ -74,7 +58,7 @@ * Renders the menu with the currently set items */ render: function() { - this.$el.html(this.template({ + this.$el.html(OCA.Comments.Templates['commentsmodifymenu']({ items: this._scopes })); }, @@ -121,4 +105,4 @@ OCA.Comments = OCA.Comments || {}; OCA.Comments.CommentsModifyMenu = CommentsModifyMenu; -})(OC, OCA); \ No newline at end of file +})(OC, OCA); diff --git a/apps/comments/js/filesplugin.js b/apps/comments/js/filesplugin.js index 8c5762065a1..939edc8c695 100644 --- a/apps/comments/js/filesplugin.js +++ b/apps/comments/js/filesplugin.js @@ -16,11 +16,6 @@ PROPERTY_COMMENTS_UNREAD: '{' + OC.Files.Client.NS_OWNCLOUD + '}comments-unread' }); - var TEMPLATE_COMMENTS_UNREAD = - '' + - '' + - ''; - OCA.Comments = _.extend({}, OCA.Comments); if (!OCA.Comments) { /** @@ -39,10 +34,7 @@ ], _formatCommentCount: function(count) { - if (!this._commentsUnreadTemplate) { - this._commentsUnreadTemplate = Handlebars.compile(TEMPLATE_COMMENTS_UNREAD); - } - return this._commentsUnreadTemplate({ + return OCA.Comments.Templates['filesplugin']({ count: count, countMessage: n('comments', '%n unread comment', '%n unread comments', count), iconUrl: OC.imagePath('core', 'actions/comment') diff --git a/apps/comments/js/templates.js b/apps/comments/js/templates.js index a5706baa27e..26ca658c772 100644 --- a/apps/comments/js/templates.js +++ b/apps/comments/js/templates.js @@ -46,6 +46,33 @@ templates['comment'] = template({"1":function(container,depth0,helpers,partials, + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isLong : depth0),{"name":"if","hash":{},"fn":container.program(11, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n"; },"useData":true}); +templates['commentsmodifymenu'] = template({"1":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" + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.iconClass : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.program(4, data, 0),"data":data})) != null ? stack1 : "") + + " " + + 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
  • \n"; +},"2":function(container,depth0,helpers,partials,data) { + var helper; + + return " \n"; +},"4":function(container,depth0,helpers,partials,data) { + return " \n"; +},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { + var stack1; + + return "\n"; +},"useData":true}); templates['edit_comment'] = template({"1":function(container,depth0,helpers,partials,data) { var helper; @@ -75,6 +102,15 @@ templates['edit_comment'] = template({"1":function(container,depth0,helpers,part + alias4(((helper = (helper = helpers.tag || (depth0 != null ? depth0.tag : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"tag","hash":{},"data":data}) : helper))) + ">\n"; },"useData":true}); +templates['filesplugin'] = 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"; +},"useData":true}); templates['view'] = 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/comments/js/templates/commentsmodifymenu.handlebars b/apps/comments/js/templates/commentsmodifymenu.handlebars new file mode 100644 index 00000000000..28f6ffcdde6 --- /dev/null +++ b/apps/comments/js/templates/commentsmodifymenu.handlebars @@ -0,0 +1,14 @@ + diff --git a/apps/comments/js/templates/filesplugin.handlebars b/apps/comments/js/templates/filesplugin.handlebars new file mode 100644 index 00000000000..8f3699380be --- /dev/null +++ b/apps/comments/js/templates/filesplugin.handlebars @@ -0,0 +1,3 @@ + + +