refactory of the confirmation popup

This commit is contained in:
Gustavo Maximiliano Cortez 2015-01-06 17:10:28 -03:00
parent 024a80d725
commit 99de32fc5d
3 changed files with 39 additions and 30 deletions

View File

@ -256,23 +256,6 @@ angular.module('copayApp.directives')
}
};
})
// From https://gist.github.com/asafge/7430497
.directive('ngReallyClick', [
function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
element.bind('click', function() {
var message = attrs.ngReallyMessage;
if (message && confirm(message)) {
scope.$apply(attrs.ngReallyClick);
}
});
}
}
}
])
.directive('showFocus', function($timeout) {
return function(scope, element, attrs) {
scope.$watch(attrs.showFocus,

View File

@ -1,4 +1,5 @@
<div class="text-center" ng-init="isComplete = item.isComplete(); networkName = item.getNetworkName()">
<div class="text-center" ng-init="isComplete = item.isComplete(); networkName = item.getNetworkName()">
<div ng-show="!confirmDelete">
<h1>{{item.name || item.id }}</h1>
<h3>
{{item.requiredCopayers}} of {{item.totalCopayers}} - {{networkName}}
@ -29,16 +30,9 @@
ng-show="isSafari || isCordova"><i class="fi-eye"></i> View Backup</button>
</div>
<div class="large-6 medium-6 small-12 columns">
<button class="warning expand" ng-disabled="loading"
ng-really-message="{{'Are you sure you want to delete the wallet'}} {{(item.name || item.id)}}"
ng-really-click="deleteWallet()">
<span ng-show="!loading">
<button class="warning expand" ng-click="confirmDelete=!confirmDelete">
<i class="fi-trash"></i> Delete
</span>
<span ng-show="loading">
<i class="fi-bitcoin-circle icon-rotate spinner"></i> Deleting...
</span>
</button>
</button>
</div>
</div>
@ -54,4 +48,24 @@
</div>
</div>
<a class="close-reveal-modal" ng-click="close()"><i class="fi-x size-18"></i></a>
</div>
<div class="row" ng-show="confirmDelete">
<h1>Are you sure you want to delete the wallet
<strong>{{(item.name || item.id)}}</strong>
</h1>
<div class="large-6 medium-6 small-6 columns">
<button class="default" ng-disabled="loading"
ng-click="confirmDelete=!confirmDelete">Cancel</button>
</div>
<div class="large-6 medium-6 small-6 columns">
<button class="warning" ng-disabled="loading" ng-click="deleteWallet()">
<span ng-show="!loading">
<i class="fi-trash"></i> Delete
</span>
<span ng-show="loading">
<i class="fi-bitcoin-circle icon-rotate spinner"></i> Deleting...
</span>
</button>
</div>
</div>
</div>

View File

@ -128,9 +128,21 @@
<span translate>Delete Profile</span>
</h2>
<p translate class="text-gray">Permanently delete this profile and all its wallets. WARNING: this action cannot be reversed.</p>
<a translate class="button warning m0" ng-really-message="{{'Are you sure you want to delete this profile?' | translate}}"
ng-really-click="deleteProfile()">Delete Profile
</a>
<div ng-show="!confirmDelete">
<a translate class="button warning m0" ng-click="confirmDelete=!confirmDelete">Delete Profile
</a>
</div>
<div class="text-center" ng-show="confirmDelete">
<h2>Are you sure you want to delete this profile?</h2>
<div class="row">
<div class="large-6 medium-6 small-6 columns">
<a translate class="button default m0" ng-click="confirmDelete=!confirmDelete">Cancel</a>
</div>
<div class="large-6 medium-6 small-6 columns">
<a translate class="button warning m0" ng-click="deleteProfile()">Delete</a>
</div>
</div>
</div>
</div>
</div>
</div>