diff --git a/guacamole/src/main/webapp/app/client/directives/guacFileBrowser.js b/guacamole/src/main/webapp/app/client/directives/guacFileBrowser.js index ba03a9e98..1f86fb62d 100644 --- a/guacamole/src/main/webapp/app/client/directives/guacFileBrowser.js +++ b/guacamole/src/main/webapp/app/client/directives/guacFileBrowser.js @@ -47,11 +47,22 @@ angular.module('client').directive('guacFileBrowser', [function guacFileBrowser( }, templateUrl: 'app/client/templates/guacFileBrowser.html', - controller: ['$scope', '$injector', function guacFileBrowserController($scope, $injector) { + controller: ['$scope', '$element', '$injector', function guacFileBrowserController($scope, $element, $injector) { // Required types var ManagedFilesystem = $injector.get('ManagedFilesystem'); + // Required services + var $interpolate = $injector.get('$interpolate'); + + /** + * The jQuery-wrapped element representing the contents of the + * current directory within the file browser. + * + * @type Element[] + */ + var currentDirectoryContents = $element.find('.current-directory-contents'); + /** * Returns whether the given file is a normal file. * @@ -100,6 +111,65 @@ angular.module('client').directive('guacFileBrowser', [function guacFileBrowser( ManagedFilesystem.downloadFile($scope.client, $scope.filesystem, file.streamName); }; + /** + * Creates a new element representing the given file and properly + * handling user events, bypassing the overhead incurred through + * use of ngRepeat and related techniques. + * + * @param {ManagedFilesystem.File} file + * The file to generate an element for. + * + * @returns {Element[]} + * A jQuery-wrapped array containing a single DOM element + * representing the given file. + */ + var createFileElement = function createFileElement(file) { + + // Create from internal template + var element = angular.element($interpolate( + + '