diff options
author | Thomas Tanghus <thomas@tanghus.net> | 2012-06-21 22:02:17 +0200 |
---|---|---|
committer | Thomas Tanghus <thomas@tanghus.net> | 2012-06-21 22:02:17 +0200 |
commit | ad7154b344c29e597f366e0d448cc3d1659861b4 (patch) | |
tree | 7cf0240e02b6a2ca3dd705069bda3c369e8935a2 /apps/contacts | |
parent | b17bf59cedce3f6326af26c9d1522d57b1d15ada (diff) | |
download | nextcloud-server-ad7154b344c29e597f366e0d448cc3d1659861b4.tar.gz nextcloud-server-ad7154b344c29e597f366e0d448cc3d1659861b4.zip |
Fix being able to link directly to contact, that I broke in other commit.
Diffstat (limited to 'apps/contacts')
-rw-r--r-- | apps/contacts/js/contacts.js | 10 | ||||
-rw-r--r-- | apps/contacts/templates/index.php | 1 | ||||
-rw-r--r-- | apps/contacts/templates/part.contacts.php | 2 |
3 files changed, 8 insertions, 5 deletions
diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js index 8ab2a3fbb88..bd8535b4f60 100644 --- a/apps/contacts/js/contacts.js +++ b/apps/contacts/js/contacts.js @@ -256,12 +256,14 @@ Contacts={ } } else { newid = id; + bookid = bookid?bookid:$('#contacts li[data-id="'+newid+'"]').data('bookid'); } var localLoadContact = function(newid, bookid) { if($('.contacts li').length > 0) { - firstitem.addClass('active'); + $('#contacts li[data-id="'+newid+'"]').addClass('active'); $.getJSON(OC.filePath('contacts', 'ajax', 'contactdetails.php'),{'id':newid},function(jsondata){ if(jsondata.status == 'success'){ + $('#contacts h3[data-id="'+bookid+'"]').trigger('click'); Contacts.UI.Card.loadContact(jsondata.data, bookid); } else { OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error')); @@ -1503,7 +1505,7 @@ Contacts={ }, Contacts:{ // Reload the contacts list. - update:function(){ + update:function(id){ $.getJSON(OC.filePath('contacts', 'ajax', 'contacts.php'),{},function(jsondata){ if(jsondata.status == 'success'){ $('#contacts').html(jsondata.data.page).ready(function() { @@ -1518,7 +1520,7 @@ Contacts={ })}, 100); setTimeout(Contacts.UI.Contacts.lazyupdate, 500);*/ }); - Contacts.UI.Card.update(); + Contacts.UI.Card.update(id); } else{ OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error')); @@ -1707,5 +1709,5 @@ $(document).ready(function(){ $('#contacts_propertymenu_dropdown a').keydown(propertyMenuItem); Contacts.UI.loadHandlers(); - Contacts.UI.Contacts.update(); + Contacts.UI.Contacts.update(id); }); diff --git a/apps/contacts/templates/index.php b/apps/contacts/templates/index.php index d16356d4a56..1790ad4e30d 100644 --- a/apps/contacts/templates/index.php +++ b/apps/contacts/templates/index.php @@ -1,6 +1,7 @@ <script type='text/javascript'> 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> <div id="leftcontent"> diff --git a/apps/contacts/templates/part.contacts.php b/apps/contacts/templates/part.contacts.php index f0b14c8e5f2..c33c5832e82 100644 --- a/apps/contacts/templates/part.contacts.php +++ b/apps/contacts/templates/part.contacts.php @@ -3,7 +3,7 @@ foreach($_['books'] as $id => $addressbook) { echo '<h3 class="addressbook" data-id="'.$id.'">'.$addressbook['displayname'].'</h3>'; echo '<ul class="contacts hidden" data-id="'.$id.'">'; foreach($addressbook['contacts'] as $contact) { - echo '<li role="button" data-bookid="'.$contact['addressbookid'].'" data-id="'.$contact['id'].'"><a href="index.php?id='.$contact['id'].'" style="background: url('.link_to('contacts','thumbnail.php').'?id='.$contact['id'].') no-repeat scroll 0 0 transparent;">'.$contact['displayname'].'</a></li>'; + echo '<li role="button" data-bookid="'.$contact['addressbookid'].'" data-id="'.$contact['id'].'"><a href="'.link_to('contacts','index.php').'&id='.$contact['id'].'" style="background: url('.link_to('contacts','thumbnail.php').'?id='.$contact['id'].') no-repeat scroll 0 0 transparent;">'.$contact['displayname'].'</a></li>'; } echo '</ul>'; } |