aboutsummaryrefslogtreecommitdiff
path: root/mod/riverdashboard/views
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-08 21:37:14 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-08 21:37:14 +0000
commit375a3021d73e629883830c1c9aa6fd216d59e6d3 (patch)
treebd8b237d877ee383125a7a68b72d1b190287e989 /mod/riverdashboard/views
parentb6ec22721c68bd12db74c0bb9e55482e17f4e58e (diff)
downloadelgg-375a3021d73e629883830c1c9aa6fd216d59e6d3.tar.gz
elgg-375a3021d73e629883830c1c9aa6fd216d59e6d3.tar.bz2
Ajaxified likes view on activity stream.
git-svn-id: http://code.elgg.org/elgg/trunk@6409 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/riverdashboard/views')
-rw-r--r--mod/riverdashboard/views/default/river/item/wrapper.php7
-rw-r--r--mod/riverdashboard/views/default/riverdashboard/js.php29
2 files changed, 24 insertions, 12 deletions
diff --git a/mod/riverdashboard/views/default/river/item/wrapper.php b/mod/riverdashboard/views/default/river/item/wrapper.php
index a2bc10c54..e50a3fe3f 100644
--- a/mod/riverdashboard/views/default/river/item/wrapper.php
+++ b/mod/riverdashboard/views/default/river/item/wrapper.php
@@ -69,9 +69,8 @@ if ($comments){
if ($likes_count != 0) {
//show the users who liked the object
- echo "<div class='likes_list hidden'>";
- echo list_annotations($object->getGUID(), 'likes', 99);
- echo "</div>";
+ // this is loaded via ajax to avoid pounding the server with avatar requests.
+ echo "<div class='likes_list hidden'></div>";
}
echo "<div class=\"comments_container\">";
@@ -148,4 +147,4 @@ if ($comments){
}
?>
</div>
-</div> \ No newline at end of file
+</div>
diff --git a/mod/riverdashboard/views/default/riverdashboard/js.php b/mod/riverdashboard/views/default/riverdashboard/js.php
index 37de3ad04..edb041e4f 100644
--- a/mod/riverdashboard/views/default/riverdashboard/js.php
+++ b/mod/riverdashboard/views/default/riverdashboard/js.php
@@ -6,14 +6,27 @@
$('.likes_user_list_button').click(function() {
var myParent = $(this).closest('.river_item');
- if (myParent.find('.likes_list').css('display') == 'none') {
- // hide comments
- myParent.find('.comments_container').animate({"height": "toggle", "opacity": "toggle"}, { duration: 400 });
- // change selected tab
- myParent.find('.show_comments_button').addClass('off');
- myParent.find('.likes_user_list_button').removeClass('off');
- // show users that liked object
- elgg_slide_toggle(this, '.river_item', '.likes_list');
+ var likesList = myParent.find('.likes_list');
+
+ if (likesList.css('display') == 'none') {
+ // pull in likes via ajax to save on loading many avatars
+ var riverItem = $(this).closest('.river_item');
+ var guid = riverItem.attr('id').replace('river_entity_', '');
+
+ var params = {
+ 'entity_guid': guid
+ }
+
+ $(likesList).load('<?php echo $vars['url'];?>mod/riverdashboard/endpoint/get_likes.php', params, function(data) {
+ console.log(data);
+ // hide comments
+ myParent.find('.comments_container').animate({"height": "toggle", "opacity": "toggle"}, { duration: 400 });
+ // change selected tab
+ myParent.find('.show_comments_button').addClass('off');
+ myParent.find('.likes_user_list_button').removeClass('off');
+ // show users that liked object
+ elgg_slide_toggle(this, '.river_item', '.likes_list');
+ });
}
});