From ec875f7b1b69d2fdcd4499a358d7f487ddeff609 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Mon, 26 Sep 2016 18:26:41 -0300 Subject: [PATCH] Hide nav-bar on amount/confirm and addressbook views --- public/views/tabs.html | 8 ++++---- src/js/controllers/amount.js | 4 ++-- src/js/controllers/tabsController.js | 26 ++++++++++++++++++++++++-- src/js/routes.js | 1 + src/sass/views/address-book.scss | 2 -- 5 files changed, 31 insertions(+), 10 deletions(-) diff --git a/public/views/tabs.html b/public/views/tabs.html index 66d9a2bc5..b1d26e8fc 100644 --- a/public/views/tabs.html +++ b/public/views/tabs.html @@ -3,13 +3,13 @@ Create tabs with an icon and label, using the tabs-positive style. Each tab's child directive will have its own navigation history that also transitions its views in and out. --> - + - + - + @@ -21,7 +21,7 @@ navigation history that also transitions its views in and out. - + diff --git a/src/js/controllers/amount.js b/src/js/controllers/amount.js index 590fa55d4..48daafb38 100644 --- a/src/js/controllers/amount.js +++ b/src/js/controllers/amount.js @@ -15,11 +15,11 @@ angular.module('copayApp.controllers').controller('amountController', function($ $scope.toName = $stateParams.toName; $scope.toEmail = $stateParams.toEmail; - $scope.$on('$ionicView.beforeLeave', function() { + $scope.$on('$ionicView.leave', function() { angular.element($window).off('keydown'); }); - $scope.$on("$ionicView.beforeEnter", function(event, data) { + $scope.$on("$ionicView.enter", function(event, data) { if (!$stateParams.toAddress) { $log.error('Bad params at amount') diff --git a/src/js/controllers/tabsController.js b/src/js/controllers/tabsController.js index ccd1b1e88..6d1a7116f 100644 --- a/src/js/controllers/tabsController.js +++ b/src/js/controllers/tabsController.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('tabsController', function($log, $scope, $stateParams, $ionicModal, $timeout, incomingData) { +angular.module('copayApp.controllers').controller('tabsController', function($rootScope, $log, $scope, $state, $stateParams, $timeout, incomingData, lodash) { $scope.onScan = function(data) { if (!incomingData.redir(data)) { @@ -22,6 +22,28 @@ angular.module('copayApp.controllers').controller('tabsController', function($lo $timeout(function() { $scope.$apply(); }, 1); - } + }; + + var hideTabsViews = [ + 'tabs.send.amount', + 'tabs.send.confirm', + 'tabs.send.addressbook', + 'tabs.addressbook', + 'tabs.addressbook.add', + 'tabs.addressbook.view', + ]; + + $rootScope.$on('$ionicView.beforeEnter', function() { + + $rootScope.hideTabs = false; + + var currentState = $state.current.name; + + lodash.each(hideTabsViews, function(view) { + if (currentState === view) { + $rootScope.hideTabs = true; + } + }); + }); }); diff --git a/src/js/routes.js b/src/js/routes.js index dea85a6e8..93e1774f1 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -191,6 +191,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr .state('tabs', { url: '/tabs', abstract: true, + controller: 'tabsController', templateUrl: 'views/tabs.html' }) .state('tabs.home', { diff --git a/src/sass/views/address-book.scss b/src/sass/views/address-book.scss index 730a5571a..ec6167165 100644 --- a/src/sass/views/address-book.scss +++ b/src/sass/views/address-book.scss @@ -15,8 +15,6 @@ .item { color: #444; border-top: none; - padding-top: 1.5rem; - padding-bottom: 1.5rem; &:before { display: block; position: absolute;