From a49669bd2cf464d6ad0f325e05bfc3a5d899d717 Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Fri, 8 Nov 2013 23:53:33 +0100 Subject: [PATCH] refactor account --- src/js/controller/account.js | 7 +++++++ src/js/controller/navigation.js | 13 ++----------- src/tpl/account.html | 2 +- src/tpl/desktop.html | 2 +- src/tpl/navigation.html | 2 +- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/js/controller/account.js b/src/js/controller/account.js index 0c456fb..78ffae4 100644 --- a/src/js/controller/account.js +++ b/src/js/controller/account.js @@ -12,6 +12,13 @@ define(function(require) { var AccountCtrl = function($scope) { emailDao = appController._emailDao; + $scope.state.account = { + open: false, + toggle: function(to) { + this.open = to; + } + }; + // // scope variables // diff --git a/src/js/controller/navigation.js b/src/js/controller/navigation.js index 0b17d3c..e8eecba 100644 --- a/src/js/controller/navigation.js +++ b/src/js/controller/navigation.js @@ -43,13 +43,6 @@ define(function(require) { $scope.state.nav.toggle(false); }; - $scope.openAccount = function() { - $scope.accountOpen = true; - }; - $scope.closeAccount = function() { - $scope.accountOpen = false; - }; - // // Outbox checker // @@ -216,8 +209,6 @@ define(function(require) { ngModule.directive('keyShortcuts', function() { return function(scope, elm) { elm.bind('keydown', function(e) { - var cs = scope.$$childTail; - // global state is not yet set, ignore keybaord shortcuts if (!scope.state) { return; @@ -238,10 +229,10 @@ define(function(require) { e.preventDefault(); scope.state.writer.close(); - } else if (e.keyCode === 27 && cs.accountOpen) { + } else if (e.keyCode === 27 && scope.state.account.open) { // escape -> close account view e.preventDefault(); - cs.closeAccount(); + scope.state.account.toggle(false); } else if (e.keyCode === 83 && scope.state.writer && !scope.state.writer.open && scope.state.mailList.synchronize) { // s -> sync folder diff --git a/src/tpl/account.html b/src/tpl/account.html index 9deacaf..34cb5c4 100644 --- a/src/tpl/account.html +++ b/src/tpl/account.html @@ -1,7 +1,7 @@