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

@ -130,6 +130,63 @@ header .alt-currency {
font-size: 10px; font-size: 10px;
} }
.head {
background-color: #FFF;
height: 62px;
border-bottom: 1px solid #eee;
position: fixed;
z-index: 10;
left: 250px;
right: 0;
}
.head .title h1 {
float: left;
padding: 12px 10px;
margin: 0;
}
.head .menu {
float: right;
position: relative;
}
.head .menu a.dropdown {
display: block;
height: 62px;
width: 140px;
padding: 22px 5px;
text-align: center;
}
.head .menu a.dropdown:hover,
.head .menu a.dropdown.hover {
border-bottom: 1px solid #fff;
}
.head .menu ul {
position: absolute;
right: 0;
width: 160px;
list-style-type: none;
top: 61px;
}
.head .menu ul.hover {
background-color: #fff;
border: 1px solid #eee;
border-top: 1px solid #fff;
}
.head .menu ul li a {
display: block;
padding: 5px 10px;
}
.head .menu ul li a:hover {
background-color: #fff;
}
.col1 { .col1 {
width: 56px; width: 56px;
float: left; float: left;
@ -209,15 +266,13 @@ input:-webkit-autofill, textarea:-webkit-autofill, select:-webkit-autofill, inpu
color: #CA5649; color: #CA5649;
background-color: #E2CFD0; background-color: #E2CFD0;
position: absolute; position: absolute;
margin-left: auto;
margin-right: auto;
left: 250px; left: 250px;
right: 0; right: 0;
top: 0; top: 62px;
width: 100%; padding: 5px 0;
padding: 20px 50px; z-index: 9;
height: 60px; font-size: 12px;
z-index: 9999; text-align: center;
} }
.setup .comment { .setup .comment {
@ -269,7 +324,7 @@ a:hover {
.main { .main {
margin-left: 250px; margin-left: 250px;
padding: 1.5rem; padding: 80px 1.5rem;
background-color: #F8F8FB; background-color: #F8F8FB;
} }

View file

@ -14,10 +14,7 @@
.status { .status {
left: 0; left: 0;
top: 45px; top: 40px;
font-size: 13px;
font-weight: 700;
height: 55px;
} }
.logo-setup { .logo-setup {
@ -42,6 +39,7 @@
margin-left: 0; margin-left: 0;
margin-bottom: -40px; margin-bottom: -40px;
padding-bottom: 60px; padding-bottom: 60px;
padding-top: 20px;
} }
.tab-bar { .tab-bar {

View file

@ -28,7 +28,7 @@
<div class="off-canvas-wrap"> <div class="off-canvas-wrap">
<div class="inner-wrap"> <div class="inner-wrap">
<span class="status" ng-if="$root.reconnecting"> <span class="status" ng-if="$root.reconnecting">
<i class="fi-loop icon-rotate m10r"></i> <i class="fi-loop icon-rotate"></i>
<span translate> Network Error. Attempting to reconnect...</span> <span translate> Network Error. Attempting to reconnect...</span>
</span> </span>
<nav class="tab-bar" ng-if="$root.wallet && <nav class="tab-bar" ng-if="$root.wallet &&
@ -65,6 +65,12 @@
class="sidebar" class="sidebar"
ng-if="$root.iden"></div> ng-if="$root.iden"></div>
<div
ng-controller="HeadController"
class="head show-for-large-up"
ng-include="'views/includes/head.html'"
ng-if="$root.iden"></div>
<section ng-class="{'main' : $root.iden && $root.iden.listWallets().length>=0}" ng-view></section> <section ng-class="{'main' : $root.iden && $root.iden.listWallets().length>=0}" ng-view></section>
<a class="exit-off-canvas"></a> <a class="exit-off-canvas"></a>

View file

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

View file

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

View file

@ -9,6 +9,7 @@ angular.module('copayApp.controllers').controller('CreateController',
$scope.isMobile = !!window.cordova; $scope.isMobile = !!window.cordova;
$scope.hideAdv = true; $scope.hideAdv = true;
$scope.networkName = config.networkName; $scope.networkName = config.networkName;
$rootScope.title = 'Create a wallet';
// ng-repeat defined number of times instead of repeating over array? // ng-repeat defined number of times instead of repeating over array?
$scope.getNumber = function(num) { $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', angular.module('copayApp.controllers').controller('ImportController',
function($scope, $rootScope, $location, controllerUtils, Passphrase, notification, isMobile) { 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.importStatus = 'Importing wallet - Reading backup...';
$scope.hideAdv = true; $scope.hideAdv = true;
$scope.is_iOS = isMobile.iOS(); $scope.is_iOS = isMobile.iOS();

View file

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

View file

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

View file

@ -6,6 +6,7 @@ angular.module('copayApp.controllers').controller('MoreController',
var w = $rootScope.wallet; var w = $rootScope.wallet;
$scope.isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0; $scope.isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
$rootScope.title = 'Settings';
$scope.unitOpts = [{ $scope.unitOpts = [{
name: 'Satoshis (100,000,000 satoshis = 1BTC)', 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);
preconditions.checkState(w.settings.unitToSatoshi); preconditions.checkState(w.settings.unitToSatoshi);
$scope.title = 'Send'; $rootScope.title = 'Send';
$scope.loading = false; $scope.loading = false;
var satToUnit = 1 / w.settings.unitToSatoshi; var satToUnit = 1 / w.settings.unitToSatoshi;
$scope.defaultFee = bitcore.TransactionBuilder.FEE_PER_1000B_SAT * satToUnit; $scope.defaultFee = bitcore.TransactionBuilder.FEE_PER_1000B_SAT * satToUnit;

View file

@ -1,6 +1,6 @@
'use strict'; '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 = [{ $scope.menu = [{
'title': 'Receive', 'title': 'Receive',
@ -20,20 +20,6 @@ angular.module('copayApp.controllers').controller('SidebarController', function(
'link': 'more' '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() { $scope.refresh = function() {
var w = $rootScope.wallet; var w = $rootScope.wallet;
if (!w) return; if (!w) return;
@ -53,32 +39,7 @@ angular.module('copayApp.controllers').controller('SidebarController', function(
return item.link && item.link == $location.path().split('/')[1]; 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) { 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() { $rootScope.$watch('wallet.id', function() {
$scope.walletSelection = false; $scope.walletSelection = false;
}); });

View file

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

View file

@ -1,9 +1,6 @@
<div class="addresses" ng-controller="AddressesController"> <div class="addresses" ng-controller="AddressesController">
<div ng-show='$root.wallet.isReady()'> <div ng-show='$root.wallet.isReady()'>
<h1> <h1 class="hide-for-large-up">{{$root.title}}</h1>
<span translate>Addresses</span>
<span class="button primary small side-bar" ng-click="newAddr()" ng-disabled="loading"><i class="fi-plus"></i></span>
</h1>
<div ng-show="!addresses[0]"> <div ng-show="!addresses[0]">
<i class="fi-bitcoin-circle icon-rotate spinner"></i> <i class="fi-bitcoin-circle icon-rotate spinner"></i>
</div> </div>
@ -56,6 +53,10 @@
<span translate ng-if="!showAll">Show all</span> <span translate ng-if="!showAll">Show all</span>
<span translate ng-if="showAll">Show less</span> <span translate ng-if="showAll">Show less</span>
</a> </a>
<div class="m20t">
<a ng-click="newAddr()" ng-disabled="loading">Add <i class="fi-plus"></i></span>
</div>
</div> </div>
</div> </div>

View file

@ -4,26 +4,26 @@
<div class="row collapse"> <div class="row collapse">
<div class="large-12 columns"> <div class="large-12 columns">
<div ng-if="!$root.wallet.publicKeyRing.isComplete()"> <div ng-if="!$root.wallet.publicKeyRing.isComplete()">
<h1> <h2>
<span translate>Waiting copayers for</span> <span translate>Waiting copayers for</span>
{{$root.wallet.getName()}} {{$root.wallet.getName()}}
<small>{{$root.wallet.requiredCopayers}}-{{'of'|translate}}-{{$root.wallet.totalCopayers}}</small> <small>{{$root.wallet.requiredCopayers}}-{{'of'|translate}}-{{$root.wallet.totalCopayers}}</small>
</h1> </h2>
<div class="panel oh"> <div class="panel oh">
<qrcode size="350" data="{{$root.wallet.getSecret()}}"></qrcode> <qrcode size="350" data="{{$root.wallet.getSecret()}}"></qrcode>
<div class="secret"> <div class="secret">
<h2 translate>Share this secret with your other copayers</h2> <h3 translate>Share this secret with your other copayers</h3>
{{$root.wallet.getSecret()}} {{$root.wallet.getSecret()}}
<span class="btn-copy" clip-copy="$root.wallet.getSecret()"></span> <span class="btn-copy" clip-copy="$root.wallet.getSecret()"></span>
</div> </div>
</div> </div>
</div> </div>
<h1 ng-if="$root.wallet && <h2 ng-if="$root.wallet &&
$root.wallet.publicKeyRing.isComplete()"> $root.wallet.publicKeyRing.isComplete()">
<span translate>Wallet</span> {{$root.wallet.getName()}} <span translate>Wallet</span> {{$root.wallet.getName()}}
<small>{{$root.wallet.requiredCopayers}}-{{'of'|translate}}-{{$root.wallet.totalCopayers}}</small> <small>{{$root.wallet.requiredCopayers}}-{{'of'|translate}}-{{$root.wallet.totalCopayers}}</small>
<span translate>created</span> <span translate>created</span>
</h1> </h2>
<div class="box-setup-copayers p20"> <div class="box-setup-copayers p20">
<p class="text-primary m10b" <p class="text-primary m10b"
ng-show="$root.wallet && $root.wallet.publicKeyRing.isComplete()" translate> ng-show="$root.wallet && $root.wallet.publicKeyRing.isComplete()" translate>

View file

@ -6,7 +6,7 @@
<div class="setup" ng-show="!loading"> <div class="setup" ng-show="!loading">
<form name="setupForm" ng-submit="create(setupForm)" novalidate> <form name="setupForm" ng-submit="create(setupForm)" novalidate>
<h1>{{'Create Wallet'|translate}}</h1> <h1 class="hide-for-large-up">{{$root.title}}</h1>
<div class="row"> <div class="row">
<div class="large-12 columns"> <div class="large-12 columns">
<label><span translate>Wallet name</span> <label><span translate>Wallet name</span>
@ -51,6 +51,10 @@
<div class="text-right"> <div class="text-right">
<a class="back-button m20r" href="#!/manage">
<i class="fi-arrow-left"></i>
<span translate>Back</span>
</a>
<button translate type="submit" class="button secondary m0" ng-disabled="setupForm.$invalid || loading"> <button translate type="submit" class="button secondary m0" ng-disabled="setupForm.$invalid || loading">
Create {{requiredCopayers}}-of-{{totalCopayers}} wallet Create {{requiredCopayers}}-of-{{totalCopayers}} wallet
</button> </button>

View file

@ -7,7 +7,7 @@
<div class="row" ng-show="!loading"> <div class="row" ng-show="!loading">
<div class="large-12 columns"> <div class="large-12 columns">
<h1>{{title|translate}}</h1> <h1 class="hide-for-large-up">{{$root.title}}</h1>
<form name="importForm" ng-submit="import(importForm)" novalidate> <form name="importForm" ng-submit="import(importForm)" novalidate>
<div ng-show="!is_iOS"> <div ng-show="!is_iOS">
<legend for="backupFile" class="m10b"> <legend for="backupFile" class="m10b">
@ -61,7 +61,10 @@
<div class="text-right m20t"> <div class="text-right m20t">
<a class="back-button text-white m20r" href="#!/">&laquo; <span translate>Back</span></a> <a class="back-button m20r" href="#!/manage">
<i class="fi-arrow-left"></i>
<span translate>Back</span>
</a>
<button translate type="submit" class="button primary m0" ng-disabled="importForm.$invalid"> <button translate type="submit" class="button primary m0" ng-disabled="importForm.$invalid">
Import backup Import backup
</button> </button>

16
views/includes/head.html Normal file
View file

@ -0,0 +1,16 @@
<div class="title">
<h1>{{$root.title}}</h1>
</div>
<div class="menu" ng-mouseover="hoverIn()" ng-mouseleave="hoverOut()"
ng-click="hoverMenu = !hoverMenu">
<a class="dropdown ellipsis" ng-class="{'hover': hoverMenu}">{{username}}</a>
<ul ng-show="hoverMenu" ng-class="{'hover': hoverMenu}">
<li>
<a href="#!/manage" title="Manage wallets">
<i class="fi-plus"></i> {{'Manage wallets' | translate }}</a></li>
<li><a href="#!/" title="Close" ng-click="signout()">
<i class="fi-power"></i> {{'Close'|translate}}</a></li>
</ul>
</div>

View file

@ -86,10 +86,6 @@
</span> </span>
</a> </a>
</li> </li>
<li>
<a href="#!/" class="db p20h" title="Close" ng-click="signout()"><i class="size-21 m20r fi-power"></i> {{'Close'|translate}}</a>
</li>
</ul> </ul>
<div class="sidebar-footer text-center"> <div class="sidebar-footer text-center">

View file

@ -5,7 +5,7 @@
</div> </div>
<div ng-show="!loading"> <div ng-show="!loading">
<h1>{{'Join Wallet'|translate}}</h1> <h1 class="hide-for-large-up">{{$root.title}}</h1>
<div class="row collapse"> <div class="row collapse">
<div class="large-12 columns"> <div class="large-12 columns">
<form name="joinForm" ng-submit="join(joinForm)" novalidate> <form name="joinForm" ng-submit="join(joinForm)" novalidate>
@ -66,6 +66,10 @@
</div> </div>
<div class="text-right"> <div class="text-right">
<a class="back-button m20r" href="#!/manage">
<i class="fi-arrow-left"></i>
<span translate>Back</span>
</a>
<button translate type="submit" class="button primary m0" ng-disabled="joinForm.$invalid">Join</button> <button translate type="submit" class="button primary m0" ng-disabled="joinForm.$invalid">Join</button>
</div> </div>
</form> </form>

View file

@ -1,5 +1,5 @@
<div class="backup" ng-controller="ManageController"> <div class="backup" ng-controller="ManageController">
<h1 translate>Manage Wallets</h1> <h1 class="hide-for-large-up">{{$root.title}}</h1>
<div class="row collapse"> <div class="row collapse">
<div class="large-12 columns"> <div class="large-12 columns">
<div class="large-4 columns" > <div class="large-4 columns" >

View file

@ -1,5 +1,5 @@
<div class="backup" ng-controller="MoreController"> <div class="backup" ng-controller="MoreController">
<h1 translate>Settings </h1> <h1 class="hide-for-large-up">{{$root.title}} </h1>
<div class="large-12 columns panel"> <div class="large-12 columns panel">
<h2><i class="fi-download m10r"></i> <span translate>Backup</span> </h2> <h2><i class="fi-download m10r"></i> <span translate>Backup</span> </h2>
<p translate class="text-gray"> <p translate class="text-gray">

View file

@ -7,7 +7,7 @@
</div> </div>
<div ng-show="txs.length != 0" class="large-12 line-dashed" style="padding: 0;"></div> <div ng-show="txs.length != 0" class="large-12 line-dashed" style="padding: 0;"></div>
<h1>{{title|translate}}</h1> <h1 class="hide-for-large-up">{{$root.title}}</h1>
<div class="row collapse m0"> <div class="row collapse m0">
<div class="large-6 columns"> <div class="large-6 columns">
<form name="sendForm" ng-submit="submitForm(sendForm)" novalidate> <form name="sendForm" ng-submit="submitForm(sendForm)" novalidate>

View file

@ -1,7 +1,7 @@
<div class="transactions" data-ng-controller="TransactionsController" data-ng-init="update()"> <div class="transactions" data-ng-controller="TransactionsController" data-ng-init="update()">
<div ng-show='$root.wallet.isReady()'> <div ng-show='$root.wallet.isReady()'>
<h1 ng-show="wallet.isShared()"> <h2 ng-show="wallet.isShared()">
<span translate>Transaction Proposals</span> <small>({{txs.length}})</small></h1> <span translate>Transaction Proposals</span> <small>({{txs.length}})</small></h2>
<div class="large-12" ng-show="wallet.isShared()"> <div class="large-12" ng-show="wallet.isShared()">
<div class="last-transactions" ng-repeat="tx in txs | paged"> <div class="last-transactions" ng-repeat="tx in txs | paged">
@ -14,12 +14,12 @@
<pagination ng-show="txs.length > txpItemsPerPage" total-items="txs.length" items-per-page="txpItemsPerPage" page="txpCurrentPage" on-select-page="show()" class="pagination-small primary"></pagination> <pagination ng-show="txs.length > txpItemsPerPage" total-items="txs.length" items-per-page="txpItemsPerPage" page="txpCurrentPage" on-select-page="show()" class="pagination-small primary"></pagination>
</div> </div>
<h1 ng-class="{'line-dashed': wallet.isShared()}"> <h2 ng-class="{'line-dashed': wallet.isShared()}">
<span translate>Last transactions</span> <span translate>Last transactions</span>
<small ng-hide="wallet.isShared() || !loading"> <small ng-hide="wallet.isShared() || !loading">
<i class="fi-bitcoin-circle icon-rotate spinner"></i> <i class="fi-bitcoin-circle icon-rotate spinner"></i>
</small> </small>
</h1> </h2>
<div class="large-12"> <div class="large-12">
<div class="m10b size-12" ng-hide="wallet.totalCopayers == 1"> <div class="m10b size-12" ng-hide="wallet.totalCopayers == 1">