Show clipboard copy indication

This commit is contained in:
Johannes Zellner
2019-02-24 19:17:38 +01:00
parent f40eee4577
commit 20118f941e
2 changed files with 8 additions and 1 deletions
+1 -1
View File
@@ -245,7 +245,7 @@
</li>
</ul>
<input type="text" class="offscreen" aria-hidden="true" id="appRestoreSelectedBackupId" value="{{appRestore.selectedBackup.id}}">
<span>&nbsp;<i class="fa fa-copy" uib-tooltip="Click to copy backup id" id="appRestoreSelectedBackupIdCopy" ng-click="appRestore.copyBackupId()"></i></span>
<span>&nbsp;<i class="fa fa-copy hand" uib-tooltip="{{ appRestore.copyBackupIdDone ? 'Copied to clipboard' : 'Click to copy backup id' }}" tooltip-placement="right" ng-click="appRestore.copyBackupId()"></i></span>
</div>
<br/>
<fieldset>
+7
View File
@@ -253,10 +253,17 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
action: 'restore',
copyBackupIdDone: false,
copyBackupId: function () {
var copyText = document.getElementById('appRestoreSelectedBackupId');
copyText.select();
document.execCommand('copy');
$scope.appRestore.copyBackupIdDone = true;
// reset after 5sec
$timeout(function () { $scope.appRestore.copyBackupIdDone = false; }, 5000);
},
selectBackup: function (backup) {