]> source.dussan.org Git - nextcloud-server.git/commitdiff
Added next/previous methods to contacts list.
authorThomas Tanghus <thomas@tanghus.net>
Sat, 21 Jul 2012 19:58:09 +0000 (21:58 +0200)
committerThomas Tanghus <thomas@tanghus.net>
Sat, 21 Jul 2012 20:00:27 +0000 (22:00 +0200)
apps/contacts/js/contacts.js

index bf53753b14cc78258f593e7ed40bb8664610730f..a0ad77d0749e2936bbd7109f8fe0c9134f57641f 100644 (file)
@@ -1569,6 +1569,21 @@ Contacts={
                                }
                                return contact;
                        },
+                       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="'+Contacts.UI.Card.id+'"]');
+                               var newlistitem = reverse ? curlistitem.prev('li') : curlistitem.next('li');
+                               if(newlistitem) {
+                                       curlistitem.removeClass('active');
+                                       Contacts.UI.Card.update({
+                                               cid:newlistitem.data('id'),
+                                               aid:newlistitem.data('bookid')
+                                       });
+                               }
+                       },
+                       previous:function() {
+                               this.next(true);
+                       },
                        // Reload the contacts list.
                        update:function(params){
                                if(!params) { params = {}; }