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

Contacts: Start refactor single contact group change.

This commit is contained in:
Thomas Tanghus 2013-01-02 04:10:07 +01:00
parent c9af11328b
commit 3059d7ece0
2 changed files with 20 additions and 12 deletions

View File

@ -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});
});

View File

@ -2,7 +2,6 @@
<script type='text/javascript'>
var is_indexed = <?php echo $_['is_indexed'] == 'yes' ? 'true' : 'false'; ?>;
var totalurl = '<?php echo OCP\Util::linkToRemote('carddav'); ?>addressbooks';
var categories = <?php echo json_encode($_['categories']); ?>;
var id = '<?php echo $_['id']; ?>';
var lang = '<?php echo OCP\Config::getUserValue(OCP\USER::getUser(), 'core', 'lang', 'en'); ?>';
</script>
@ -173,7 +172,7 @@
</ul>
<a class="favorite action {favorite}"></a>
</div>
<select id="contactgroups" title="<?php echo $l->t('Select groups'); ?>" multiple></select>
<select id="contactgroups" class="value propertycontainer" data-element="categories" title="<?php echo $l->t('Select groups'); ?>" multiple></select>
<div class="singleproperties">
<input data-element="fn" class="fullname value propertycontainer" type="text" name="value" value="{name}" required />
<a class="action edit"></a>