mirror of https://github.com/BTCPrivate/copay.git
Fix Addressbook
This commit is contained in:
parent
d87f27a8e0
commit
17a70c1d50
|
@ -534,7 +534,8 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
};
|
||||
|
||||
$scope.cancel = function(form) {
|
||||
$scope.error = $scope.success = null;
|
||||
$scope.error = $scope.success = $scope.newaddress = $scope.newlabel = null;
|
||||
clearForm(form);
|
||||
$scope.toggleForm();
|
||||
};
|
||||
|
||||
|
@ -542,11 +543,23 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
$scope.showForm = !$scope.showForm;
|
||||
};
|
||||
|
||||
var clearForm = function(form) {
|
||||
form.newaddress.$pristine = true;
|
||||
form.newaddress.$setViewValue('');
|
||||
form.newaddress.$render();
|
||||
|
||||
form.newlabel.$pristine = true;
|
||||
form.newlabel.$setViewValue('');
|
||||
form.newlabel.$render();
|
||||
form.$setPristine();
|
||||
};
|
||||
|
||||
// TODO change to modal
|
||||
$scope.submitAddressBook = function(form) {
|
||||
if (form.$invalid) {
|
||||
return;
|
||||
}
|
||||
$scope.loading = true;
|
||||
$timeout(function() {
|
||||
var errorMsg;
|
||||
var entry = {
|
||||
|
@ -563,11 +576,13 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
if (errorMsg) {
|
||||
$scope.error = errorMsg;
|
||||
} else {
|
||||
clearForm(form);
|
||||
$scope.toggleForm();
|
||||
notification.success('Entry created', 'New addressbook entry created')
|
||||
}
|
||||
$scope.loading = false;
|
||||
$rootScope.$digest();
|
||||
}, 1);
|
||||
}, 100);
|
||||
return;
|
||||
};
|
||||
|
||||
|
|
|
@ -42,9 +42,9 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="large-6 medium-6 columns large-centered medium-centered" >
|
||||
<form ng-show="showForm" class="m0" name="addressBookForm" ng-submit="submitAddressBook(addressBookForm)" novalidate>
|
||||
<form ng-show="showForm" class="m0" name="addressBookForm"
|
||||
ng-disabled="loading"
|
||||
ng-submit="submitAddressBook(addressBookForm)" novalidate>
|
||||
<div class="box-notification" ng-show="error">
|
||||
<div class="box-icon error">
|
||||
<i class="size-24 fi-x"></i>
|
||||
|
@ -75,14 +75,14 @@
|
|||
placeholder="{{'Label'|translate}}" ng-model="newlabel" required>
|
||||
</div>
|
||||
</label>
|
||||
<a translate class="button secondary default" ng-click="cancel(addressBookForm)">Cancel</a>
|
||||
<a translate class="button secondary default" ng-show="!loading" ng-click="cancel(addressBookForm)">Cancel</a>
|
||||
<button class="primary right"
|
||||
ng-disabled="addressBookForm.$invalid || loading"
|
||||
ng-click="submitAddressBook(addressBookForm)">{{'Add'|translate}}</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="large-12 columns" ng-show="!showForm">
|
||||
<a class="button primary expand" ng-click="toggleForm()"><i class="fi-plus"></i> Add entry</a>
|
||||
<a ng-show="!showForm" class="button primary expand" ng-disabled="loading" ng-click="toggleForm()">
|
||||
<i class="fi-plus"></i> Add entry
|
||||
</a>
|
||||
</div>
|
||||
<a class="close-reveal-modal show-for-large-up" ng-click="close()"><i class="fi-x size-18"></i></a>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue