Refactor txStatus to ease overriding in addons.

Favour overriding instead of options introduced in #3065
This commit is contained in:
Kosta Korenkov 2015-09-03 12:04:24 +03:00
parent deba8f12af
commit 77df59e5e1
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) {
var root = {};
root.notify = function(txp, opts, cb) {
if (typeof opts == "function") { // we have no options
cb = opts;
}
root.notify = function(txp, cb) {
var fc = profileService.focusedClient;
var status = txp.status;
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) {
$scope.type = type;
$scope.cancel = function() {
@ -49,7 +50,7 @@ angular.module('copayApp.services').factory('txStatus', function($modal, lodash,
if (cb) $timeout(cb, 100);
};
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',
controller: ModalInstanceCtrl,
});