Skip to content
Snippets Groups Projects
Unverified Commit 6f940a9b authored by Roeland Jago Douma's avatar Roeland Jago Douma
Browse files

Move fileactions to compiled handlebars

parent 8dfc397a
No related branches found
No related tags found
No related merge requests found
...@@ -10,17 +10,6 @@ ...@@ -10,17 +10,6 @@
(function() { (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 * Construct a new FileActions instance
* @constructs FileActions * @constructs FileActions
...@@ -335,11 +324,7 @@ ...@@ -335,11 +324,7 @@
* @param {Object} params action params * @param {Object} params action params
*/ */
_makeActionLink: function(params) { _makeActionLink: function(params) {
if (!this._fileActionTriggerTemplate) { return $(OCA.Files.Templates['file_action_trigger'](params));
this._fileActionTriggerTemplate = Handlebars.compile(TEMPLATE_FILE_ACTION_TRIGGER);
}
return $(this._fileActionTriggerTemplate(params));
}, },
/** /**
......
...@@ -37,6 +37,50 @@ templates['favorite_mark'] = template({"1":function(container,depth0,helpers,par ...@@ -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))) + 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"; + "</span>\n</div>\n";
},"useData":true}); },"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) { 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; var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;
......
<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>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment