mirror of
https://github.com/owncloudarchive/contacts.git
synced 2024-12-01 13:24:10 +01:00
Some fixes for keyboard shortcuts.
This commit is contained in:
parent
9553dc0da3
commit
1d094c2631
@ -1522,8 +1522,7 @@ OC.Contacts={
|
||||
return false;
|
||||
},
|
||||
next:function(reverse) {
|
||||
// TODO: Check if we're last-child/first-child and jump to next/prev address book.
|
||||
var curlistitem = $('#contacts li[data-id="'+OC.Contacts.Card.id+'"]');
|
||||
var curlistitem = this.getContact(OC.Contacts.Card.id);
|
||||
var newlistitem = reverse ? curlistitem.prev('li') : curlistitem.next('li');
|
||||
if(newlistitem) {
|
||||
curlistitem.removeClass('active');
|
||||
@ -1536,6 +1535,30 @@ OC.Contacts={
|
||||
previous:function() {
|
||||
this.next(true);
|
||||
},
|
||||
nextAddressbook:function(reverse) {
|
||||
console.log('nextAddressbook', reverse);
|
||||
var curlistitem = this.getContact(OC.Contacts.Card.id);
|
||||
var parent = curlistitem.parent('ul');
|
||||
var newparent = reverse
|
||||
? parent.prevAll('ul').first()
|
||||
: parent.nextAll('ul').first();
|
||||
if(newparent) {
|
||||
newlistitem = newparent.find('li:first-child');
|
||||
if(newlistitem) {
|
||||
parent.slideUp().prev('h3').removeClass('active');
|
||||
newparent.slideDown().prev('h3').addClass('active');
|
||||
curlistitem.removeClass('active');
|
||||
OC.Contacts.Card.update({
|
||||
cid:newlistitem.data('id'),
|
||||
aid:newlistitem.data('bookid')
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
previousAddressbook:function() {
|
||||
console.log('previousAddressbook');
|
||||
this.nextAddressbook(true);
|
||||
},
|
||||
// Reload the contacts list.
|
||||
update:function(params){
|
||||
if(!params) { params = {}; }
|
||||
@ -1677,10 +1700,10 @@ $(document).ready(function(){
|
||||
|| !OC.Contacts.Card.id) {
|
||||
return;
|
||||
}
|
||||
console.log(event.which + ' ' + event.target.nodeName);
|
||||
//console.log(event.which + ' ' + event.target.nodeName);
|
||||
/**
|
||||
* To add:
|
||||
* (Shift)n/p: next/prev addressbook
|
||||
* Shift-a: add addressbook
|
||||
* u (85): hide/show leftcontent
|
||||
* f (70): add field
|
||||
*/
|
||||
@ -1688,18 +1711,13 @@ $(document).ready(function(){
|
||||
case 27: // Esc
|
||||
ninjahelp.hide();
|
||||
break;
|
||||
case 46:
|
||||
case 46: // Delete
|
||||
if(event.shiftKey) {
|
||||
OC.Contacts.Card.delayedDelete();
|
||||
}
|
||||
break;
|
||||
case 32: // space
|
||||
if(event.shiftKey) {
|
||||
OC.Contacts.Contacts.previous();
|
||||
break;
|
||||
}
|
||||
case 40: // down
|
||||
case 75: // k
|
||||
case 74: // j
|
||||
OC.Contacts.Contacts.next();
|
||||
break;
|
||||
case 65: // a
|
||||
@ -1711,23 +1729,24 @@ $(document).ready(function(){
|
||||
OC.Contacts.Card.editNew();
|
||||
break;
|
||||
case 38: // up
|
||||
case 74: // j
|
||||
case 75: // k
|
||||
OC.Contacts.Contacts.previous();
|
||||
break;
|
||||
case 34: // PageDown
|
||||
case 78: // n
|
||||
// next addressbook
|
||||
OC.Contacts.notImplemented();
|
||||
OC.Contacts.Contacts.nextAddressbook();
|
||||
break;
|
||||
case 13: // Enter
|
||||
case 79: // o
|
||||
var aid = $('#contacts h3.active').first().data('id');
|
||||
if(aid) {
|
||||
$('#contacts ul[data-id="'+aid+'"]').slideToggle(300);
|
||||
}
|
||||
break;
|
||||
case 33: // PageUp
|
||||
case 80: // p
|
||||
// prev addressbook
|
||||
OC.Contacts.notImplemented();
|
||||
OC.Contacts.Contacts.previousAddressbook();
|
||||
break;
|
||||
case 82: // r
|
||||
OC.Contacts.Contacts.update({cid:OC.Contacts.Card.id});
|
||||
|
@ -38,14 +38,16 @@
|
||||
<div class="help-section">
|
||||
<h3><?php echo $l->t('Navigation'); ?></h3>
|
||||
<dl>
|
||||
<dt>j/Down/Space</dt>
|
||||
<dt>j/Down</dt>
|
||||
<dd><?php echo $l->t('Next contact in list'); ?></dd>
|
||||
<dt>k/Up/Shift-Space</dt>
|
||||
<dt>k/Up</dt>
|
||||
<dd><?php echo $l->t('Previous contact in list'); ?></dd>
|
||||
<dt>o/Enter</dt>
|
||||
<dt>o</dt>
|
||||
<dd><?php echo $l->t('Expand/collapse current addressbook'); ?></dd>
|
||||
<dt>n/p</dt>
|
||||
<dd><?php echo $l->t('Next/previous addressbook'); ?></dd>
|
||||
<dt>n/PageDown</dt>
|
||||
<dd><?php echo $l->t('Next addressbook'); ?></dd>
|
||||
<dt>p/PageUp</dt>
|
||||
<dd><?php echo $l->t('Previous addressbook'); ?></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="help-section">
|
||||
@ -55,8 +57,8 @@
|
||||
<dd><?php echo $l->t('Refresh contacts list'); ?></dd>
|
||||
<dt>a</dt>
|
||||
<dd><?php echo $l->t('Add new contact'); ?></dd>
|
||||
<dt>Shift-a</dt>
|
||||
<dd><?php echo $l->t('Add new addressbook'); ?></dd>
|
||||
<!-- dt>Shift-a</dt>
|
||||
<dd><?php echo $l->t('Add new addressbook'); ?></dd -->
|
||||
<dt>Shift-Delete</dt>
|
||||
<dd><?php echo $l->t('Delete current contact'); ?></dd>
|
||||
</dl>
|
||||
|
Loading…
Reference in New Issue
Block a user