Notify when click on clickable element

This commit is contained in:
Gabriel Bazán 2016-08-05 16:55:08 -03:00
commit 20c8a2c7ad
10 changed files with 53 additions and 17 deletions

View file

@ -43,6 +43,15 @@
font-size: 16px;
}
.popover, .popover .bar-header {
border-radius: 10px;
}
.popover {
height: auto;
width: 200px;
}
.popup-container.active .popup {
border-radius: 10px;
}

View file

@ -85,9 +85,9 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
return n.substring(0, 4);
};
$scope.copyToClipboard = function(addr) {
$scope.copyToClipboard = function(addr, $event) {
if (!addr) return;
self.copyToClipboard(addr);
self.copyToClipboard(addr, $event);
};
$scope.cancel = function() {

View file

@ -218,9 +218,9 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
});
};
$scope.copyToClipboard = function(addr) {
$scope.copyToClipboard = function(addr, $event) {
if (!addr) return;
self.copyToClipboard(addr);
self.copyToClipboard(addr, $event);
};
$scope.close = function(txp) {

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, notification, txStatus, profileService, lodash, configService, rateService, storageService, bitcore, gettext, gettextCatalog, platformInfo, addressService, ledger, bwcError, confirmDialog, txFormatService, addressbookService, go, feeService, walletService, fingerprintService, nodeWebkit, ongoingProcess) {
angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopup, $ionicPopover, notification, txStatus, profileService, lodash, configService, rateService, storageService, bitcore, gettext, gettextCatalog, platformInfo, addressService, ledger, bwcError, confirmDialog, txFormatService, addressbookService, go, feeService, walletService, fingerprintService, nodeWebkit, ongoingProcess) {
var isCordova = platformInfo.isCordova;
var isWP = platformInfo.isWP;
@ -200,12 +200,32 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
});
};
this.copyToClipboard = function(addr) {
this.copyToClipboard = function(addr, $event) {
var showPopover = function() {
$ionicPopover.fromTemplateUrl('views/includes/copyToClipboard.html', {
scope: $scope
}).then(function(popover) {
$scope.popover = popover;
$scope.popover.show($event);
});
$timeout(function() {
$scope.popover.hide(); //close the popover after 3 seconds for some reason
}, 2000);
$scope.$on('$destroy', function() {
$scope.popover.remove();
});
};
if (isCordova) {
window.cordova.plugins.clipboard.copy(addr);
window.plugins.toast.showShortCenter(gettextCatalog.getString('Copied to clipboard'));
} else if (platformInfo.isNW) {
nodeWebkit.writeToClipboard(addr);
showPopover($event);
}
};