Merge pull request #11410 from nextcloud/csp/11030/filesummary_compiled_handlebars
Compile filesummary handlebars
This commit is contained in:
commit
d72d267035
|
@ -0,0 +1,7 @@
|
|||
<span class="info">
|
||||
<span class="dirinfo"></span>
|
||||
<span class="connector">{{connectorLabel}}</span>
|
||||
<span class="fileinfo"></span>
|
||||
<span class="hiddeninfo"></span>
|
||||
<span class="filter"></span>
|
||||
</span>
|
|
@ -20,15 +20,6 @@
|
|||
*/
|
||||
|
||||
(function() {
|
||||
var INFO_TEMPLATE =
|
||||
'<span class="info">' +
|
||||
'<span class="dirinfo"></span>' +
|
||||
'<span class="connector">{{connectorLabel}}</span>' +
|
||||
'<span class="fileinfo"></span>' +
|
||||
'<span class="hiddeninfo"></span>' +
|
||||
'<span class="filter"></span>' +
|
||||
'</span>';
|
||||
|
||||
/**
|
||||
* The FileSummary class encapsulates the file summary values and
|
||||
* the logic to render it in the given container
|
||||
|
@ -200,10 +191,12 @@
|
|||
},
|
||||
|
||||
_infoTemplate: function(data) {
|
||||
if (!this._infoTemplateCompiled) {
|
||||
this._infoTemplateCompiled = Handlebars.compile(INFO_TEMPLATE);
|
||||
}
|
||||
return this._infoTemplateCompiled(_.extend({
|
||||
/* NOTE: To update the template make changes in filesummary.handlebars
|
||||
* and run:
|
||||
*
|
||||
* handlebars -n OCA.Files.FileSummary.Templates filesummary.handlebars -f filesummary_template.js
|
||||
*/
|
||||
return OCA.Files.FileSummary.Templates['filesummary'](_.extend({
|
||||
connectorLabel: t('files', '{dirs} and {files}', {dirs: '', files: ''})
|
||||
}, data));
|
||||
},
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
(function() {
|
||||
var template = Handlebars.template, templates = OCA.Files.FileSummary.Templates = OCA.Files.FileSummary.Templates || {};
|
||||
templates['filesummary'] = template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||
var helper;
|
||||
|
||||
return "<span class=\"info\">\n <span class=\"dirinfo\"></span>\n <span class=\"connector\">"
|
||||
+ container.escapeExpression(((helper = (helper = helpers.connectorLabel || (depth0 != null ? depth0.connectorLabel : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0,{"name":"connectorLabel","hash":{},"data":data}) : helper)))
|
||||
+ "</span>\n <span class=\"fileinfo\"></span>\n <span class=\"hiddeninfo\"></span>\n <span class=\"filter\"></span>\n</span>\n";
|
||||
},"useData":true});
|
||||
})();
|
|
@ -6,6 +6,7 @@
|
|||
"jquery-visibility.js",
|
||||
"fileinfomodel.js",
|
||||
"filesummary.js",
|
||||
"filesummary_template.js",
|
||||
"filemultiselectmenu.js",
|
||||
"breadcrumb.js",
|
||||
"filelist.js",
|
||||
|
|
|
@ -60,6 +60,7 @@ use OCA\Files_Sharing\Activity\Providers\Downloads;
|
|||
use OCP\Files\NotFoundException;
|
||||
use OCP\Files\IRootFolder;
|
||||
use OCP\Share\Exceptions\ShareNotFound;
|
||||
use OCP\Util;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\EventDispatcher\GenericEvent;
|
||||
use OCP\Share\IManager as ShareManager;
|
||||
|
@ -396,6 +397,7 @@ class ShareController extends AuthPublicShareController {
|
|||
// JS required for folders
|
||||
\OCP\Util::addStyle('files', 'merged');
|
||||
\OCP\Util::addScript('files', 'filesummary');
|
||||
\OCP\Util::addScript('files', 'filesummary_template');
|
||||
\OCP\Util::addScript('files', 'breadcrumb');
|
||||
\OCP\Util::addScript('files', 'fileinfomodel');
|
||||
\OCP\Util::addScript('files', 'newfilemenu');
|
||||
|
|
Loading…
Reference in New Issue