Skip to content

Commit

Permalink
Merge pull request #819 from Nadav658/issue_734
Browse files Browse the repository at this point in the history
Prevent multiple modal's from opening at once
  • Loading branch information
achamely committed Aug 11, 2014
2 parents fbad91a + f568e64 commit fa55056
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 33 deletions.
37 changes: 22 additions & 15 deletions www/js/AssetTypesController.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,21 +207,28 @@ angular.module('omniwallet')
$scope.currencyName = currency.symbol == "BTC" ? "Bitcoin" : currency.symbol == "MSC" ? "Mastercoin" : currency.symbol == "TMSC" ? "Test Mastercoin" : currency.name;
}
});
var modalInstance = $modal.open({
resolve: {
currencySymbol: function() {
return currencySymbol;
},
balances: function() {
return getAssetBalances(currencySymbol);
},
currencyName: function() {
return $scope.currencyName;
}
},
templateUrl: '/partials/currency_detail_modal.html',
controller: CurrencyDetailModal
});
if (!$scope.modalOpened) {
$scope.modalOpened = true;
var modalInstance = $modal.open({
resolve: {
currencySymbol: function() {
return currencySymbol;
},
balances: function() {
return getAssetBalances(currencySymbol);
},
currencyName: function() {
return $scope.currencyName;
}
},
templateUrl: '/partials/currency_detail_modal.html',
controller: CurrencyDetailModal
});
modalInstance.result.then(function(){},
function(){
$scope.modalOpened = false;
});
}
};

function updateGraph() {
Expand Down
33 changes: 19 additions & 14 deletions www/js/WalletAddressesController.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,20 +154,25 @@ angular.module('omniwallet')
});

$scope.openDeleteConfirmForm = function(addritem) {
var modalInstance = $modal.open({
templateUrl: '/partials/delete_address_modal.html',
controller: DeleteBtcAddressModal,
resolve: {
address: function() {
return addritem;
}
}
});

modalInstance.result.then(function() {
$injector.get('userService').removeAddress(addritem.address);
$scope.refresh();
}, function() {});
if (!$scope.modalOpened) {
$scope.modalOpened = true;
var modalInstance = $modal.open({
templateUrl: '/partials/delete_address_modal.html',
controller: DeleteBtcAddressModal,
resolve: {
address: function() {
return addritem;
}
}
});
modalInstance.result.then(function() {
$injector.get('userService').removeAddress(addritem.address);
$scope.refresh();
},
function() {
modalOpened=false;
});
}
};

$scope.refresh = function() {
Expand Down
11 changes: 9 additions & 2 deletions www/js/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,17 @@ function NavigationController($scope, $http, $modal, userService) {
};

$scope.openUUIDmodal = function() {
$modal.open({
if (!$scope.modalOpened) {
$scope.modalOpened = true;
var modalInstance = $modal.open({
templateUrl: '/partials/wallet_uuid_modal.html',
controller: WalletController
});
});
modalInstance.result.then(function(){},
function(){
$scope.modalOpened = false;
});
}
};

$scope.openNewUUIDmodal = function() {
Expand Down
2 changes: 1 addition & 1 deletion www/partials/wallet_addresses.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
<div ng-include="templates['sidecar']"></div>
</div>

<div class="sidecar col-xs-10" ng-controller="WalletBalancesController" ng-init="refresh()" show-wallet-balances template="{{template}}"></div>
<div class="sidecar col-xs-10" ng-controller="WalletBalancesController" ng-init="refresh();modalOpened=false" show-wallet-balances template="{{template}}"></div>
</div>
2 changes: 1 addition & 1 deletion www/partials/wallet_overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<h3 ng-init="isLoading=true" ng-show="isLoading" class="text-center">Updating...<img src="/assets/img/34-1.gif"></h3>
<div ng-hide="isLoading"><br /><br /><br /></div>
<div ng-init="refresh()" show-asset-types template="{{template}}">
<div ng-init="refresh();modalOpened=false" show-asset-types template="{{template}}">


</div>
Expand Down
1 change: 1 addition & 0 deletions www/partials/wallet_send_modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ <h4 class="col-xs-12" style="color:red;"> Funds could not be sent:
</div>
</div>
</div>

0 comments on commit fa55056

Please sign in to comment.