Merge pull request #3131 from troggy/addon/txStatusTemplate

Refactor txStatus to ease overriding in addons.
This commit is contained in:
Matias Alejo Garcia 2015-09-03 10:10:49 -03:00
commit 6b95bf89a8
1 changed files with 8 additions and 7 deletions

View File

@ -3,10 +3,7 @@
angular.module('copayApp.services').factory('txStatus', function($modal, lodash, profileService, $timeout) { angular.module('copayApp.services').factory('txStatus', function($modal, lodash, profileService, $timeout) {
var root = {}; var root = {};
root.notify = function(txp, opts, cb) { root.notify = function(txp, cb) {
if (typeof opts == "function") { // we have no options
cb = opts;
}
var fc = profileService.focusedClient; var fc = profileService.focusedClient;
var status = txp.status; var status = txp.status;
var type; var type;
@ -37,10 +34,14 @@ angular.module('copayApp.services').factory('txStatus', function($modal, lodash,
} }
} }
openModal(type, opts, cb); openModal(type, txp, cb);
}; };
var openModal = function(type, opts, cb) { root._templateUrl = function(type, txp) {
return 'views/modals/tx-status.html';
};
var openModal = function(type, txp, cb) {
var ModalInstanceCtrl = function($scope, $modalInstance) { var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.type = type; $scope.type = type;
$scope.cancel = function() { $scope.cancel = function() {
@ -49,7 +50,7 @@ angular.module('copayApp.services').factory('txStatus', function($modal, lodash,
if (cb) $timeout(cb, 100); if (cb) $timeout(cb, 100);
}; };
var modalInstance = $modal.open({ var modalInstance = $modal.open({
templateUrl: opts && opts.templateUrl ? opts.templateUrl : 'views/modals/tx-status.html', templateUrl: root._templateUrl(type, txp),
windowClass: 'full popup-tx-status closeModalAnimation', windowClass: 'full popup-tx-status closeModalAnimation',
controller: ModalInstanceCtrl, controller: ModalInstanceCtrl,
}); });