replace comment

This commit is contained in:
Javier 2016-09-19 12:00:44 -03:00
commit b3bf13918d
3 changed files with 21 additions and 35 deletions

View file

@ -128,19 +128,17 @@
</span>
</div>
<div class="item" ng-show="btx.note && btx.note.body">
<div translate>Comment</div>
<span class="enable_text_select">{{btx.note.body}}</span><br>
<span class="text-italic item-note size-12">
<span translate>Edited by</span> <span>{{btx.note.editedByName}}</span>,
<time>{{btx.note.editedOn * 1000 | amTimeAgo}}</time></span>
</span>
</div>
<div class="item item-icon-right" ng-click="showCommentPopup()">
<span class="text-gray" translate ng-show="!btx.note">Add Memo</i></span>
<span class="text-gray" translate ng-show="btx.note">Edit Memo</span>
<span class="text-gray" translate ng-show="btx.note">Memo</span>
<i class="icon nav-item-arrow-right"></i>
<div ng-show="btx.note && btx.note.body">
<span class="enable_text_select">{{btx.note.body}}</span><br>
<span class="text-italic item-note size-12">
<span translate>Edited by</span> <span>{{btx.note.editedByName}}</span>,
<time>{{btx.note.editedOn * 1000 | amTimeAgo}}</time></span>
</span>
</div>
</div>
<div class="item item-divider" ng-show="btx.action == 'sent'" translate>Timeline</div>

View file

@ -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() {

View file

@ -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)