Commit eaef9453 authored by Nur Rony's avatar Nur Rony

shows user avatar in mention autocomplete in editor

adds entry in CHANGELOG

no uninitialized variable and unnecessary if statement

formatting issue in CHANGELOG

resolves scss lint warings

cleanup: unnecessary css classes

adds css class that cleaned up by mistake

replaces snake_case variables name with camelCase

removes unnecessary css class and adds white color border for avatar

moves changelog entry from 8.13 to 8.14

remove bottom margin from avatar-inline

resolves lint warnings

rebased and moves changelog entry to 8.14

fixes avatar shifting on hover

adds entry at top of 8.14 section in CHANGELOG.md

calls sanitization for gl.utils

syncing changelog with master and created changelog files using cli

changes changelog title
parent 4a4c57f7
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
}, },
// Team Members // Team Members
Members: { Members: {
template: '<li>${username} <small>${title}</small></li>' template: '<li>${avatarTag} ${username} <small>${title}</small></li>'
}, },
Labels: { Labels: {
template: '<li><span class="dropdown-label-box" style="background: ${color}"></span> ${title}</li>' template: '<li><span class="dropdown-label-box" style="background: ${color}"></span> ${title}</li>'
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
beforeInsert: this.DefaultOptions.beforeInsert, beforeInsert: this.DefaultOptions.beforeInsert,
beforeSave: function(members) { beforeSave: function(members) {
return $.map(members, function(m) { return $.map(members, function(m) {
var title; let title = '';
if (m.username == null) { if (m.username == null) {
return m; return m;
} }
...@@ -126,8 +126,14 @@ ...@@ -126,8 +126,14 @@
if (m.count) { if (m.count) {
title += " (" + m.count + ")"; title += " (" + m.count + ")";
} }
const autoCompleteAvatar = m.avatar_url || m.username.charAt(0).toUpperCase();
const imgAvatar = `<img src="${m.avatar_url}" alt="${m.username}" class="avatar avatar-inline center s26"/>`;
const txtAvatar = `<div class="avatar center avatar-inline s26">${autoCompleteAvatar}</div>`;
return { return {
username: m.username, username: m.username,
avatarTag: autoCompleteAvatar.length === 1 ? txtAvatar : imgAvatar,
title: gl.utils.sanitize(title), title: gl.utils.sanitize(title),
search: gl.utils.sanitize(m.username + " " + m.name) search: gl.utils.sanitize(m.username + " " + m.name)
}; };
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
&.avatar-inline { &.avatar-inline {
float: none; float: none;
display: inline-block;
margin-left: 4px; margin-left: 4px;
margin-bottom: 2px; margin-bottom: 2px;
...@@ -41,6 +42,12 @@ ...@@ -41,6 +42,12 @@
&.s24 { margin-right: 4px; } &.s24 { margin-right: 4px; }
} }
&.center {
font-size: 14px;
line-height: 1.8em;
text-align: center;
}
&.avatar-tile { &.avatar-tile {
border-radius: 0; border-radius: 0;
border: none; border: none;
......
...@@ -148,7 +148,19 @@ ...@@ -148,7 +148,19 @@
} }
} }
.atwho-view small.description { .atwho-view {
float: right; small.description {
padding: 3px 5px; float: right;
} padding: 3px 5px;
}
.avatar-inline {
margin-bottom: 0;
}
.cur {
.avatar {
border: 1px solid $white-light;
}
}
}
\ No newline at end of file
module Projects module Projects
class ParticipantsService < BaseService class ParticipantsService < BaseService
attr_reader :noteable attr_reader :noteable
def execute(noteable) def execute(noteable)
@noteable = noteable @noteable = noteable
...@@ -15,7 +15,8 @@ module Projects ...@@ -15,7 +15,8 @@ module Projects
[{ [{
name: noteable.author.name, name: noteable.author.name,
username: noteable.author.username username: noteable.author.username,
avatar_url: noteable.author.avatar_url
}] }]
end end
...@@ -28,14 +29,14 @@ module Projects ...@@ -28,14 +29,14 @@ module Projects
def sorted(users) def sorted(users)
users.uniq.to_a.compact.sort_by(&:username).map do |user| users.uniq.to_a.compact.sort_by(&:username).map do |user|
{ username: user.username, name: user.name } { username: user.username, name: user.name, avatar_url: user.avatar_url }
end end
end end
def groups def groups
current_user.authorized_groups.sort_by(&:path).map do |group| current_user.authorized_groups.sort_by(&:path).map do |group|
count = group.users.count count = group.users.count
{ username: group.path, name: group.name, count: count } { username: group.path, name: group.name, count: count, avatar_url: group.avatar.url }
end end
end end
......
---
title: Show avatars in mention dropdown
merge_request: 6865
author:
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment