From 30958fd27d81717354bc04e029213239f6b9bc6b Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 25 Jun 2011 09:51:21 -0400 Subject: Refs #3388 entity menu has better vertical alignment --- mod/likes/views/default/likes/button.php | 65 +++++++++++++++++++++++++++++++ mod/likes/views/default/likes/display.php | 65 ------------------------------- views/default/css/elements/core.php | 6 --- views/default/css/elements/navigation.php | 26 +++++++++++-- 4 files changed, 88 insertions(+), 74 deletions(-) create mode 100644 mod/likes/views/default/likes/button.php delete mode 100644 mod/likes/views/default/likes/display.php diff --git a/mod/likes/views/default/likes/button.php b/mod/likes/views/default/likes/button.php new file mode 100644 index 000000000..2dc50ddd0 --- /dev/null +++ b/mod/likes/views/default/likes/button.php @@ -0,0 +1,65 @@ +getGUID(); + +// check to see if the user has already liked this +if (elgg_is_logged_in() && $vars['entity']->canAnnotate(0, 'likes')) { + if (!elgg_annotation_exists($guid, 'likes')) { + $url = elgg_get_site_url() . "action/likes/add?guid={$guid}"; + $params = array( + 'href' => $url, + 'text' => elgg_view_icon('thumbs-up'), + 'title' => elgg_echo('likes:likethis'), + 'is_action' => 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, + ); + $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 .= ""; + echo $list; +} diff --git a/mod/likes/views/default/likes/display.php b/mod/likes/views/default/likes/display.php deleted file mode 100644 index 2dc50ddd0..000000000 --- a/mod/likes/views/default/likes/display.php +++ /dev/null @@ -1,65 +0,0 @@ -getGUID(); - -// check to see if the user has already liked this -if (elgg_is_logged_in() && $vars['entity']->canAnnotate(0, 'likes')) { - if (!elgg_annotation_exists($guid, 'likes')) { - $url = elgg_get_site_url() . "action/likes/add?guid={$guid}"; - $params = array( - 'href' => $url, - 'text' => elgg_view_icon('thumbs-up'), - 'title' => elgg_echo('likes:likethis'), - 'is_action' => 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, - ); - $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 .= ""; - echo $list; -} diff --git a/views/default/css/elements/core.php b/views/default/css/elements/core.php index 61dcdb1fe..af4a1882a 100644 --- a/views/default/css/elements/core.php +++ b/views/default/css/elements/core.php @@ -96,9 +96,6 @@ .elgg-menu-hz > li > span { /* Google says do this, but why? */ position: relative; - - /* FF2 */ - display: -moz-inline-box; display: inline-block; @@ -106,6 +103,3 @@ zoom: 1; *display: inline; } - -/* Looks much better when middle-aligned with surrounding text */ -.elgg-icon {vertical-align:middle} \ No newline at end of file diff --git a/views/default/css/elements/navigation.php b/views/default/css/elements/navigation.php index d930d3a89..cde978138 100644 --- a/views/default/css/elements/navigation.php +++ b/views/default/css/elements/navigation.php @@ -421,20 +421,27 @@ li:hover > .elgg-menu-site-more { /* *************************************** ENTITY *************************************** */ + .elgg-menu-entity { float: right; margin-left: 15px; font-size: 90%; color: #aaa; + line-height: 16px; + height: 16px; } .elgg-menu-entity > li { - display: inline-block; margin-left: 15px; } - .elgg-menu-entity > li > a { color: #aaa; - height: 18px; +} + +.elgg-menu-entity > li > a { + display: block; +} +.elgg-menu-entity > li > span { + vertical-align: baseline; } /* *************************************** @@ -476,11 +483,24 @@ li:hover > .elgg-menu-site-more { margin-left: 15px; font-size: 90%; color: #aaa; + line-height: 16px; + height: 16px; } .elgg-menu-river > li { display: inline-block; margin-left: 5px; } +.elgg-menu-river > li > a { + color: #aaa; + height: 16px; +} + +.elgg-menu-river > li > a { + display: block; +} +.elgg-menu-river > li > span { + vertical-align: baseline; +} /* *************************************** SIDEBAR EXTRAS (rss, bookmark, etc) -- cgit v1.2.3