From 30738f48bf92bd7b30a724232277b9c867174ae1 Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 17 Dec 2010 02:56:26 +0000 Subject: fixed remaining javascript for riverdashboard - it's ready to be moved out to plugins git-svn-id: http://code.elgg.org/elgg/trunk@7654 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/riverdashboard/start.php | 1 + .../views/default/riverdashboard/js.php | 44 +++++++++++----------- .../views/default/riverdashboard/river/footer.php | 11 +++--- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/mod/riverdashboard/start.php b/mod/riverdashboard/start.php index e42bc6e01..cc0c4abac 100644 --- a/mod/riverdashboard/start.php +++ b/mod/riverdashboard/start.php @@ -363,6 +363,7 @@ function riverdashboard_view_river_item($item) { 'pict' => elgg_view('core/river/image', array('item' => $item)), 'body' => elgg_view('riverdashboard/river/body', array('item' => $item)), 'class' => 'elgg-river-item', + 'id' => "river-entity-{$object->guid}", ); return elgg_view('layout/objects/media', $vars); /* diff --git a/mod/riverdashboard/views/default/riverdashboard/js.php b/mod/riverdashboard/views/default/riverdashboard/js.php index 9286d33fe..4995799f1 100644 --- a/mod/riverdashboard/views/default/riverdashboard/js.php +++ b/mod/riverdashboard/views/default/riverdashboard/js.php @@ -4,14 +4,14 @@ elgg_slide_toggle(this, '.elgg-module', '.river-comment-form'); }); - $('.likes_user_list_button').click(function() { - var myParent = $(this).closest('.river-item'); + $('.likes-user-list-button').click(function() { + var myParent = $(this).closest('.elgg-river-item'); 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 riverItem = $(this).closest('.elgg-river-item'); + var guid = riverItem.attr('id').replace('river-entity-', ''); var params = { 'entity_guid': guid @@ -19,37 +19,37 @@ $(likesList).load('mod/riverdashboard/endpoint/get_likes.php', params, function(data) { // hide comments - myParent.find('.comments_container').animate({"height": "toggle", "opacity": "toggle"}, { duration: 400 }); + 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'); + 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'); + elgg_slide_toggle(this, '.elgg-river-item', '.likes-list'); }); } }); - $('.show_comments_button').click(function() { - var myParent = $(this).closest('.river-item'); - if (myParent.find('.comments_container').css('display') == 'none') { + $('.show-comments-button').click(function() { + var myParent = $(this).closest('.elgg-river-item'); + if (myParent.find('.comments-container').css('display') == 'none') { // hide likes myParent.find('.likes-list').animate({"height": "toggle", "opacity": "toggle"}, { duration: 400 }); // change selected tab - myParent.find('.show_comments_button').removeClass('off'); - myParent.find('.likes_user_list_button').addClass('off'); + myParent.find('.show-comments-button').removeClass('off'); + myParent.find('.likes-user-list-button').addClass('off'); // show users that liked object - elgg_slide_toggle(this, '.river-item', '.comments_container'); + elgg_slide_toggle(this, '.elgg-river-item', '.comments-container'); } }); // grab more comments - $('.river-more-comments.show_more_button').click(function() { - var showLess = $(this).next('.show_less_button'); + $('.river-more-comments.show-more-button').click(function() { + var showLess = $(this).next('.show-less-button'); var showMore = $(this); - var riverItem = $(this).closest('.river-item'); + var riverItem = $(this).closest('.elgg-river-item'); - var guid = riverItem.attr('id').replace('river_entity_', ''); - var commentsList = riverItem.find('.comments_list'); + var guid = riverItem.attr('id').replace('river-entity-', ''); + var commentsList = riverItem.find('.comments-list'); var numComments = riverItem.find('.river-comment').length; var params = { @@ -67,10 +67,10 @@ }); // hide more comments - $('.river-more-comments.show_less_button').click(function() { + $('.river-more-comments.show-less-button').click(function() { var showLess = $(this); - var showMore = $(this).prev('.show_more_button'); - var riverItem = $(this).closest('.river-item'); + var showMore = $(this).prev('.show-more-button'); + var riverItem = $(this).closest('.elgg-river-item'); // want to keep the latest 3 comments var comments = riverItem.find('.river-comment') comments = $.makeArray(comments).reverse(); diff --git a/mod/riverdashboard/views/default/riverdashboard/river/footer.php b/mod/riverdashboard/views/default/riverdashboard/river/footer.php index 82aae00c2..6df58b5da 100644 --- a/mod/riverdashboard/views/default/riverdashboard/river/footer.php +++ b/mod/riverdashboard/views/default/riverdashboard/river/footer.php @@ -40,7 +40,7 @@ if ($comments){ $counter = 0; echo "
"; - echo "" . elgg_echo('comments') . ''; + echo "" . elgg_echo('comments') . ''; if ($likes_count != 0) { echo elgg_view('forms/likes/display', array('entity' => $object)); @@ -56,15 +56,15 @@ if ($comments){ echo ""; } - echo "
"; + echo "
"; // display appropriate comment link if ($more_comments_count > 0) { - echo "" . + echo "" . elgg_echo('riverdashboard:n_more_comments', array($more_comments_count)) . ''; - echo "" . elgg_echo('riverdashboard:show_less') . ''; + echo "" . elgg_echo('riverdashboard:show_less') . ''; } - echo "
"; + echo "
"; foreach ($comments as $comment) { //get the comment owner $comment_owner = get_user($comment->owner_guid); @@ -128,4 +128,3 @@ if ($comments){ echo "
"; } } -?> -- cgit v1.2.3