mirror of
https://github.com/owncloudarchive/contacts.git
synced 2024-12-01 13:24:10 +01:00
Contacts: Make group adding a little smoother
This commit is contained in:
parent
1f77d32438
commit
6c1ff13838
17
js/groups.js
17
js/groups.js
@ -388,7 +388,7 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
var name = this.nameById(groupid);
|
var name = this.nameById(groupid);
|
||||||
var contacts = $elem.data('contacts');
|
var contacts = $elem.data('contacts');
|
||||||
var self = this;
|
var self = this;
|
||||||
console.log('delete group', groupid, contacts);
|
console.log('delete group', $elem, groupid, contacts);
|
||||||
$.when(this.storage.deleteGroup(name)).then(function(response) {
|
$.when(this.storage.deleteGroup(name)).then(function(response) {
|
||||||
if (!response.error) {
|
if (!response.error) {
|
||||||
$.each(self.categories, function(idx, category) {
|
$.each(self.categories, function(idx, category) {
|
||||||
@ -445,11 +445,9 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
}
|
}
|
||||||
$input.prop('disabled', true);
|
$input.prop('disabled', true);
|
||||||
$elem.data('rawname', '');
|
$elem.data('rawname', '');
|
||||||
self.addGroup({name:name, element: $elem}, function(response) {
|
self.addGroup({name:name}, function(response) {
|
||||||
if(!response.error) {
|
if(!response.error) {
|
||||||
$elem.prepend(escapeHTML(response.name)).removeClass('editing').attr('data-id', response.id);
|
$elem.remove();
|
||||||
$input.next('.checked').remove();
|
|
||||||
$input.remove();
|
|
||||||
self.$editelem = null;
|
self.$editelem = null;
|
||||||
} else {
|
} else {
|
||||||
$input.prop('disabled', false);
|
$input.prop('disabled', false);
|
||||||
@ -555,9 +553,7 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
name = response.data.name;
|
name = response.data.name;
|
||||||
var id = response.data.id;
|
var id = response.data.id;
|
||||||
var tmpl = self.$groupListItemTemplate;
|
var tmpl = self.$groupListItemTemplate;
|
||||||
var $elem = params.element
|
var $elem = (tmpl).octemplate({
|
||||||
? params.element
|
|
||||||
: (tmpl).octemplate({
|
|
||||||
id: id,
|
id: id,
|
||||||
type: 'category',
|
type: 'category',
|
||||||
num: contacts.length,
|
num: contacts.length,
|
||||||
@ -577,7 +573,10 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if(!added) {
|
if(!added) {
|
||||||
$elem.insertAfter(self.$groupList.find('li.group[data-type="category"]').last());
|
var $insertAfter = self.$groupList.find('li.group[data-type="category"]').last()
|
||||||
|
|| self.$groupList.find('li.group[data-id="fav"]')
|
||||||
|
|| self.$groupList.find('li.group[data-id="all"]');
|
||||||
|
$elem.insertAfter($insertAfter);
|
||||||
}
|
}
|
||||||
self.selectGroup({element:$elem});
|
self.selectGroup({element:$elem});
|
||||||
$elem.tipsy({trigger:'manual', gravity:'w', fallback: t('contacts', 'You can drag groups to\narrange them as you like.')});
|
$elem.tipsy({trigger:'manual', gravity:'w', fallback: t('contacts', 'You can drag groups to\narrange them as you like.')});
|
||||||
|
Loading…
Reference in New Issue
Block a user