Move tagsplugin to compiled handlebars

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2018-10-01 19:23:40 +02:00
parent cd7c17482e
commit 8dfc397a5e
No known key found for this signature in database
GPG Key ID: F941078878347C0C
3 changed files with 19 additions and 11 deletions

View File

@ -17,13 +17,6 @@
PROPERTY_FAVORITE: '{' + OC.Files.Client.NS_OWNCLOUD + '}favorite' PROPERTY_FAVORITE: '{' + OC.Files.Client.NS_OWNCLOUD + '}favorite'
}); });
var TEMPLATE_FAVORITE_MARK =
'<div ' +
'class="favorite-mark {{#isFavorite}}permanent{{/isFavorite}}">' +
'<span class="icon {{iconClass}}" />' +
'<span class="hidden-visually">{{altText}}</span>' +
'</div>';
/** /**
* Returns the icon class for the matching state * Returns the icon class for the matching state
* *
@ -41,10 +34,7 @@
* @return {Object} jQuery object * @return {Object} jQuery object
*/ */
function renderStar (state) { function renderStar (state) {
if (!this._template) { return OCA.Files.Templates['favorite_mark']({
this._template = Handlebars.compile(TEMPLATE_FAVORITE_MARK);
}
return this._template({
isFavorite: state, isFavorite: state,
altText: state ? t('files', 'Favorited') : t('files', 'Not favorited'), altText: state ? t('files', 'Favorited') : t('files', 'Not favorited'),
iconClass: getStarIconClass(state) iconClass: getStarIconClass(state)

View File

@ -23,6 +23,20 @@ templates['detailsview'] = template({"1":function(container,depth0,helpers,parti
+ container.escapeExpression(((helper = (helper = helpers.closeLabel || (depth0 != null ? depth0.closeLabel : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(alias1,{"name":"closeLabel","hash":{},"data":data}) : helper))) + container.escapeExpression(((helper = (helper = helpers.closeLabel || (depth0 != null ? depth0.closeLabel : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(alias1,{"name":"closeLabel","hash":{},"data":data}) : helper)))
+ "</span></a>\n"; + "</span></a>\n";
},"useData":true}); },"useData":true});
templates['favorite_mark'] = template({"1":function(container,depth0,helpers,partials,data) {
return "permanent";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
var stack1, helper, options, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression, buffer =
"<div class=\"favorite-mark ";
stack1 = ((helper = (helper = helpers.isFavorite || (depth0 != null ? depth0.isFavorite : depth0)) != null ? helper : alias2),(options={"name":"isFavorite","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data}),(typeof helper === alias3 ? helper.call(alias1,options) : helper));
if (!helpers.isFavorite) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}
if (stack1 != null) { buffer += stack1; }
return buffer + "\">\n <span class=\"icon "
+ alias4(((helper = (helper = helpers.iconClass || (depth0 != null ? depth0.iconClass : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"iconClass","hash":{},"data":data}) : helper)))
+ "\" />\n <span class=\"hidden-visually\">"
+ 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['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;

View File

@ -0,0 +1,4 @@
<div class="favorite-mark {{#isFavorite}}permanent{{/isFavorite}}">
<span class="icon {{iconClass}}" />
<span class="hidden-visually">{{altText}}</span>
</div>