diff options
Diffstat (limited to 'views/default')
-rw-r--r-- | views/default/css/elements/navigation.php | 38 | ||||
-rw-r--r-- | views/default/js/elgg.php | 17 | ||||
-rw-r--r-- | views/default/navigation/menu/user_hover.php | 50 | ||||
-rw-r--r-- | views/default/profile/hover.php | 63 |
4 files changed, 103 insertions, 65 deletions
diff --git a/views/default/css/elements/navigation.php b/views/default/css/elements/navigation.php index e1a3c6866..7975dde25 100644 --- a/views/default/css/elements/navigation.php +++ b/views/default/css/elements/navigation.php @@ -272,4 +272,40 @@ float: left; width: 50%; font-size: 90%; -}
\ No newline at end of file +} + +.elgg-hover-menu { + display: none; + position: absolute; + + width: 165px; + border-top: solid 1px #E5E5E5; + border-left: solid 1px #E5E5E5; + border-right: solid 1px #999999; + border-bottom: solid 1px #999999; + background-color: #FFFFFF; + -webkit-box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.50); + -moz-box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.50); +} +.elgg-hover-menu > li { + border-bottom: 1px solid #dddddd; +} +.elgg-hover-menu > li:last-child { + border-bottom: none; +} +.elgg-hover-menu a { + display: block; + padding: 2px 8px; + font-size: 92%; +} +.elgg-hover-menu a:hover { + background: #cccccc; + text-decoration: none; +} +.elgg-hover-admin a { + color: red; +} +.elgg-hover-admin a:hover { + color: white; + background-color: red; +} diff --git a/views/default/js/elgg.php b/views/default/js/elgg.php index 082122b5d..3e7b30a99 100644 --- a/views/default/js/elgg.php +++ b/views/default/js/elgg.php @@ -358,25 +358,24 @@ function setup_avatar_menu(parent) { // avatar contextual menu $(".avatar_menu_button img").click(function(e) { - var submenu = $(this).parent().parent().find("div.sub_menu"); + //var submenu = $(this).parent().parent().find("div.sub_menu"); + var submenu = $(this).parent().parent().find(".elgg-hover-menu"); // close submenu if arrow is clicked & menu already open - if(submenu.css('display') == "block") { + if (submenu.css('display') == "block") { //submenu.hide(); - } - else { + } else { // get avatar dimensions var avatar = $(this).parent().parent().parent().find("div.elgg-user-icon"); //alert( "avatarWidth: " + avatar.width() + ", avatarHeight: " + avatar.height() ); // move submenu position so it aligns with arrow graphic if (e.pageX < 840) { // popup menu to left of arrow if we're at edge of page - submenu.css("top",(avatar.height()) + "px") + submenu.css("top",(avatar.height()) + "px") .css("left",(avatar.width()-15) + "px") .fadeIn('normal'); - } - else { - submenu.css("top",(avatar.height()) + "px") + } else { + submenu.css("top",(avatar.height()) + "px") .css("left",(avatar.width()-166) + "px") .fadeIn('normal'); } @@ -429,7 +428,7 @@ function setup_avatar_menu(parent) { $(document).click(function(event) { var target = $(event.target); if (target.parents(".elgg-user-icon").length == 0) { - $(".elgg-user-icon div.sub_menu").fadeOut(); + $(".elgg-hover-menu").fadeOut(); $(".avatar_menu_button").removeClass("avatar_menu_arrow"); $(".avatar_menu_button").removeClass("avatar_menu_arrow_on"); $(".avatar_menu_button").removeClass("avatar_menu_arrow_hover"); diff --git a/views/default/navigation/menu/user_hover.php b/views/default/navigation/menu/user_hover.php new file mode 100644 index 000000000..e8c5d0cbc --- /dev/null +++ b/views/default/navigation/menu/user_hover.php @@ -0,0 +1,50 @@ +<?php +/** + * User hover menu + * + * Register for the 'register', 'menu:user_hover' plugin hook to add to the user + * hover menu. There are three sections: action, default, and admin. + */ + +$user = $vars['entity']; +$actions = elgg_get_array_value('action', $vars['menu'], null); +$main = elgg_get_array_value('default', $vars['menu'], null); +$admin = elgg_get_array_value('admin', $vars['menu'], null); + +echo '<ul class="elgg-menu elgg-hover-menu">'; + +// name and username +$name_link = elgg_view('output/url', array( + 'href' => $user->getURL(), + 'text' => "<h3>$user->name</h3>@$user->username", +)); +echo "<li>$name_link</li>"; + +// actions +if (isloggedin() && $actions) { + echo '<li><ul>'; + foreach ($actions as $menu_item) { + echo elgg_view('navigation/menu/elements/item', array('item' => $menu_item)); + } + echo '</ul></li>'; +} + +// main +if ($main) { + echo '<li><ul>'; + foreach ($main as $menu_item) { + echo elgg_view('navigation/menu/elements/item', array('item' => $menu_item)); + } + echo '</ul></li>'; +} + +// admin +if (isadminloggedin() && $admin) { + echo '<li><ul class="elgg-hover-admin">'; + foreach ($admin as $menu_item) { + echo elgg_view('navigation/menu/elements/item', array('item' => $menu_item)); + } + echo '</ul></li>'; +} + +echo '</ul>'; diff --git a/views/default/profile/hover.php b/views/default/profile/hover.php index 85d6912ba..e31a99359 100644 --- a/views/default/profile/hover.php +++ b/views/default/profile/hover.php @@ -1,63 +1,16 @@ <?php -$user = $vars['entity']; -$username = $vars['username']; -$name = $vars['name']; - ?> -<div class="avatar_menu_button"><img src="<?php echo elgg_get_site_url(); ?>_graphics/spacer.gif" border="0" width="15" height="15" /></div> -<div class="sub_menu"> - <h3 class="displayname"> - <a href="<?php echo $user->getURL(); ?>"> - <?php echo $name; ?> - <span class="username"> - <?php echo "@" . $username; ?> - </span> - </a> - </h3> - <ul class='sub_menu_list'> -<?php -if (isloggedin()) { - // if not looking at your own avatar menu - if ($user->getGUID() != get_loggedin_userid()) { +<div class="avatar_menu_button"> + <img src="<?php echo elgg_get_site_url(); ?>_graphics/spacer.gif" border="0" width="15" height="15" /> +</div> - // Add / Remove friend link - $friendlinks = elgg_view('profile/menu/friendlinks',$vars); - if (!empty($friendlinks)) { - echo "<li class='user_menu_profile'>{$friendlinks}</li>"; - } - // view for plugins to extend - echo elgg_view('profile/menu/links',$vars); - } else { - // if looking at your own avatar menu - provide a couple of handy links -?> - <li class="user_menu_profile"> - <a class="edit_profile" href="<?php echo elgg_get_site_url()?>pg/profile/<?php echo $username; ?>/edit/details"> - <?php echo elgg_echo("profile:edit"); ?> - </a> - </li> - <li class="user_menu_profile"> - <a class="edit_avatar" href="<?php echo elgg_get_site_url()?>pg/profile/<?php echo $username; ?>/edit/icon"> - <?php echo elgg_echo("profile:editicon"); ?> - </a> - </li> <?php - } - // if Admin is logged in, and not looking at admins own avatar menu - if (isadminloggedin() && get_loggedin_userid() != $user->guid) { - $params = array( - 'user' => $user, - 'sort_by' => 'order', - ); - $admin_links = elgg_view_menu('user_admin', $params); - if (!empty($admin_links)) { - echo "<li class='user_menu_admin'>{$admin_links}</li>"; - } - } -} -?> - </ul> -</div>
\ No newline at end of file +echo elgg_view_menu('user_hover', $vars); + +// @todo change how to add on demand registration of menu items +global $CONFIG; +unset($CONFIG->menus['user_hover']); |