diff options
Diffstat (limited to 'mod/likes/views/default')
| -rw-r--r-- | mod/likes/views/default/annotation/likes.php | 11 | ||||
| -rw-r--r-- | mod/likes/views/default/likes/button.php (renamed from mod/likes/views/default/likes/display.php) | 32 | ||||
| -rw-r--r-- | mod/likes/views/default/likes/count.php | 36 | ||||
| -rw-r--r-- | mod/likes/views/default/likes/css.php | 6 | ||||
| -rw-r--r-- | mod/likes/views/default/likes/js.php | 26 | ||||
| -rw-r--r-- | mod/likes/views/default/river/annotation/likes/create.php | 26 |
6 files changed, 76 insertions, 61 deletions
diff --git a/mod/likes/views/default/annotation/likes.php b/mod/likes/views/default/annotation/likes.php index e1ae20818..2b5acc520 100644 --- a/mod/likes/views/default/annotation/likes.php +++ b/mod/likes/views/default/annotation/likes.php @@ -20,6 +20,7 @@ $user_icon = elgg_view_entity_icon($user, 'tiny'); $user_link = elgg_view('output/url', array( 'href' => $user->getURL(), 'text' => $user->name, + 'is_trusted' => true, )); $likes_string = elgg_echo('likes:this'); @@ -28,11 +29,11 @@ $friendlytime = elgg_view_friendly_time($like->time_created); if ($like->canEdit()) { $delete_button = elgg_view("output/confirmlink",array( - 'href' => "action/likes/delete?annotation_id={$like->id}", - 'text' => "<span class=\"elgg-icon elgg-icon-delete right\"></span>", - 'confirm' => elgg_echo('deleteconfirm'), - 'text_encode' => false, - )); + 'href' => "action/likes/delete?id={$like->id}", + 'text' => "<span class=\"elgg-icon elgg-icon-delete float-alt\"></span>", + 'confirm' => elgg_echo('likes:delete:confirm'), + 'encode_text' => false, + )); } $body = <<<HTML diff --git a/mod/likes/views/default/likes/display.php b/mod/likes/views/default/likes/button.php index 2dc50ddd0..bc7c8fd8a 100644 --- a/mod/likes/views/default/likes/display.php +++ b/mod/likes/views/default/likes/button.php @@ -1,6 +1,6 @@ <?php /** - * Elgg likes display + * Elgg likes button * * @uses $vars['entity'] */ @@ -20,46 +20,20 @@ if (elgg_is_logged_in() && $vars['entity']->canAnnotate(0, 'likes')) { 'text' => elgg_view_icon('thumbs-up'), 'title' => elgg_echo('likes:likethis'), 'is_action' => true, + 'is_trusted' => true, ); $likes_button = elgg_view('output/url', $params); } else { - $options = array( - 'guid' => $guid, - 'annotation_name' => 'likes', - 'owner_guid' => elgg_get_logged_in_user_guid() - ); $url = elgg_get_site_url() . "action/likes/delete?guid={$guid}"; $params = array( 'href' => $url, 'text' => elgg_view_icon('thumbs-up-alt'), 'title' => elgg_echo('likes:remove'), 'is_action' => true, + 'is_trusted' => true, ); $likes_button = elgg_view('output/url', $params); } } echo $likes_button; - -$list = ''; -$num_of_likes = likes_count($vars['entity']); - -if ($num_of_likes) { - // display the number of likes - if ($num_of_likes == 1) { - $likes_string = elgg_echo('likes:userlikedthis', array($num_of_likes)); - } else { - $likes_string = elgg_echo('likes:userslikedthis', array($num_of_likes)); - } - $params = array( - 'text' => $likes_string, - 'title' => elgg_echo('likes:see'), - 'rel' => 'popup', - 'href' => "#likes-$guid" - ); - $list = elgg_view('output/url', $params); - $list .= "<div class='elgg-module elgg-module-popup elgg-likes-list hidden clearfix' id='likes-$guid'>"; - $list .= elgg_list_annotations(array('guid' => $guid, 'annotation_name' => 'likes', 'limit' => 99)); - $list .= "</div>"; - echo $list; -} diff --git a/mod/likes/views/default/likes/count.php b/mod/likes/views/default/likes/count.php new file mode 100644 index 000000000..071a069bd --- /dev/null +++ b/mod/likes/views/default/likes/count.php @@ -0,0 +1,36 @@ +<?php +/** + * Count of who has liked something + * + * @uses $vars['entity'] + */ + + +$list = ''; +$num_of_likes = likes_count($vars['entity']); +$guid = $vars['entity']->getGUID(); + +if ($num_of_likes) { + // display the number of likes + if ($num_of_likes == 1) { + $likes_string = elgg_echo('likes:userlikedthis', array($num_of_likes)); + } else { + $likes_string = elgg_echo('likes:userslikedthis', array($num_of_likes)); + } + $params = array( + 'text' => $likes_string, + 'title' => elgg_echo('likes:see'), + 'rel' => 'popup', + 'href' => "#likes-$guid" + ); + $list = elgg_view('output/url', $params); + $list .= "<div class='elgg-module elgg-module-popup elgg-likes hidden clearfix' id='likes-$guid'>"; + $list .= elgg_list_annotations(array( + 'guid' => $guid, + 'annotation_name' => 'likes', + 'limit' => 99, + 'list_class' => 'elgg-list-likes' + )); + $list .= "</div>"; + echo $list; +} diff --git a/mod/likes/views/default/likes/css.php b/mod/likes/views/default/likes/css.php index cb0334b7c..1ec07b366 100644 --- a/mod/likes/views/default/likes/css.php +++ b/mod/likes/views/default/likes/css.php @@ -7,7 +7,11 @@ /* *************************************** Likes *************************************** */ -.elgg-likes-list { +.elgg-likes { width: 345px; position: absolute; } + +.elgg-menu .elgg-menu-item-likes-count { + margin-left: 3px; +} diff --git a/mod/likes/views/default/likes/js.php b/mod/likes/views/default/likes/js.php new file mode 100644 index 000000000..f701ebedf --- /dev/null +++ b/mod/likes/views/default/likes/js.php @@ -0,0 +1,26 @@ +<?php +/** + * Likes JavaScript extension for elgg.js + */ +?> + +/** + * Repositions the likes popup + * + * @param {String} hook 'getOptions' + * @param {String} type 'ui.popup' + * @param {Object} params An array of info about the target and source. + * @param {Object} options Options to pass to + * + * @return {Object} + */ +elgg.ui.likesPopupHandler = function(hook, type, params, options) { + if (params.target.hasClass('elgg-likes')) { + options.my = 'right bottom'; + options.at = 'left top'; + return options; + } + return null; +}; + +elgg.register_hook_handler('getOptions', 'ui.popup', elgg.ui.likesPopupHandler);
\ No newline at end of file diff --git a/mod/likes/views/default/river/annotation/likes/create.php b/mod/likes/views/default/river/annotation/likes/create.php deleted file mode 100644 index 463fe5049..000000000 --- a/mod/likes/views/default/river/annotation/likes/create.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php -/** - * Likes river view - * - * @todo not finished - */ - -$object = $vars['item']->getObjectEntity(); -$comment = $vars['item']->getAnnotation(); - -$url = $object->getURL(); -$title = $object->title; -if (!$title) { - $title = elgg_echo('untitled'); -} -$params = array( - 'href' => $object->getURL(), - 'text' => $title, -); -$object_link = elgg_view('output/url', $params); - -$type = $object->getType(); -$subtype = $object->getSubtype(); - -$type_string = elgg_echo("river:commented:$type:$subtype"); -echo elgg_echo('river:likes', array($type_string, $object_link)); |
