mirror of
https://github.com/moparisthebest/mail
synced 2024-12-24 08:18:48 -05:00
add keyboard shortcuts
This commit is contained in:
parent
d8176062f5
commit
62ce7bea60
@ -16,7 +16,7 @@
|
||||
<script src="require-config.js"></script>
|
||||
<script src="js/app.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<body key-shortcuts>
|
||||
|
||||
<div ng-view class="main-app-view"></div>
|
||||
|
||||
|
@ -13,7 +13,7 @@ require([
|
||||
], function(angular, LoginCtrl, MailListCtrl, ReadCtrl, WriteCtrl, NavigationCtrl) {
|
||||
'use strict';
|
||||
|
||||
var app = angular.module('mail', ['ngRoute', 'ngTouch', 'write', 'read']);
|
||||
var app = angular.module('mail', ['ngRoute', 'ngTouch', 'navigation', 'write', 'read']);
|
||||
|
||||
// set router paths
|
||||
app.config(function($routeProvider) {
|
||||
|
@ -73,7 +73,6 @@ define(function(require) {
|
||||
//
|
||||
|
||||
function initList() {
|
||||
firstSelect = true;
|
||||
updateStatus('Read cache ...');
|
||||
|
||||
// list messaged from local db
|
||||
@ -116,6 +115,7 @@ define(function(require) {
|
||||
}
|
||||
|
||||
function listLocalMessages(options, callback) {
|
||||
firstSelect = true;
|
||||
emailDao.listMessages(options, function(err, emails) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
|
@ -1,7 +1,8 @@
|
||||
define(function(require) {
|
||||
'use strict';
|
||||
|
||||
var appController = require('js/app-controller'),
|
||||
var angular = require('angular'),
|
||||
appController = require('js/app-controller'),
|
||||
emailDao;
|
||||
|
||||
var NavigationCtrl = function($scope) {
|
||||
@ -86,5 +87,27 @@ define(function(require) {
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Directives
|
||||
//
|
||||
|
||||
var ngModule = angular.module('navigation', []);
|
||||
ngModule.directive('keyShortcuts', function() {
|
||||
return function(scope, elm) {
|
||||
elm.bind('keydown', function(e) {
|
||||
if (e.keyCode === 78 && scope.$$childTail && scope.$$childTail.write) {
|
||||
// n
|
||||
e.preventDefault();
|
||||
return scope.$$childTail.write();
|
||||
|
||||
} else if (e.keyCode === 82 && scope.$$childTail && scope.$$childTail.write && scope.$$childTail.selected) {
|
||||
// r
|
||||
e.preventDefault();
|
||||
return scope.$$childTail.write(scope.$$childTail.selected);
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
return NavigationCtrl;
|
||||
});
|
Loading…
Reference in New Issue
Block a user