diff --git a/guacamole/src/main/webapp/app/client/directives/guacFileBrowser.js b/guacamole/src/main/webapp/app/client/directives/guacFileBrowser.js index 55323f690..d612dfdfc 100644 --- a/guacamole/src/main/webapp/app/client/directives/guacFileBrowser.js +++ b/guacamole/src/main/webapp/app/client/directives/guacFileBrowser.js @@ -53,7 +53,8 @@ angular.module('client').directive('guacFileBrowser', [function guacFileBrowser( var ManagedFilesystem = $injector.get('ManagedFilesystem'); // Required services - var $interpolate = $injector.get('$interpolate'); + var $interpolate = $injector.get('$interpolate'); + var $templateRequest = $injector.get('$templateRequest'); /** * The jQuery-wrapped element representing the contents of the @@ -63,6 +64,16 @@ angular.module('client').directive('guacFileBrowser', [function guacFileBrowser( */ var currentDirectoryContents = $element.find('.current-directory-contents'); + /** + * Statically-cached template HTML used to render each file within + * a directory. Once available, this will be used through + * createFileElement() to generate the DOM elements which make up + * a directory listing. + * + * @type String + */ + var fileTemplate = null; + /** * Returns whether the given file is a normal file. * @@ -116,6 +127,9 @@ angular.module('client').directive('guacFileBrowser', [function guacFileBrowser( * handling user events, bypassing the overhead incurred through * use of ngRepeat and related techniques. * + * Note that this function depends on the availability of the + * statically-cached fileTemplate. + * * @param {ManagedFilesystem.File} file * The file to generate an element for. * @@ -126,16 +140,7 @@ angular.module('client').directive('guacFileBrowser', [function guacFileBrowser( var createFileElement = function createFileElement(file) { // Create from internal template - var element = angular.element($interpolate( - - '