1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-11-29 11:24:11 +01:00

Add meta group "Ungrouped". Refs #28

This commit is contained in:
Thomas Tanghus 2013-05-12 21:59:24 +02:00
parent 5940855319
commit 3f3d701322
3 changed files with 22 additions and 0 deletions

View File

@ -619,6 +619,8 @@ OC.Contacts = OC.Contacts || {
self.contacts.showContacts(result.contacts); self.contacts.showContacts(result.contacts);
} else if(result.type === 'shared') { } else if(result.type === 'shared') {
self.contacts.showFromAddressbook(self.currentgroup, true, true); self.contacts.showFromAddressbook(self.currentgroup, true, true);
} else if(result.type === 'uncategorized') {
self.contacts.showUncategorized();
} else { } else {
self.contacts.showContacts(self.currentgroup); self.contacts.showContacts(self.currentgroup);
} }

View File

@ -1786,6 +1786,23 @@ OC.Contacts = OC.Contacts || {};
} }
}; };
/**
* Show only uncategorized contacts.
* @param int aid. Addressbook id.
* @param boolean show. Whether to show or hide.
* @param boolean hideothers. Used when showing shared addressbook as a group.
*/
ContactList.prototype.showUncategorized = function() {
console.log('ContactList.showUncategorized');
for(var contact in this.contacts) {
if(this.contacts[contact].getPreferredValue('CATEGORIES', []).length > 0) {
this.contacts[contact].getListItemElement().show();
} else {
this.contacts[contact].getListItemElement().hide();
}
}
};
/** /**
* Show/hide contacts belonging to shared addressbooks. * Show/hide contacts belonging to shared addressbooks.
* @param boolean show. Whether to show or hide. * @param boolean show. Whether to show or hide.

View File

@ -734,6 +734,9 @@ OC.Contacts = OC.Contacts || {};
$elem.data('id', shared.id); $elem.data('id', shared.id);
$elem.appendTo($groupList); $elem.appendTo($groupList);
}); });
if(!self.findById('uncategorized').length) {
tmpl.octemplate({id: 'uncategorized', type: 'uncategorized', num: '', name: t('contacts', 'Not grouped')}).appendTo($groupList);
}
$groupList.sortable({ $groupList.sortable({
items: 'li[data-type="category"]', items: 'li[data-type="category"]',
stop: function() { stop: function() {