summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2018-10-16 12:16:31 +0200
committerGitHub <noreply@github.com>2018-10-16 12:16:31 +0200
commit2849f2415425feab04a691318f50577d16c8ec1a (patch)
tree1b615197607da3a82492ea25cd3d7d439ebc6190 /apps
parentad66b0f9ab010ee00d249d6f8512d30332e8a0af (diff)
parent6c532576eea0e8a163989d319a17a6419956bd03 (diff)
downloadnextcloud-server-2849f2415425feab04a691318f50577d16c8ec1a.tar.gz
nextcloud-server-2849f2415425feab04a691318f50577d16c8ec1a.zip
Merge pull request #11839 from nextcloud/csp/files_drop
Move files_drop to compiled handlebars
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/js/files_drop.js14
-rw-r--r--apps/files_sharing/js/templates.js28
-rw-r--r--apps/files_sharing/js/templates/files_drop.handlebars7
-rw-r--r--apps/files_sharing/lib/Controller/ShareController.php1
4 files changed, 38 insertions, 12 deletions
diff --git a/apps/files_sharing/js/files_drop.js b/apps/files_sharing/js/files_drop.js
index 8d1273f1872..d10a61e0dfc 100644
--- a/apps/files_sharing/js/files_drop.js
+++ b/apps/files_sharing/js/files_drop.js
@@ -9,14 +9,7 @@
*/
(function ($) {
- var TEMPLATE =
- '<li data-toggle="tooltip" title="{{name}}" data-name="{{name}}">' +
- '{{#if isUploading}}' +
- '<span class="icon-loading-small"></span> {{name}}' +
- '{{else}}' +
- '<img src="{{iconSrc}}"/> {{name}}' +
- '{{/if}}' +
- '</li>';
+
var Drop = {
/** @type {Function} **/
_template: undefined,
@@ -130,10 +123,7 @@
* @private
*/
template: function () {
- if (!this._template) {
- this._template = Handlebars.compile(TEMPLATE);
- }
- return this._template;
+ return OCA.Sharing.Templates['files_drop'];
}
};
diff --git a/apps/files_sharing/js/templates.js b/apps/files_sharing/js/templates.js
new file mode 100644
index 00000000000..ce7409b4652
--- /dev/null
+++ b/apps/files_sharing/js/templates.js
@@ -0,0 +1,28 @@
+(function() {
+ var template = Handlebars.template, templates = OCA.Sharing.Templates = OCA.Sharing.Templates || {};
+templates['files_drop'] = template({"1":function(container,depth0,helpers,partials,data) {
+ var helper;
+
+ return "\n <span class=\"icon-loading-small\"></span> "
+ + container.escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"name","hash":{},"data":data}) : helper)))
+ + "\n";
+},"3":function(container,depth0,helpers,partials,data) {
+ var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;
+
+ return " <img src=\""
+ + alias4(((helper = (helper = helpers.iconSrc || (depth0 != null ? depth0.iconSrc : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"iconSrc","hash":{},"data":data}) : helper)))
+ + "\"/> "
+ + 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";
+},"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 "<li data-toggle=\"tooltip\" title=\""
+ + 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)))
+ + "\" data-name=\""
+ + 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.isUploading : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.program(3, data, 0),"data":data})) != null ? stack1 : "")
+ + "</li>\n";
+},"useData":true});
+})(); \ No newline at end of file
diff --git a/apps/files_sharing/js/templates/files_drop.handlebars b/apps/files_sharing/js/templates/files_drop.handlebars
new file mode 100644
index 00000000000..4dea497f8de
--- /dev/null
+++ b/apps/files_sharing/js/templates/files_drop.handlebars
@@ -0,0 +1,7 @@
+<li data-toggle="tooltip" title="{{name}}" data-name="{{name}}">
+ '{{#if isUploading}}
+ <span class="icon-loading-small"></span> {{name}}
+ {{else}}
+ <img src="{{iconSrc}}"/> {{name}}
+ {{/if}}
+</li>
diff --git a/apps/files_sharing/lib/Controller/ShareController.php b/apps/files_sharing/lib/Controller/ShareController.php
index 2cc34dde8bb..8e9cc5a9636 100644
--- a/apps/files_sharing/lib/Controller/ShareController.php
+++ b/apps/files_sharing/lib/Controller/ShareController.php
@@ -387,6 +387,7 @@ class ShareController extends AuthPublicShareController {
\OCP\Util::addScript('files', 'file-upload');
\OCP\Util::addStyle('files_sharing', 'publicView');
\OCP\Util::addScript('files_sharing', 'public');
+ \OCP\Util::addScript('files_sharing', 'templates');
\OCP\Util::addScript('files_sharing', 'public_note');
\OCP\Util::addScript('files', 'fileactions');
\OCP\Util::addScript('files', 'fileactionsmenu');