add endless scroll to viewconnections module

This commit is contained in:
friendica 2015-04-06 22:36:46 -07:00
parent 3c05af6553
commit 5bc7c0e798
3 changed files with 37 additions and 8 deletions

View File

@ -28,6 +28,10 @@ function viewconnections_content(&$a) {
return; return;
} }
if(! $_REQUEST['aj'])
$_SESSION['return_url'] = $a->query_string;
$is_owner = ((local_channel() && local_channel() == $a->profile['uid']) ? true : false); $is_owner = ((local_channel() && local_channel() == $a->profile['uid']) ? true : false);
$abook_flags = ABOOK_FLAG_PENDING|ABOOK_FLAG_SELF; $abook_flags = ABOOK_FLAG_PENDING|ABOOK_FLAG_SELF;
@ -54,7 +58,7 @@ function viewconnections_content(&$a) {
intval($a->pager['start']) intval($a->pager['start'])
); );
if(! $r) { if((! $r) && (! $_REQUEST['aj'])) {
info( t('No connections.') . EOL ); info( t('No connections.') . EOL );
return $o; return $o;
} }
@ -81,13 +85,30 @@ function viewconnections_content(&$a) {
} }
$tpl = get_markup_template("viewcontact_template.tpl"); if($_REQUEST['aj']) {
$o .= replace_macros($tpl, array( if($contacts) {
'$title' => t('View Connections'), $o = replace_macros(get_markup_template('viewcontactsajax.tpl'),array(
'$contacts' => $contacts, '$contacts' => $contacts
'$paginate' => paginate($a), ));
)); }
else {
$o = '<div id="content-complete"></div>';
}
echo $o;
killme();
}
else {
$o .= "<script> var page_query = '" . $_GET['q'] . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
$tpl = get_markup_template("viewcontact_template.tpl");
$o .= replace_macros($tpl, array(
'$title' => t('View Connections'),
'$contacts' => $contacts,
// '$paginate' => paginate($a),
));
}
if(! $contacts)
$o .= '<div id="content-complete"></div>';
return $o; return $o;
} }

View File

@ -1,10 +1,15 @@
<div class="generic-content-wrapper generic-content-wrapper-styled"> <div class="generic-content-wrapper generic-content-wrapper-styled">
<h3>{{$title}}</h3> <h3>{{$title}}</h3>
<div id="connections-wrapper">
{{foreach $contacts as $contact}} {{foreach $contacts as $contact}}
{{include file="contact_template.tpl"}} {{include file="contact_template.tpl"}}
{{/foreach}} {{/foreach}}
<div id="page-end"></div>
</div>
<div id="view-contact-end"></div> <div id="view-contact-end"></div>
{{$paginate}} {{$paginate}}
</div> </div>
<script>$(document).ready(function() { loadingPage = false;});</script>
<div id="page-spinner"></div>

View File

@ -0,0 +1,3 @@
{{foreach $contacts as $contact}}
{{include file="contact_template.tpl"}}
{{/foreach}}