aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-09-10 23:08:24 -0700
committerfriendica <info@friendica.com>2014-09-10 23:08:24 -0700
commit4c8036f53064549cbfa797bba5c6462f5e36b072 (patch)
tree3fc37e355c9d7b95ea9db6d6cd538d9de43d0b66
parent10f6f355d43ee2fea61e1bae9ae257219f0196ee (diff)
downloadvolse-hubzilla-4c8036f53064549cbfa797bba5c6462f5e36b072.tar.gz
volse-hubzilla-4c8036f53064549cbfa797bba5c6462f5e36b072.tar.bz2
volse-hubzilla-4c8036f53064549cbfa797bba5c6462f5e36b072.zip
endless scroll on connections page
-rw-r--r--mod/connections.php53
-rwxr-xr-xview/tpl/connection_template.tpl2
-rwxr-xr-xview/tpl/connections.tpl7
3 files changed, 43 insertions, 19 deletions
diff --git a/mod/connections.php b/mod/connections.php
index 028889647..0dfcfebf1 100644
--- a/mod/connections.php
+++ b/mod/connections.php
@@ -369,7 +369,7 @@ function connections_content(&$a) {
if($rr['xchan_url']) {
$contacts[] = array(
'img_hover' => sprintf( t('%1$s [%2$s]'),$rr['xchan_name'],$rr['xchan_url']),
- 'edit_hover' => t('Edit contact'),
+ 'edit_hover' => t('Edit connection'),
'id' => $rr['abook_id'],
'alt_text' => $alt_text,
'dir_icon' => $dir_icon,
@@ -378,6 +378,7 @@ function connections_content(&$a) {
'username' => $rr['xchan_name'],
'classes' => (($rr['abook_flags'] & ABOOK_FLAG_ARCHIVED) ? 'archived' : ''),
'link' => z_root() . '/connedit/' . $rr['abook_id'],
+ 'edit' => t('Edit'),
'url' => chanlink_url($rr['xchan_url']),
'network' => network_to_name($rr['network']),
);
@@ -385,20 +386,40 @@ function connections_content(&$a) {
}
}
- $o .= replace_macros(get_markup_template('connections.tpl'),array(
- '$header' => t('Connections') . (($head) ? ' - ' . $head : ''),
- '$tabs' => $t,
- '$total' => $total,
- '$search' => $search_hdr,
- '$desc' => t('Search your connections'),
- '$finding' => (($searching) ? t('Finding: ') . "'" . $search . "'" : ""),
- '$submit' => t('Find'),
- '$edit' => t('Edit'),
- '$cmd' => $a->cmd,
- '$contacts' => $contacts,
- '$paginate' => paginate($a),
-
- ));
-
+
+ if($_REQUEST['aj']) {
+ if($contacts) {
+ $o = replace_macros(get_markup_template('contactsajax.tpl'),array(
+ '$contacts' => $contacts,
+ '$edit' => t('Edit'),
+ ));
+ }
+ 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>";
+ $o .= replace_macros(get_markup_template('connections.tpl'),array(
+ '$header' => t('Connections') . (($head) ? ' - ' . $head : ''),
+ '$tabs' => $t,
+ '$total' => $total,
+ '$search' => $search_hdr,
+ '$desc' => t('Search your connections'),
+ '$finding' => (($searching) ? t('Finding: ') . "'" . $search . "'" : ""),
+ '$submit' => t('Find'),
+ '$edit' => t('Edit'),
+ '$cmd' => $a->cmd,
+ '$contacts' => $contacts,
+ '$paginate' => paginate($a),
+
+ ));
+ }
+
+ if(! $contacts)
+ $o .= '<div id="content-complete"></div>';
+
return $o;
}
diff --git a/view/tpl/connection_template.tpl b/view/tpl/connection_template.tpl
index 44866c323..7aef7f2e1 100755
--- a/view/tpl/connection_template.tpl
+++ b/view/tpl/connection_template.tpl
@@ -4,6 +4,6 @@
</div>
<div class="contact-entry-photo-end" ></div>
<a href="{{$contact.url}}" title="{{$contact.img_hover}}" /><div class="contact-entry-name" id="contact-entry-name-{{$contact.id}}" >{{$contact.name}}</div></a>
- <div class="contact-entry-edit btn btn-default"><a href="{{$contact.link}}"><i class="icon-pencil connection-edit-icons"></i> {{$edit}}</a></div>
+ <div class="contact-entry-edit btn btn-default"><a href="{{$contact.link}}"><i class="icon-pencil connection-edit-icons"></i> {{$contact.edit}}</a></div>
<div class="contact-entry-end" ></div>
</div>
diff --git a/view/tpl/connections.tpl b/view/tpl/connections.tpl
index c69dcde50..1429576b1 100755
--- a/view/tpl/connections.tpl
+++ b/view/tpl/connections.tpl
@@ -13,13 +13,16 @@
{{$tabs}}
-
+<div id="connections-wrapper">
{{foreach $contacts as $contact}}
{{include file="connection_template.tpl"}}
{{/foreach}}
+<div id="page-end"></div>
+</div>
<div id="contact-edit-end"></div>
+<script>$(document).ready(function() { loadingPage = false;});</script>
+<div id="page-spinner"></div>
-{{$paginate}}