Merge pull request #2 from JDonadio/marti/txDetailStyling

Fix routes and params
This commit is contained in:
Marty Alcala 2016-10-22 17:37:55 -04:00 committed by GitHub
commit 84bfd07f3f
5 changed files with 37 additions and 27 deletions

View File

@ -66,7 +66,10 @@ angular.module('copayApp.controllers').controller('activityController',
$scope.wallet = wallet;
$scope.btx = lodash.cloneDeep(tx);
$state.go('tabs.wallet.tx-details', {tx: $scope.btx, wallet: $scope.wallet});
$state.transitionTo('tabs.wallet.tx-details', {
txid: $scope.btx.txid,
walletId: $scope.walletId
});
walletService.getTxNote(wallet, n.txid, function(err, note) {
if (err) $log.warn('Could not fetch transaction note: ' + err);

View File

@ -1,34 +1,39 @@
'use strict';
angular.module('copayApp.controllers').controller('txDetailsController', function($log, $timeout, $scope, $filter, $stateParams, ongoingProcess, walletService, lodash, gettextCatalog, profileService, configService, txFormatService, externalLinkService, popupService) {
angular.module('copayApp.controllers').controller('txDetailsController', function($log, $timeout, $ionicHistory, $scope, $filter, $stateParams, ongoingProcess, walletService, lodash, gettextCatalog, profileService, configService, txFormatService, externalLinkService, popupService) {
var config = configService.getSync();
var configWallet = config.wallet;
var walletSettings = configWallet.settings;
var wallet;
var wallet = profileService.getWallet($stateParams.walletId);
$scope.wallet = wallet;
$scope.title = gettextCatalog.getString('Transaction');
$scope.btx = $stateParams.tx;
$scope.wallet = $stateParams.wallet;
$scope.init = function() {
wallet = $scope.wallet;
$scope.alternativeIsoCode = walletSettings.alternativeIsoCode;
$scope.color = wallet.color;
$scope.copayerId = wallet.credentials.copayerId;
$scope.isShared = wallet.credentials.n > 1;
$scope.btx.feeLevel = walletSettings.feeLevel;
walletService.getTx(wallet, $stateParams.txid, function(err, tx) {
if (err) {
$log.warn('Could not get tx');
$ionicHistory.goBack();
return;
}
$scope.btx = tx;
$scope.btx.feeLevel = walletSettings.feeLevel;
if ($scope.btx.action != 'invalid') {
if ($scope.btx.action == 'sent') $scope.title = gettextCatalog.getString('Sent Funds');
if ($scope.btx.action == 'received') $scope.title = gettextCatalog.getString('Received Funds');
if ($scope.btx.action == 'moved') $scope.title = gettextCatalog.getString('Moved Funds');
}
if ($scope.btx.action != 'invalid') {
if ($scope.btx.action == 'sent') $scope.title = gettextCatalog.getString('Sent Funds');
if ($scope.btx.action == 'received') $scope.title = gettextCatalog.getString('Received Funds');
if ($scope.btx.action == 'moved') $scope.title = gettextCatalog.getString('Moved Funds');
}
$scope.displayAmount = getDisplayAmount($scope.btx.amountStr);
$scope.displayUnit = getDisplayUnit($scope.btx.amountStr);
$scope.displayAmount = getDisplayAmount($scope.btx.amountStr);
$scope.displayUnit = getDisplayUnit($scope.btx.amountStr);
updateMemo();
initActionList();
updateMemo();
initActionList();
});
};
function getDisplayAmount(amountStr) {
@ -99,7 +104,7 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
$scope.showCommentPopup = function() {
var opts = {};
if($scope.btx.message) {
if ($scope.btx.message) {
opts.defaultText = $scope.btx.message;
}
if ($scope.btx.note && $scope.btx.note.body) opts.defaultText = $scope.btx.note.body;

View File

@ -68,7 +68,10 @@ angular.module('copayApp.controllers').controller('tabHomeController',
$scope.wallet = wallet;
$scope.btx = lodash.cloneDeep(tx);
$state.go('tabs.wallet.tx-details', {tx: $scope.btx, wallet: $scope.wallet});
$state.transitionTo('tabs.wallet.tx-details', {
txid: $scope.btx.txid,
walletId: $scope.walletId
});
walletService.getTxNote(wallet, n.txid, function(err, note) {
if (err) $log.warn('Could not fetch transaction note: ' + err);

View File

@ -92,7 +92,10 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
$scope.openTxModal = function(btx) {
$scope.btx = lodash.cloneDeep(btx);
$scope.walletId = $scope.wallet.id;
$state.go('tabs.wallet.tx-details', {tx: $scope.btx, wallet: $scope.wallet});
$state.transitionTo('tabs.wallet.tx-details', {
txid: $scope.btx.txid,
walletId: $scope.walletId
});
};
$scope.recreate = function() {

View File

@ -178,16 +178,12 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}
})
.state('tabs.wallet.tx-details', {
url: '/:id',
url: '/tx-details/:txid',
views: {
'tab-home@tabs': {
controller: 'txDetailsController',
templateUrl: 'views/modals/tx-details.html'
}
},
params: {
tx: null,
wallet: null
}
})
@ -859,7 +855,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
*
*/
.state('tabs.bitpayCardIntro', {
.state('tabs.bitpayCardIntro', {
url: '/bitpay-card-intro/:secret/:email/:otp',
views: {
'tab-home@tabs': {