diff --git a/public/views/modals/tx-details.html b/public/views/modals/tx-details.html index 07dfb5a67..569ab44f2 100644 --- a/public/views/modals/tx-details.html +++ b/public/views/modals/tx-details.html @@ -128,19 +128,17 @@ -
-
Comment
- {{btx.note.body}}
- - Edited by {{btx.note.editedByName}}, - - -
-
Add Memo - Edit Memo + Memo +
+ {{btx.note.body}}
+ + Edited by {{btx.note.editedByName}}, + + +
Timeline
diff --git a/src/js/controllers/modals/txDetails.js b/src/js/controllers/modals/txDetails.js index 8a3c768b4..76dc93d5e 100644 --- a/src/js/controllers/modals/txDetails.js +++ b/src/js/controllers/modals/txDetails.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('txDetailsController', function($rootScope, $log, $scope, $filter, $stateParams, $ionicPopup, gettextCatalog, profileService, configService, lodash, txFormatService, platformInfo, externalLinkService) { +angular.module('copayApp.controllers').controller('txDetailsController', function($rootScope, $log, $timeout, $scope, $filter, $stateParams, $ionicPopup, gettextCatalog, profileService, configService, lodash, txFormatService, platformInfo, externalLinkService, popupService) { var self = $scope.self; var wallet = profileService.getWallet($stateParams.walletId); @@ -24,27 +24,12 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio } $scope.showCommentPopup = function() { - $scope.data = { - comment: $scope.btx.note ? $scope.btx.note.body : '', - }; + popupService.showPrompt(gettextCatalog.getString('Memo'), null, null, function(res) { + $log.debug('Saving memo'); - var commentPopup = $ionicPopup.show({ - templateUrl: "views/includes/note.html", - scope: $scope, - }); - - $scope.commentPopupClose = function() { - commentPopup.close(); - }; - - $scope.commentPopupSave = function() { - $log.debug('Saving note'); var args = { txid: $scope.btx.txid, - }; - - if ($scope.data.comment) { - args.body = $scope.data.comment; + body: res }; wallet.editTxNote(args, function(err) { @@ -56,14 +41,17 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio $scope.btx.note = null; if (args.body) { $scope.btx.note = {}; - $scope.btx.note.body = $scope.data.comment; + $scope.btx.note.body = res; $scope.btx.note.editedByName = wallet.credentials.copayerName; $scope.btx.note.editedOn = Math.floor(Date.now() / 1000); } $scope.btx.searcheableString = null; - commentPopup.close(); + + $timeout(function() { + $scope.$apply(); + }, 200); }); - }; + }); }; $scope.getAlternativeAmount = function() { diff --git a/src/js/services/popupService.js b/src/js/services/popupService.js index c8979ca1c..c22b32041 100644 --- a/src/js/services/popupService.js +++ b/src/js/services/popupService.js @@ -32,9 +32,9 @@ angular.module('copayApp.services').service('popupService', function($log, $ioni opts = opts || {}; $ionicPopup.prompt({ title: title, - subTitle: message, - inputType: opts.inputType, - inputPlaceholder: opts.inputPlaceholder, + subTitle: message || ' ', + inputType: opts.inputType || 'text', + inputPlaceholder: opts.inputPlaceholder || '', defaultText: opts.defaultText }).then(function(res) { return cb(res)