Merge pull request #36 from cmgustavo/matias/feature/identity

top-bar with dynamic titles
This commit is contained in:
Matias Alejo Garcia 2014-10-27 23:13:30 -03:00
commit e87d6165dd
25 changed files with 184 additions and 80 deletions

View file

@ -4,6 +4,7 @@ angular.module('copayApp.controllers').controller('AddressesController',
function($scope, $rootScope, $timeout, $modal, controllerUtils) {
controllerUtils.redirIfNotComplete();
$rootScope.title = 'Addresses';
$scope.loading = false;
$scope.showAll = false;

View file

@ -4,6 +4,7 @@ angular.module('copayApp.controllers').controller('CopayersController',
function($scope, $rootScope, $location, backupService, controllerUtils) {
$scope.isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
$scope.hideAdv = true;
$rootScope.title = 'Copayers';
$scope.skipBackup = function() {
var w = $rootScope.wallet;

View file

@ -9,6 +9,7 @@ angular.module('copayApp.controllers').controller('CreateController',
$scope.isMobile = !!window.cordova;
$scope.hideAdv = true;
$scope.networkName = config.networkName;
$rootScope.title = 'Create a wallet';
// ng-repeat defined number of times instead of repeating over array?
$scope.getNumber = function(num) {

53
js/controllers/head.js Normal file
View file

@ -0,0 +1,53 @@
'use strict';
angular.module('copayApp.controllers').controller('HeadController', function($scope, $rootScope, notification, controllerUtils) {
$scope.username = $rootScope.iden.profile.email;
$scope.hoverMenu = false;
$scope.hoverIn = function(){
this.hoverMenu = true;
};
$scope.hoverOut = function(){
this.hoverMenu = false;
};
$scope.signout = function() {
logout();
};
function logout() {
controllerUtils.logout();
}
// Ensures a graceful disconnect
window.onbeforeunload = function() {
controllerUtils.logout();
};
$scope.$on('$destroy', function() {
window.onbeforeunload = undefined;
});
if ($rootScope.wallet) {
$scope.$on('$idleWarn', function(a, countdown) {
if (!(countdown % 5))
notification.warning('Session will be closed', $filter('translate')('Your session is about to expire due to inactivity in') + ' ' + countdown + ' ' + $filter('translate')('seconds'));
});
$scope.$on('$idleTimeout', function() {
$scope.signout();
notification.warning('Session closed', 'Session closed because a long time of inactivity');
});
$scope.$on('$keepalive', function() {
if ($rootScope.wallet) {
$rootScope.wallet.keepAlive();
}
});
$rootScope.$watch('title', function(newTitle, oldTitle) {
$scope.title = newTitle;
});
}
});

View file

@ -3,7 +3,7 @@
angular.module('copayApp.controllers').controller('ImportController',
function($scope, $rootScope, $location, controllerUtils, Passphrase, notification, isMobile) {
$scope.title = 'Import a backup';
$rootScope.title = 'Import a backup';
$scope.importStatus = 'Importing wallet - Reading backup...';
$scope.hideAdv = true;
$scope.is_iOS = isMobile.iOS();

View file

@ -5,6 +5,7 @@ angular.module('copayApp.controllers').controller('JoinController',
$rootScope.fromSetup = false;
$scope.loading = false;
$scope.isMobile = !!window.cordova;
$rootScope.title = 'Join a wallet';
// QR code Scanner
var cameraInput;

View file

@ -2,6 +2,8 @@
angular.module('copayApp.controllers').controller('ManageController', function($scope, $rootScope, $location, controllerUtils, backupService) {
$scope.isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
$rootScope.title = 'Manage wallets';
$scope.downloadBackup = function() {
backupService.profileDownload($rootScope.iden);
};

View file

@ -6,6 +6,7 @@ angular.module('copayApp.controllers').controller('MoreController',
var w = $rootScope.wallet;
$scope.isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
$rootScope.title = 'Settings';
$scope.unitOpts = [{
name: 'Satoshis (100,000,000 satoshis = 1BTC)',

View file

@ -10,7 +10,7 @@ angular.module('copayApp.controllers').controller('SendController',
preconditions.checkState(w);
preconditions.checkState(w.settings.unitToSatoshi);
$scope.title = 'Send';
$rootScope.title = 'Send';
$scope.loading = false;
var satToUnit = 1 / w.settings.unitToSatoshi;
$scope.defaultFee = bitcore.TransactionBuilder.FEE_PER_1000B_SAT * satToUnit;

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('SidebarController', function($scope, $rootScope, $sce, $location, $http, $filter, notification, controllerUtils) {
angular.module('copayApp.controllers').controller('SidebarController', function($scope, $rootScope, $location, controllerUtils) {
$scope.menu = [{
'title': 'Receive',
@ -20,20 +20,6 @@ angular.module('copayApp.controllers').controller('SidebarController', function(
'link': 'more'
}];
$scope.signout = function() {
logout();
};
// Ensures a graceful disconnect
window.onbeforeunload = function() {
controllerUtils.logout();
};
$scope.$on('$destroy', function() {
window.onbeforeunload = undefined;
});
$scope.refresh = function() {
var w = $rootScope.wallet;
if (!w) return;
@ -53,32 +39,7 @@ angular.module('copayApp.controllers').controller('SidebarController', function(
return item.link && item.link == $location.path().split('/')[1];
};
function logout() {
controllerUtils.logout();
}
// ng-repeat defined number of times instead of repeating over array?
$scope.getNumber = function(num) {
return new Array(num);
}
if ($rootScope.wallet) {
$scope.$on('$idleWarn', function(a, countdown) {
if (!(countdown % 5))
notification.warning('Session will be closed', $filter('translate')('Your session is about to expire due to inactivity in') + ' ' + countdown + ' ' + $filter('translate')('seconds'));
});
$scope.$on('$idleTimeout', function() {
$scope.signout();
notification.warning('Session closed', 'Session closed because a long time of inactivity');
});
$scope.$on('$keepalive', function() {
if ($rootScope.wallet) {
$rootScope.wallet.keepAlive();
}
});
$rootScope.$watch('wallet.id', function() {
$scope.walletSelection = false;
});

View file

@ -8,7 +8,7 @@ angular.module('copayApp.controllers').controller('TransactionsController',
var w = $rootScope.wallet;
$scope.title = 'Transactions';
$rootScope.title = 'History';
$scope.loading = false;
$scope.lastShowed = false;