aboutsummaryrefslogtreecommitdiff
path: root/mod/likes/views
diff options
context:
space:
mode:
authorBrett Profitt <brett.profitt@gmail.com>2011-08-25 10:00:38 -0700
committerBrett Profitt <brett.profitt@gmail.com>2011-08-25 10:00:38 -0700
commitdccc333c765bb28da55b4a55d9c916acdb88413a (patch)
treebdd26a0b4cd85241a19b7fcb2c0770f0ac3eb9f0 /mod/likes/views
parentec7b94a64aef23b85866ecdac8e8acc712d29bb6 (diff)
parent003cb81c7888f4d2fd763e5814027c6f8d71186f (diff)
downloadelgg-dccc333c765bb28da55b4a55d9c916acdb88413a.tar.gz
elgg-dccc333c765bb28da55b4a55d9c916acdb88413a.tar.bz2
Merge branch 'master' of github.com:brettp/Elgg
Diffstat (limited to 'mod/likes/views')
-rw-r--r--mod/likes/views/default/likes/button.php (renamed from mod/likes/views/default/likes/display.php)25
-rw-r--r--mod/likes/views/default/likes/count.php31
-rw-r--r--mod/likes/views/default/likes/css.php4
-rw-r--r--mod/likes/views/default/likes/js.php26
-rw-r--r--mod/likes/views/default/river/annotation/likes/create.php26
5 files changed, 62 insertions, 50 deletions
diff --git a/mod/likes/views/default/likes/display.php b/mod/likes/views/default/likes/button.php
index 2dc50ddd0..383e1bb63 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']
*/
@@ -40,26 +40,3 @@ if (elgg_is_logged_in() && $vars['entity']->canAnnotate(0, 'likes')) {
}
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..bdc50bcd1
--- /dev/null
+++ b/mod/likes/views/default/likes/count.php
@@ -0,0 +1,31 @@
+<?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-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/css.php b/mod/likes/views/default/likes/css.php
index cb0334b7c..fabf54e46 100644
--- a/mod/likes/views/default/likes/css.php
+++ b/mod/likes/views/default/likes/css.php
@@ -11,3 +11,7 @@
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..b7e000539
--- /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-list')) {
+ 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));