Insert new contacts alphabetically correct in the list.
Added some tipsys to the editor.
This commit is contained in:
parent
978a08ab1c
commit
ac63afbd95
|
@ -4,7 +4,7 @@
|
|||
#contacts_details_name { font-weight:bold;font-size:1.1em;margin-left:25%;}
|
||||
#contacts_details_photo { margin:.5em 0em .5em 25%; }
|
||||
|
||||
#contacts_deletecard {position:absolute;top:15px;right:0;}
|
||||
#contacts_deletecard {position:absolute;top:15px;right:15px;}
|
||||
#contacts_details_list { list-style:none; }
|
||||
#contacts_details_list li { overflow:visible; }
|
||||
#contacts_details_list li p.contacts_property_name { width:25%; float:left;text-align:right;padding-right:0.3em;color:#666; }
|
||||
|
|
|
@ -237,6 +237,9 @@ $(document).ready(function(){
|
|||
return false;
|
||||
});
|
||||
|
||||
/**
|
||||
* Open blank form to add new contact.
|
||||
*/
|
||||
$('#contacts_newcontact').click(function(){
|
||||
$.getJSON('ajax/showaddcard.php',{},function(jsondata){
|
||||
if(jsondata.status == 'success'){
|
||||
|
@ -251,13 +254,27 @@ $(document).ready(function(){
|
|||
return false;
|
||||
});
|
||||
|
||||
/**
|
||||
* Add and insert a new contact into the list.
|
||||
*/
|
||||
$('#contacts_addcardform input[type="submit"]').live('click',function(){
|
||||
$.post('ajax/addcard.php',$('#contacts_addcardform').serialize(),function(jsondata){
|
||||
if(jsondata.status == 'success'){
|
||||
$('#rightcontent').data('id',jsondata.data.id);
|
||||
$('#rightcontent').html(jsondata.data.page);
|
||||
$('#leftcontent .active').removeClass('active');
|
||||
$('#leftcontent ul').append('<li data-id="'+jsondata.data.id+'" class="active"><a href="index.php?id='+jsondata.data.id+'">'+jsondata.data.name+'</a></li>');
|
||||
var item = '<li data-id="'+jsondata.data.id+'" class="active"><a href="index.php?id='+jsondata.data.id+'" style="background: url(thumbnail.php?id='+jsondata.data.id+') no-repeat scroll 0% 0% transparent;">'+jsondata.data.name+'</a></li>';
|
||||
var added = false;
|
||||
$('#leftcontent ul li').each(function(){
|
||||
if ($(this).text().toLowerCase() > jsondata.data.name.toLowerCase()) {
|
||||
$(this).before(item).fadeIn('fast');
|
||||
added = true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if(!added) {
|
||||
$('#leftcontent ul').append(item);
|
||||
}
|
||||
}
|
||||
else{
|
||||
alert(jsondata.data.message);
|
||||
|
@ -265,7 +282,6 @@ $(document).ready(function(){
|
|||
}, 'json');
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.contacts_property [data-use="edit"]').live('click',function(){
|
||||
var id = $('#rightcontent').data('id');
|
||||
var checksum = $(this).parents('.contacts_property').first().data('checksum');
|
||||
|
@ -338,4 +354,7 @@ $(document).ready(function(){
|
|||
// element has gone out of viewport
|
||||
}
|
||||
});
|
||||
|
||||
$('.action').tipsy();
|
||||
$('.button').tipsy();
|
||||
});
|
||||
|
|
|
@ -86,3 +86,8 @@
|
|||
</li>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
<script language="Javascript">
|
||||
/* Re-tipsify ;-)*/
|
||||
$('.action').tipsy();
|
||||
$('.button').tipsy();
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue