mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUAC-963: Allow files with blobs to be saved. Style savable transfers differently.
This commit is contained in:
@@ -154,6 +154,34 @@ angular.module('client').directive('guacFileTransfer', [function guacFileTransfe
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns whether the file associated with this file transfer can
|
||||
* be saved locally via a call to save().
|
||||
*
|
||||
* @returns {Boolean}
|
||||
* true if a call to save() will result in the file being
|
||||
* saved, false otherwise.
|
||||
*/
|
||||
$scope.isSavable = function isSavable() {
|
||||
return !!$scope.transfer.blob;
|
||||
};
|
||||
|
||||
/**
|
||||
* Saves the downloaded file, if any. If this transfer is an upload
|
||||
* or the download is not yet complete, this function has no
|
||||
* effect.
|
||||
*/
|
||||
$scope.save = function save() {
|
||||
|
||||
// Ignore if no blob exists
|
||||
if (!$scope.transfer.blob)
|
||||
return;
|
||||
|
||||
// Save file
|
||||
saveAs($scope.transfer.blob, $scope.transfer.filename);
|
||||
|
||||
};
|
||||
|
||||
}] // end file transfer controller
|
||||
|
||||
};
|
||||
|
@@ -95,3 +95,16 @@
|
||||
height: 100%;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
.savable.transfer {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.savable.transfer:hover .progress {
|
||||
border-color: black;
|
||||
}
|
||||
|
||||
.savable.transfer .filename {
|
||||
color: blue;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<div class="transfer" ng-class="{'in-progress': isInProgress()}">
|
||||
<div class="transfer" ng-class="{'in-progress': isInProgress(), 'savable': isSavable()}" ng-click="save()">
|
||||
<!--
|
||||
Copyright (C) 2014 Glyptodon LLC
|
||||
|
||||
|
Reference in New Issue
Block a user