From 3059d7ece04cd3ae3c212ceac7dabf6c4bc5a27f Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Wed, 2 Jan 2013 04:10:07 +0100 Subject: [PATCH] Contacts: Start refactor single contact group change. --- js/contacts.js | 29 +++++++++++++++++++---------- templates/contacts.php | 3 +-- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/js/contacts.js b/js/contacts.js index 340b8b13..cdbf0c8b 100644 --- a/js/contacts.js +++ b/js/contacts.js @@ -225,6 +225,10 @@ OC.Contacts = OC.Contacts || {}; var q = ''; if(params.obj) { obj = params.obj; + if($(obj).is('select')) { + console.warn('Group adding will have to be refactored.'); + return; + } q = this.queryStringFor(obj); element = this.propertyTypeFor(obj); } else { @@ -569,16 +573,20 @@ OC.Contacts = OC.Contacts || {}; return $container.is('input') ? $container.val() : (function() { - var $elem = $container.find('textarea.value,input.value:not(:checkbox)'); - console.assert($elem.length > 0, 'Couldn\'t find value for ' + $container.data('element')); - if($elem.length === 1) { - return $elem.val(); - } else if($elem.length > 1) { - var retval = []; - $.each($elem, function(idx, e) { - retval.push($(e).val()); - }); - return retval; + if($container.is('select')) { + console.warn('Group adding will have to be refactored.'); + } else { + var $elem = $container.find('textarea.value,input.value:not(:checkbox)'); + console.assert($elem.length > 0, 'Couldn\'t find value for ' + $container.data('element')); + if($elem.length === 1) { + return $elem.val(); + } else if($elem.length > 1) { + var retval = []; + $.each($elem, function(idx, e) { + retval.push($(e).val()); + }); + return retval; + } } })(); }; @@ -760,6 +768,7 @@ OC.Contacts = OC.Contacts || {}; if(this.value === this.defaultValue) { return; } + console.log('change', this.defaultValue, this.value); self.saveProperty({obj:event.target}); }); diff --git a/templates/contacts.php b/templates/contacts.php index 3606e5b5..f685bd9b 100644 --- a/templates/contacts.php +++ b/templates/contacts.php @@ -2,7 +2,6 @@ @@ -173,7 +172,7 @@ - +