2016-10-21 15:32:33 +02:00
|
|
|
backupApp.controller('DialogController', function($scope, DialogService, gettextCatalog) {
|
2016-09-15 11:39:27 +02:00
|
|
|
$scope.state = DialogService.watch($scope);
|
2015-12-08 20:38:16 +01:00
|
|
|
|
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'));
|
|
|
|
|
};
|
|
|
|
|
|
2016-09-15 11:39:27 +02:00
|
|
|
$scope.onButtonClick = function(index) {
|
2016-10-21 15:32:33 +02:00
|
|
|
var cur = $scope.state.CurrentItem;
|
|
|
|
|
var input = cur.textarea;
|
2016-09-15 11:39:27 +02:00
|
|
|
DialogService.dismissCurrent();
|
2015-12-08 20:38:16 +01:00
|
|
|
|
2016-09-15 11:39:27 +02:00
|
|
|
if (cur.callback)
|
2017-02-07 21:51:14 +01:00
|
|
|
cur.callback(index, input, cur);
|
2016-09-15 11:39:27 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
});
|