From 096a5d02909e0b8acdd1f6cbe54e5aae102bfe03 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Mon, 27 Oct 2014 16:13:06 -0300 Subject: [PATCH] top-bar with dynamic title --- css/src/main.css | 71 ++++++++++++++++++++++++++++++---- css/src/mobile.css | 6 +-- index.html | 8 +++- js/controllers/addresses.js | 1 + js/controllers/copayers.js | 1 + js/controllers/create.js | 1 + js/controllers/head.js | 53 +++++++++++++++++++++++++ js/controllers/import.js | 2 +- js/controllers/join.js | 1 + js/controllers/manage.js | 2 + js/controllers/more.js | 1 + js/controllers/send.js | 2 +- js/controllers/sidebar.js | 41 +------------------- js/controllers/transactions.js | 2 +- views/addresses.html | 9 +++-- views/copayers.html | 10 ++--- views/create.html | 6 ++- views/import.html | 7 +++- views/includes/head.html | 16 ++++++++ views/includes/sidebar.html | 4 -- views/join.html | 6 ++- views/manage.html | 2 +- views/more.html | 2 +- views/send.html | 2 +- views/transactions.html | 8 ++-- 25 files changed, 184 insertions(+), 80 deletions(-) create mode 100644 js/controllers/head.js create mode 100644 views/includes/head.html diff --git a/css/src/main.css b/css/src/main.css index bee2b9332..901072824 100644 --- a/css/src/main.css +++ b/css/src/main.css @@ -130,6 +130,63 @@ header .alt-currency { 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 { width: 56px; float: left; @@ -209,15 +266,13 @@ input:-webkit-autofill, textarea:-webkit-autofill, select:-webkit-autofill, inpu color: #CA5649; background-color: #E2CFD0; position: absolute; - margin-left: auto; - margin-right: auto; left: 250px; right: 0; - top: 0; - width: 100%; - padding: 20px 50px; - height: 60px; - z-index: 9999; + top: 62px; + padding: 5px 0; + z-index: 9; + font-size: 12px; + text-align: center; } .setup .comment { @@ -269,7 +324,7 @@ a:hover { .main { margin-left: 250px; - padding: 1.5rem; + padding: 80px 1.5rem; background-color: #F8F8FB; } diff --git a/css/src/mobile.css b/css/src/mobile.css index b36b42fbe..7de308022 100644 --- a/css/src/mobile.css +++ b/css/src/mobile.css @@ -14,10 +14,7 @@ .status { left: 0; - top: 45px; - font-size: 13px; - font-weight: 700; - height: 55px; + top: 40px; } .logo-setup { @@ -42,6 +39,7 @@ margin-left: 0; margin-bottom: -40px; padding-bottom: 60px; + padding-top: 20px; } .tab-bar { diff --git a/index.html b/index.html index ba0becd4a..1546191cf 100644 --- a/index.html +++ b/index.html @@ -28,7 +28,7 @@
- + Network Error. Attempting to reconnect...
+
+
diff --git a/js/controllers/addresses.js b/js/controllers/addresses.js index 522516c1d..9c4117204 100644 --- a/js/controllers/addresses.js +++ b/js/controllers/addresses.js @@ -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; diff --git a/js/controllers/copayers.js b/js/controllers/copayers.js index 40e2970a7..2dc5398be 100644 --- a/js/controllers/copayers.js +++ b/js/controllers/copayers.js @@ -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; diff --git a/js/controllers/create.js b/js/controllers/create.js index b790245ec..0f7cd7593 100644 --- a/js/controllers/create.js +++ b/js/controllers/create.js @@ -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) { diff --git a/js/controllers/head.js b/js/controllers/head.js new file mode 100644 index 000000000..ac18238c6 --- /dev/null +++ b/js/controllers/head.js @@ -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; + }); + } +}); + diff --git a/js/controllers/import.js b/js/controllers/import.js index 717935593..190c37c80 100644 --- a/js/controllers/import.js +++ b/js/controllers/import.js @@ -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(); diff --git a/js/controllers/join.js b/js/controllers/join.js index a96c9772c..392c43701 100644 --- a/js/controllers/join.js +++ b/js/controllers/join.js @@ -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; diff --git a/js/controllers/manage.js b/js/controllers/manage.js index 55ec36bdb..97c53a0bc 100644 --- a/js/controllers/manage.js +++ b/js/controllers/manage.js @@ -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); }; diff --git a/js/controllers/more.js b/js/controllers/more.js index 23b286bad..210fa4c2c 100644 --- a/js/controllers/more.js +++ b/js/controllers/more.js @@ -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)', diff --git a/js/controllers/send.js b/js/controllers/send.js index f404fbcd0..c901e7079 100644 --- a/js/controllers/send.js +++ b/js/controllers/send.js @@ -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; diff --git a/js/controllers/sidebar.js b/js/controllers/sidebar.js index 51e2c2362..12499bb0a 100644 --- a/js/controllers/sidebar.js +++ b/js/controllers/sidebar.js @@ -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; }); diff --git a/js/controllers/transactions.js b/js/controllers/transactions.js index ebaa017ae..ceec6414d 100644 --- a/js/controllers/transactions.js +++ b/js/controllers/transactions.js @@ -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; diff --git a/views/addresses.html b/views/addresses.html index 4f5ee7c23..f775f5bdf 100644 --- a/views/addresses.html +++ b/views/addresses.html @@ -1,9 +1,6 @@
-

