Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-10-01 21:04:13 +0300
committerRoeland Jago Douma <roeland@famdouma.nl>2018-10-04 10:53:44 +0300
commit6f940a9b02bca9e388640c45b928ebedb6eca153 (patch)
tree59ac79ed1c3233199b47b5787b13814e84cd9677 /apps
parent8dfc397a5ed839b9f2665c8cd19ded20b44a22f4 (diff)
Move fileactions to compiled handlebars
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps')
-rw-r--r--apps/files/js/fileactions.js17
-rw-r--r--apps/files/js/templates.js44
-rw-r--r--apps/files/js/templates/file_action_trigger.handlebars13
3 files changed, 58 insertions, 16 deletions
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index 4fcb290ca8b..5af558d77ba 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -10,17 +10,6 @@
(function() {
- var TEMPLATE_FILE_ACTION_TRIGGER =
- '<a class="action action-{{nameLowerCase}}" href="#" data-action="{{name}}">' +
- '{{#if icon}}' +
- '<img class="svg" alt="{{altText}}" src="{{icon}}" />' +
- '{{else}}' +
- '{{#if iconClass}}<span class="icon {{iconClass}}" />{{/if}}' +
- '{{#unless hasDisplayName}}<span class="hidden-visually">{{altText}}</span>{{/unless}}' +
- '{{/if}}' +
- '{{#if displayName}}<span> {{displayName}}</span>{{/if}}' +
- '</a>';
-
/**
* Construct a new FileActions instance
* @constructs FileActions
@@ -335,11 +324,7 @@
* @param {Object} params action params
*/
_makeActionLink: function(params) {
- if (!this._fileActionTriggerTemplate) {
- this._fileActionTriggerTemplate = Handlebars.compile(TEMPLATE_FILE_ACTION_TRIGGER);
- }
-
- return $(this._fileActionTriggerTemplate(params));
+ return $(OCA.Files.Templates['file_action_trigger'](params));
},
/**
diff --git a/apps/files/js/templates.js b/apps/files/js/templates.js
index 4cbd326bac7..ac36f0098ac 100644
--- a/apps/files/js/templates.js
+++ b/apps/files/js/templates.js
@@ -37,6 +37,50 @@ templates['favorite_mark'] = template({"1":function(container,depth0,helpers,par
+ alias4(((helper = (helper = helpers.altText || (depth0 != null ? depth0.altText : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"altText","hash":{},"data":data}) : helper)))
+ "</span>\n</div>\n";
},"useData":true});
+templates['file_action_trigger'] = 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 " <img class=\"svg\" alt=\""
+ + alias4(((helper = (helper = helpers.altText || (depth0 != null ? depth0.altText : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"altText","hash":{},"data":data}) : helper)))
+ + "\" src=\""
+ + alias4(((helper = (helper = helpers.icon || (depth0 != null ? depth0.icon : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"icon","hash":{},"data":data}) : helper)))
+ + "\" />\n";
+},"3":function(container,depth0,helpers,partials,data) {
+ var stack1, alias1=depth0 != null ? depth0 : (container.nullContext || {});
+
+ return ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.iconClass : depth0),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.hasDisplayName : depth0),{"name":"unless","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "");
+},"4":function(container,depth0,helpers,partials,data) {
+ var helper;
+
+ return " <span class=\"icon "
+ + container.escapeExpression(((helper = (helper = helpers.iconClass || (depth0 != null ? depth0.iconClass : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"iconClass","hash":{},"data":data}) : helper)))
+ + "\" />\n";
+},"6":function(container,depth0,helpers,partials,data) {
+ var helper;
+
+ return " <span class=\"hidden-visually\">"
+ + container.escapeExpression(((helper = (helper = helpers.altText || (depth0 != null ? depth0.altText : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"altText","hash":{},"data":data}) : helper)))
+ + "</span>\n";
+},"8":function(container,depth0,helpers,partials,data) {
+ var helper;
+
+ return "<span> "
+ + container.escapeExpression(((helper = (helper = helpers.displayName || (depth0 != null ? depth0.displayName : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"displayName","hash":{},"data":data}) : helper)))
+ + "</span>";
+},"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 "<a class=\"action action-"
+ + alias4(((helper = (helper = helpers.nameLowerCase || (depth0 != null ? depth0.nameLowerCase : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"nameLowerCase","hash":{},"data":data}) : helper)))
+ + "\" href=\"#\" data-action=\""
+ + 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"
+ + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.icon : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.program(3, data, 0),"data":data})) != null ? stack1 : "")
+ + " "
+ + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.displayName : depth0),{"name":"if","hash":{},"fn":container.program(8, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ + "\n</a>\n";
+},"useData":true});
templates['filemultiselectmenu'] = 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;
diff --git a/apps/files/js/templates/file_action_trigger.handlebars b/apps/files/js/templates/file_action_trigger.handlebars
new file mode 100644
index 00000000000..d7112ee2b2f
--- /dev/null
+++ b/apps/files/js/templates/file_action_trigger.handlebars
@@ -0,0 +1,13 @@
+<a class="action action-{{nameLowerCase}}" href="#" data-action="{{name}}">
+ {{#if icon}}
+ <img class="svg" alt="{{altText}}" src="{{icon}}" />
+ {{else}}
+ {{#if iconClass}}
+ <span class="icon {{iconClass}}" />
+ {{/if}}
+ {{#unless hasDisplayName}}
+ <span class="hidden-visually">{{altText}}</span>
+ {{/unless}}
+ {{/if}}
+ {{#if displayName}}<span> {{displayName}}</span>{{/if}}
+</a>