1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-23 01:12:19 -05:00

refactor account

This commit is contained in:
Tankred Hase 2013-11-08 23:53:33 +01:00
parent c5aadc9c01
commit a49669bd2c
5 changed files with 12 additions and 14 deletions

View File

@ -12,6 +12,13 @@ define(function(require) {
var AccountCtrl = function($scope) { var AccountCtrl = function($scope) {
emailDao = appController._emailDao; emailDao = appController._emailDao;
$scope.state.account = {
open: false,
toggle: function(to) {
this.open = to;
}
};
// //
// scope variables // scope variables
// //

View File

@ -43,13 +43,6 @@ define(function(require) {
$scope.state.nav.toggle(false); $scope.state.nav.toggle(false);
}; };
$scope.openAccount = function() {
$scope.accountOpen = true;
};
$scope.closeAccount = function() {
$scope.accountOpen = false;
};
// //
// Outbox checker // Outbox checker
// //
@ -216,8 +209,6 @@ define(function(require) {
ngModule.directive('keyShortcuts', function() { ngModule.directive('keyShortcuts', function() {
return function(scope, elm) { return function(scope, elm) {
elm.bind('keydown', function(e) { elm.bind('keydown', function(e) {
var cs = scope.$$childTail;
// global state is not yet set, ignore keybaord shortcuts // global state is not yet set, ignore keybaord shortcuts
if (!scope.state) { if (!scope.state) {
return; return;
@ -238,10 +229,10 @@ define(function(require) {
e.preventDefault(); e.preventDefault();
scope.state.writer.close(); scope.state.writer.close();
} else if (e.keyCode === 27 && cs.accountOpen) { } else if (e.keyCode === 27 && scope.state.account.open) {
// escape -> close account view // escape -> close account view
e.preventDefault(); 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) { } else if (e.keyCode === 83 && scope.state.writer && !scope.state.writer.open && scope.state.mailList.synchronize) {
// s -> sync folder // s -> sync folder

View File

@ -1,7 +1,7 @@
<div class="lightbox-body" ng-controller="AccountCtrl"> <div class="lightbox-body" ng-controller="AccountCtrl">
<header> <header>
<h2>Account</h2> <h2>Account</h2>
<button class="close" ng-click="closeAccount()" data-action="lightbox-close">&#xe007;</button> <button class="close" ng-click="state.account.toggle(false)" data-action="lightbox-close">&#xe007;</button>
</header> </header>
<div class="content"> <div class="content">

View File

@ -22,7 +22,7 @@
<div class="lightbox-overlay" ng-class="{'show': state.writer.open}"> <div class="lightbox-overlay" ng-class="{'show': state.writer.open}">
<div class="lightbox lightbox-effect" ng-include="'tpl/write.html'"></div> <div class="lightbox lightbox-effect" ng-include="'tpl/write.html'"></div>
</div> </div>
<div class="lightbox-overlay" ng-class="{'show': accountOpen}"> <div class="lightbox-overlay" ng-class="{'show': state.account.open}">
<div class="lightbox lightbox-effect" ng-include="'tpl/account.html'"></div> <div class="lightbox lightbox-effect" ng-include="'tpl/account.html'"></div>
</div> </div>
<div class="lightbox-overlay" ng-class="{'show': state.dialog.open}"> <div class="lightbox-overlay" ng-class="{'show': state.dialog.open}">

View File

@ -13,7 +13,7 @@
</ul> </ul>
<ul class="nav-secondary"> <ul class="nav-secondary">
<li><a href="#" ng-click="openAccount(); $event.preventDefault()">Account</a></li> <li><a href="#" ng-click="state.account.toggle(true); $event.preventDefault()">Account</a></li>
<li><a href="#">About whiteout.io</a></li> <li><a href="#">About whiteout.io</a></li>
<li><a href="#">Help</a></li> <li><a href="#">Help</a></li>
</ul> </ul>