Rename flashMessage variable

This commit is contained in:
Yemel Jardi 2014-05-20 08:30:20 -07:00
parent 715a5b2bba
commit ee6821d109
9 changed files with 23 additions and 23 deletions

View File

@ -67,10 +67,10 @@
</div> </div>
<div class="row" ng-if='$root.flashMessage.message' notification> <div class="row" ng-if='$root.$flashMessage.message' notification>
<div class="small-8 large-centered columns"> <div class="small-8 large-centered columns">
<div data-alert class="alert-box radius {{$root.flashMessage.type}}"> <div data-alert class="alert-box radius {{$root.$flashMessage.type}}">
{{$root.flashMessage.message}} {{$root.$flashMessage.message}}
<a ng-click="clearFlashMessage()" class="close">&times;</a> <a ng-click="clearFlashMessage()" class="close">&times;</a>
</div> </div>
</div> </div>

View File

@ -50,7 +50,7 @@ angular.module('copay.header').controller('HeaderController',
}; };
$scope.clearFlashMessage = function() { $scope.clearFlashMessage = function() {
$rootScope.flashMessage = {}; $rootScope.$flashMessage = {};
}; };
$rootScope.isCollapsed = true; $rootScope.isCollapsed = true;

View File

@ -23,7 +23,7 @@ angular.module('copay.import').controller('ImportController',
$scope.import = function(form) { $scope.import = function(form) {
if (form.$invalid) { if (form.$invalid) {
$rootScope.flashMessage = { message: 'There is an error in the form. Please, try again', type: 'error'}; $rootScope.$flashMessage = { message: 'There is an error in the form. Please, try again', type: 'error'};
return; return;
} }
@ -32,7 +32,7 @@ angular.module('copay.import').controller('ImportController',
var password = form.password.$modelValue; var password = form.password.$modelValue;
if (!backupFile && !backupText) { if (!backupFile && !backupText) {
$rootScope.flashMessage = { message: 'Please, select your backup file or paste the text', type: 'error'}; $rootScope.$flashMessage = { message: 'Please, select your backup file or paste the text', type: 'error'};
return; return;
} }

View File

@ -42,7 +42,7 @@ angular.module('copay.send').controller('SendController',
$scope.submitForm = function(form) { $scope.submitForm = function(form) {
if (form.$invalid) { if (form.$invalid) {
$rootScope.flashMessage = { message: 'You can not send a proposal transaction. Please, try again', type: 'error'}; $rootScope.$flashMessage = { message: 'You can not send a proposal transaction. Please, try again', type: 'error'};
return; return;
} }
@ -55,7 +55,7 @@ angular.module('copay.send').controller('SendController',
w.createTx( address, amount,function() { w.createTx( address, amount,function() {
$scope.loading = false; $scope.loading = false;
$rootScope.flashMessage = { message: 'The transaction proposal has been created', type: 'success'}; $rootScope.$flashMessage = { message: 'The transaction proposal has been created', type: 'success'};
$rootScope.$digest(); $rootScope.$digest();
}); });

View File

@ -35,7 +35,7 @@ angular.module('copay.setup').controller('SetupController',
$scope.create = function(form) { $scope.create = function(form) {
if (form && form.$invalid) { if (form && form.$invalid) {
$rootScope.flashMessage = { message: 'Please, enter required fields', type: 'error'}; $rootScope.$flashMessage = { message: 'Please, enter required fields', type: 'error'};
return; return;
} }
$scope.loading = true; $scope.loading = true;

View File

@ -14,7 +14,7 @@ angular.module('copay.signin').controller('SigninController',
$scope.create = function(form) { $scope.create = function(form) {
if (form && form.$invalid) { if (form && form.$invalid) {
$rootScope.flashMessage = { message: 'Please, enter required fields', type: 'error'}; $rootScope.$flashMessage = { message: 'Please, enter required fields', type: 'error'};
return; return;
} }
@ -27,7 +27,7 @@ angular.module('copay.signin').controller('SigninController',
$scope.open = function(form) { $scope.open = function(form) {
if (form && form.$invalid) { if (form && form.$invalid) {
$rootScope.flashMessage = { message: 'Please, enter required fields', type: 'error'}; $rootScope.$flashMessage = { message: 'Please, enter required fields', type: 'error'};
return; return;
} }
@ -40,7 +40,7 @@ angular.module('copay.signin').controller('SigninController',
var w = walletFactory.open($scope.selectedWalletId, { passphrase: passphrase}); var w = walletFactory.open($scope.selectedWalletId, { passphrase: passphrase});
if (!w) { if (!w) {
$scope.loading = $scope.failure = false; $scope.loading = $scope.failure = false;
$rootScope.flashMessage = { message: 'Bad password or connection error', type: 'error'}; $rootScope.$flashMessage = { message: 'Bad password or connection error', type: 'error'};
$rootScope.$digest(); $rootScope.$digest();
return; return;
} }
@ -53,7 +53,7 @@ angular.module('copay.signin').controller('SigninController',
$scope.join = function(form) { $scope.join = function(form) {
if (form && form.$invalid) { if (form && form.$invalid) {
$rootScope.flashMessage = { message: 'Please, enter required fields', type: 'error'}; $rootScope.$flashMessage = { message: 'Please, enter required fields', type: 'error'};
return; return;
} }
@ -66,13 +66,13 @@ angular.module('copay.signin').controller('SigninController',
$scope.loading = false; $scope.loading = false;
if (err || !w) { if (err || !w) {
if (err === 'joinError') if (err === 'joinError')
$rootScope.flashMessage = { message: 'Can not find peer'}; $rootScope.$flashMessage = { message: 'Can not find peer'};
else if (err === 'walletFull') else if (err === 'walletFull')
$rootScope.flashMessage = { message: 'The wallet is full'}; $rootScope.$flashMessage = { message: 'The wallet is full', type: 'error'};
else if (err === 'badSecret') else if (err === 'badSecret')
$rootScope.flashMessage = { message: 'Bad secret secret string', type: 'error'}; $rootScope.$flashMessage = { message: 'Bad secret secret string', type: 'error'};
else else
$rootScope.flashMessage = { message: 'Unknown error', type: 'error'}; $rootScope.$flashMessage = { message: 'Unknown error', type: 'error'};
controllerUtils.onErrorDigest(); controllerUtils.onErrorDigest();
} else { } else {
controllerUtils.startNetwork(w); controllerUtils.startNetwork(w);

View File

@ -47,7 +47,7 @@ angular.module('copay.transactions').controller('TransactionsController',
var w = $rootScope.wallet; var w = $rootScope.wallet;
w.sendTx(ntxid, function(txid) { w.sendTx(ntxid, function(txid) {
console.log('[transactions.js.68:txid:] SENTTX CALLBACK',txid); //TODO console.log('[transactions.js.68:txid:] SENTTX CALLBACK',txid); //TODO
$rootScope.flashMessage = txid $rootScope.$flashMessage = txid
? {type:'success', message: 'Transaction broadcasted. txid: ' + txid} ? {type:'success', message: 'Transaction broadcasted. txid: ' + txid}
: {type:'error', message: 'There was an error sending the Transaction'} : {type:'error', message: 'There was an error sending the Transaction'}
; ;
@ -61,7 +61,7 @@ angular.module('copay.transactions').controller('TransactionsController',
var w = $rootScope.wallet; var w = $rootScope.wallet;
w.sign(ntxid, function(ret){ w.sign(ntxid, function(ret){
if (!ret) { if (!ret) {
$rootScope.flashMessage = { $rootScope.$flashMessage = {
type:'error', type:'error',
message: 'There was an error signing the Transaction', message: 'There was an error signing the Transaction',
}; };
@ -101,7 +101,7 @@ angular.module('copay.transactions').controller('TransactionsController',
$rootScope.txAlertCount = 0; $rootScope.txAlertCount = 0;
var w = $rootScope.wallet; var w = $rootScope.wallet;
w.reject(ntxid); w.reject(ntxid);
$rootScope.flashMessage = {type:'warning', message: 'Transaction rejected by you'}; $rootScope.$flashMessage = {type:'warning', message: 'Transaction rejected by you'};
$scope.loading = false; $scope.loading = false;
}; };

View File

@ -30,7 +30,7 @@ angular.module('copay.directives')
link: function(scope, element, attrs, ctrl) { link: function(scope, element, attrs, ctrl) {
setTimeout(function() { setTimeout(function() {
scope.$apply(function() { scope.$apply(function() {
$rootScope.flashMessage = {}; $rootScope.$flashMessage = {};
}); });
}, 5000); }, 5000);
} }

View File

@ -19,7 +19,7 @@ angular.module('copay.controllerUtils')
video.close(); video.close();
// Clear rootScope // Clear rootScope
for (var i in $rootScope) { for (var i in $rootScope) {
if (i.charAt(0) != '$' && i != 'flashMessage') { if (i.charAt(0) != '$') {
delete $rootScope[i]; delete $rootScope[i];
} }
} }
@ -50,7 +50,7 @@ angular.module('copay.controllerUtils')
$rootScope.$digest(); $rootScope.$digest();
}; };
w.on('badMessage', function(peerId) { w.on('badMessage', function(peerId) {
$rootScope.flashMessage = { $rootScope.$flashMessage = {
type: 'error', type: 'error',
message: 'Received wrong message from peer id:' + peerId message: 'Received wrong message from peer id:' + peerId
}; };