- Addresses - -

+

{{$root.title}}

@@ -56,6 +53,10 @@ Show all Show less + +
diff --git a/views/copayers.html b/views/copayers.html index cdd3fb155..6f6613482 100644 --- a/views/copayers.html +++ b/views/copayers.html @@ -4,26 +4,26 @@
-

+

Waiting copayers for {{$root.wallet.getName()}} {{$root.wallet.requiredCopayers}}-{{'of'|translate}}-{{$root.wallet.totalCopayers}} -

+
-

Share this secret with your other copayers

+

Share this secret with your other copayers

{{$root.wallet.getSecret()}}
-

Wallet {{$root.wallet.getName()}} {{$root.wallet.requiredCopayers}}-{{'of'|translate}}-{{$root.wallet.totalCopayers}} created -

+

diff --git a/views/create.html b/views/create.html index 39b534353..b6e938c7a 100644 --- a/views/create.html +++ b/views/create.html @@ -6,7 +6,7 @@

-

{{'Create Wallet'|translate}}

+

{{$root.title}}

+ + + Back + diff --git a/views/import.html b/views/import.html index 2ba4255e2..df4093248 100644 --- a/views/import.html +++ b/views/import.html @@ -7,7 +7,7 @@
-

{{title|translate}}

+

{{$root.title}}

@@ -61,7 +61,10 @@
- « Back + + + Back + diff --git a/views/includes/head.html b/views/includes/head.html new file mode 100644 index 000000000..33d1d41d7 --- /dev/null +++ b/views/includes/head.html @@ -0,0 +1,16 @@ +
+

{{$root.title}}

+
+ + + diff --git a/views/includes/sidebar.html b/views/includes/sidebar.html index 3b453feab..02c602bb3 100644 --- a/views/includes/sidebar.html +++ b/views/includes/sidebar.html @@ -86,10 +86,6 @@ - -
  • - {{'Close'|translate}} -
  • -

    {{'Join Wallet'|translate}}

    +

    {{$root.title}}

    @@ -66,6 +66,10 @@
    diff --git a/views/manage.html b/views/manage.html index 870510027..fc5ecbeef 100644 --- a/views/manage.html +++ b/views/manage.html @@ -1,5 +1,5 @@
    -

    Manage Wallets

    +

    {{$root.title}}

    diff --git a/views/more.html b/views/more.html index 851b8e39b..471dc210c 100644 --- a/views/more.html +++ b/views/more.html @@ -1,5 +1,5 @@
    -

    Settings

    +

    {{$root.title}}

    Backup

    diff --git a/views/send.html b/views/send.html index d0e1cbac0..38a542149 100644 --- a/views/send.html +++ b/views/send.html @@ -7,7 +7,7 @@

    -

    {{title|translate}}

    +

    {{$root.title}}

    diff --git a/views/transactions.html b/views/transactions.html index eeea1045e..9f9c02b5b 100644 --- a/views/transactions.html +++ b/views/transactions.html @@ -1,7 +1,7 @@
    -

    - Transaction Proposals ({{txs.length}})

    +

    + Transaction Proposals ({{txs.length}})

    @@ -14,12 +14,12 @@
    -

    +

    Last transactions -

    +