mirror of
https://github.com/owncloudarchive/contacts.git
synced 2024-12-01 13:24:10 +01:00
Merge pull request #988 from gvde/fix-preferred-contact-property
Fix preferred contact property
This commit is contained in:
commit
8a6cf9e053
@ -529,7 +529,7 @@ OC.Contacts = OC.Contacts || {};
|
||||
var parameters = self.parametersFor(obj);
|
||||
if(parameters.TYPE && parameters.TYPE.indexOf('PREF') !== -1) {
|
||||
parameters.PREF = 1;
|
||||
parameters.TYPE.splice(parameters.TYPE.indexOf('PREF', 1));
|
||||
parameters.TYPE.splice(parameters.TYPE.indexOf('PREF'), 1);
|
||||
}
|
||||
if(checksum && checksum !== 'new') {
|
||||
self.pushToUndo({
|
||||
@ -1446,13 +1446,13 @@ OC.Contacts = OC.Contacts || {};
|
||||
property.parameters.TYPE.push(property.label);
|
||||
meta.push(property.label);
|
||||
}
|
||||
var preferred = false;
|
||||
for(var param in property.parameters) {
|
||||
if(property.parameters.hasOwnProperty(param)) {
|
||||
//console.log('param', param);
|
||||
if(param.toUpperCase() === 'PREF') {
|
||||
var $cb = $property.find('input[type="checkbox"]');
|
||||
$cb.attr('checked', 'checked');
|
||||
meta.push($cb.attr('title'));
|
||||
preferred = true;
|
||||
continue;
|
||||
}
|
||||
else if(param.toUpperCase() === 'TYPE') {
|
||||
for(var etype in property.parameters[param]) {
|
||||
@ -1462,6 +1462,10 @@ OC.Contacts = OC.Contacts || {};
|
||||
if(typeof et !== 'string') {
|
||||
continue;
|
||||
}
|
||||
if(et.toUpperCase() === 'PREF') {
|
||||
preferred = true;
|
||||
continue;
|
||||
}
|
||||
$property.find('select.type option').each(function() {
|
||||
if($(this).val().toUpperCase() === et.toUpperCase()) {
|
||||
$(this).attr('selected', 'selected');
|
||||
@ -1481,6 +1485,11 @@ OC.Contacts = OC.Contacts || {};
|
||||
}
|
||||
}
|
||||
}
|
||||
if(preferred) {
|
||||
var $cb = $property.find('input[type="checkbox"]');
|
||||
$cb.attr('checked', 'checked');
|
||||
meta.push($cb.attr('title'));
|
||||
}
|
||||
var $meta = $property.find('.meta');
|
||||
if($meta.length) {
|
||||
$meta.html(meta.join('/'));
|
||||
|
Loading…
Reference in New Issue
Block a user