Browse Source

add contactsmenu popover to comments

Signed-off-by: Georg Ehrke <developer@georgehrke.com>
tags/v12.0.0beta1
Georg Ehrke 7 years ago
parent
commit
897bd5cfef
No account linked to committer's email address
2 changed files with 24 additions and 2 deletions
  1. 5
    1
      apps/comments/css/comments.css
  2. 19
    1
      apps/comments/js/commentstabview.js

+ 5
- 1
apps/comments/css/comments.css View File

@@ -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;
}

+ 19
- 1
apps/comments/js/commentstabview.js View File

@@ -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 + ' <strong>'+ _.escape(mentions[i].mentionDisplayName)+'</strong>';
var displayName = ''
+ '<span class="avatar-name-wrapper">'
+ avatar + ' <strong>'+ _.escape(mentions[i].mentionDisplayName)+'</strong>'
+ '</span>';

// replace every mention either at the start of the input or after a whitespace
// followed by a non-word character.

Loading…
Cancel
Save