UX: Display group fullname in mention autocomplete.
This commit is contained in:
parent
a89f60b85b
commit
43671b1fda
|
@ -1,10 +0,0 @@
|
||||||
import { registerUnbound } from 'discourse-common/lib/helpers';
|
|
||||||
|
|
||||||
registerUnbound('max-usernames', function(usernames, params) {
|
|
||||||
var maxLength = parseInt(params.max) || 3;
|
|
||||||
if (usernames.length > maxLength){
|
|
||||||
return usernames.slice(0, maxLength).join(", ") + ", +" + (usernames.length - maxLength);
|
|
||||||
} else {
|
|
||||||
return usernames.join(", ");
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,8 +1,8 @@
|
||||||
<div class='autocomplete'>
|
<div class='user-selector autocomplete'>
|
||||||
<ul>
|
<ul>
|
||||||
{{#each options.users as |user|}}
|
{{#each options.users as |user|}}
|
||||||
<li>
|
<li class="user-selector-item">
|
||||||
<a href>
|
<a href title="{{user.name}}">
|
||||||
{{avatar user imageSize="tiny"}}
|
{{avatar user imageSize="tiny"}}
|
||||||
<span class='username'>{{user.username}}</span>
|
<span class='username'>{{user.username}}</span>
|
||||||
<span class='name'>{{user.name}}</span>
|
<span class='name'>{{user.name}}</span>
|
||||||
|
@ -11,11 +11,11 @@
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{#if options.groups}}
|
{{#if options.groups}}
|
||||||
{{#each options.groups as |group|}}
|
{{#each options.groups as |group|}}
|
||||||
<li>
|
<li class="user-selector-item">
|
||||||
<a href>
|
<a href title="{{group.full_name}}">
|
||||||
<i class='fa fa-users'></i>
|
<i class='fa fa-users'></i>
|
||||||
<span class='username'>{{group.name}}</span>
|
<span class='username'>{{group.name}}</span>
|
||||||
<span class='name'>{{max-usernames group.usernames max="3"}}</span>
|
<span class='name'>{{group.full_name}}</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
|
@ -8,26 +8,27 @@
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
li {
|
|
||||||
|
.user-selector-item {
|
||||||
.fa-users {
|
.fa-users {
|
||||||
color: lighten($primary, 40%);
|
color: lighten($primary, 40%);
|
||||||
padding: 0 2px;
|
padding: 0 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
border-bottom: 1px solid dark-light-diff($primary, $secondary, 90%, -60%);
|
border-bottom: 1px solid dark-light-diff($primary, $secondary, 90%, -60%);
|
||||||
a[href] {
|
|
||||||
|
a {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
display: block;
|
display: block;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
span.username {
|
span.username {
|
||||||
color: darken($primary, 40%);
|
color: darken($primary, 40%);
|
||||||
display: inline-block;
|
|
||||||
}
|
}
|
||||||
span.name {
|
span.name {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
display: inline-block;
|
|
||||||
width: 90px;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
&.selected {
|
&.selected {
|
||||||
|
|
|
@ -568,7 +568,7 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
if params[:include_groups] == "true"
|
if params[:include_groups] == "true"
|
||||||
to_render[:groups] = Group.search_group(term).map do |m|
|
to_render[:groups] = Group.search_group(term).map do |m|
|
||||||
{name: m.name, usernames: []}
|
{ name: m.name, full_name: m.full_name }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -576,7 +576,7 @@ class UsersController < ApplicationController
|
||||||
to_render[:groups] = Group.mentionable(current_user)
|
to_render[:groups] = Group.mentionable(current_user)
|
||||||
.where("name ILIKE :term_like", term_like: "#{term}%")
|
.where("name ILIKE :term_like", term_like: "#{term}%")
|
||||||
.map do |m|
|
.map do |m|
|
||||||
{name: m.name, usernames: []}
|
{ name: m.name, full_name: m.full_name }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue