Files
duplicati/Duplicati/Server/webroot/ngax/scripts/controllers/DialogController.js
T

33 lines
1.0 KiB
JavaScript
Raw Normal View History

2016-10-21 15:32:33 +02:00
backupApp.controller('DialogController', function($scope, DialogService, gettextCatalog) {
$scope.state = DialogService.watch($scope);
2016-10-21 15:32:33 +02:00
function showTooltip(elem, msg) {
elem.addEventListener('mouseleave', function(e) {
e.currentTarget.setAttribute('class', 'button');
e.currentTarget.removeAttribute('aria-label');
});
2016-10-29 14:34:07 +02:00
elem.setAttribute('class', 'button tooltipped tooltipped-w');
2016-10-21 15:32:33 +02:00
elem.setAttribute('aria-label', msg);
}
$scope.onCopySuccess = function(e) {
e.clearSelection();
showTooltip(e.trigger, gettextCatalog.getString('Copied!'));
};
$scope.onCopyError = function(e) {
showTooltip(e.trigger, gettextCatalog.getString('Copy failed. Please manually copy the URL'));
};
$scope.onButtonClick = function(index) {
2016-10-21 15:32:33 +02:00
var cur = $scope.state.CurrentItem;
var input = cur.textarea;
DialogService.dismissCurrent();
if (cur.callback)
2017-02-07 21:51:14 +01:00
cur.callback(index, input, cur);
};
});