Refactor txStatus to ease overriding in addons.
Favour overriding instead of options introduced in #3065
This commit is contained in:
parent
deba8f12af
commit
77df59e5e1
1 changed files with 8 additions and 7 deletions
|
|
@ -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,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue