From 897bd5cfefde22b4bdfc6d9dd67aa3bd865af306 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 24 Apr 2017 19:52:45 +0200 Subject: [PATCH] add contactsmenu popover to comments Signed-off-by: Georg Ehrke --- apps/comments/css/comments.css | 6 +++++- apps/comments/js/commentstabview.js | 20 +++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/apps/comments/css/comments.css b/apps/comments/css/comments.css index 796a550227b..2d794d52708 100644 --- a/apps/comments/css/comments.css +++ b/apps/comments/css/comments.css @@ -54,7 +54,6 @@ #commentsTabView .comment { position: relative; - z-index: 1; margin-bottom: 30px; } @@ -108,6 +107,11 @@ vertical-align: middle; } +#commentsTabView .authorRow>div.hidden { + display: none !important; +} + +#commentsTabView .comments li .message .avatar-name-wrapper, #commentsTabView .comment .authorRow { position: relative; } diff --git a/apps/comments/js/commentstabview.js b/apps/comments/js/commentstabview.js index 2256bea943e..ace0862ad2e 100644 --- a/apps/comments/js/commentstabview.js +++ b/apps/comments/js/commentstabview.js @@ -232,6 +232,21 @@ var $this = $(this); $this.avatar($this.attr('data-username'), 32); }); + + var username = $el.find('.avatar').data('username'); + if (username !== oc_current_user) { + $el.find('.authorRow .avatar, .authorRow .author').contactsMenu( + username, 0, $el.find('.authorRow')); + } + + var message = $el.find('.message'); + message.find('.avatar').each(function() { + var avatar = $(this); + var strong = $(this).next(); + var appendTo = $(this).parent(); + + $.merge(avatar, strong).contactsMenu(avatar.data('user'), 0, appendTo); + }); }, /** @@ -251,7 +266,10 @@ // escape possible regex characters in the name mention = mention.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); - var displayName = avatar + ' '+ _.escape(mentions[i].mentionDisplayName)+''; + var displayName = '' + + '' + + avatar + ' '+ _.escape(mentions[i].mentionDisplayName)+'' + + ''; // replace every mention either at the start of the input or after a whitespace // followed by a non-word character.