From e5b1a360879963dca1cd468353776c340d23e0b6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 22 Jun 2011 21:32:21 +0200 Subject: [PATCH] Add context menu to reply avatars. --- src/main/resources/static/css/sone.css | 6 +++- src/main/resources/static/javascript/sone.js | 39 ++++++++++++++++++++++ .../resources/templates/include/viewReply.html | 3 +- 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/main/resources/static/css/sone.css b/src/main/resources/static/css/sone.css index 0dcf952..96ca0d3 100644 --- a/src/main/resources/static/css/sone.css +++ b/src/main/resources/static/css/sone.css @@ -420,13 +420,17 @@ textarea { } #sone .post .reply { + position: relative; clear: both; background-color: #f0f0ff; - font-size: 85%; margin: 1ex 0px; padding: 1ex; } +#sone .post .reply .inner-part { + font-size: 85%; +} + #sone .post .reply.new { background-color: #ffffa0; } diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 44eee87..3fcf907 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -901,6 +901,45 @@ function ajaxifyReply(replyElement) { untrustSone(getReplyAuthor(this)); return false; }); + + /* show Sone menu when hovering over the avatar. */ + $(replyElement).find(".reply-avatar").mouseover(function() { + $(".sone-reply-menu", replyElement).mouseleave(function() { + $(this).fadeOut(); + }).fadeIn(); + return false; + }); + (function(replyElement) { + var soneId = $(".sone-id", replyElement).text(); + $(".sone-menu .follow", replyElement).click(function() { + var followElement = this; + ajaxGet("followSone.ajax", { "sone": soneId, "formPassword": getFormPassword() }, function() { + $(followElement).addClass("hidden"); + $(followElement).parent().find(".unfollow").removeClass("hidden"); + $("#sone .sone-menu").each(function() { + if (getMenuSone(this) == soneId) { + $(".follow", this).toggleClass("hidden", true); + $(".unfollow", this).toggleClass("hidden", false); + } + }); + }); + return false; + }); + $(".sone-menu .unfollow", replyElement).click(function() { + var unfollowElement = this; + ajaxGet("unfollowSone.ajax", { "sone": soneId, "formPassword": getFormPassword() }, function() { + $(unfollowElement).addClass("hidden"); + $(unfollowElement).parent().find(".follow").removeClass("hidden"); + $("#sone .sone-menu").each(function() { + if (getMenuSone(this) == soneId) { + $(".follow", this).toggleClass("hidden", false); + $(".unfollow", this).toggleClass("hidden", true); + } + }); + }); + return false; + }); + })(replyElement); } /** diff --git a/src/main/resources/templates/include/viewReply.html b/src/main/resources/templates/include/viewReply.html index 2507917..51fd98f 100644 --- a/src/main/resources/templates/include/viewReply.html +++ b/src/main/resources/templates/include/viewReply.html @@ -3,7 +3,8 @@ -
+ <%include include/soneMenu.html class=="sone-reply-menu" sone=reply.sone> +
Avatar Image
-- 2.7.4