create searchResultUserSerializer, display name next to username in search results
This commit is contained in:
parent
b20b568039
commit
d308638a18
|
@ -46,7 +46,7 @@ function postResult(result, link, term) {
|
||||||
}
|
}
|
||||||
|
|
||||||
createSearchResult('user', 'path', function(u) {
|
createSearchResult('user', 'path', function(u) {
|
||||||
return [ avatarImg('small', { template: u.avatar_template, username: u.username }), ' ', u.username ];
|
return [ avatarImg('small', { template: u.avatar_template, username: u.username }), ' ', h('span.user-results', h('b', u.username)), ' ', h('span.user-results', u.name ? u.name : '') ];
|
||||||
});
|
});
|
||||||
|
|
||||||
createSearchResult('topic', 'url', function(result, term) {
|
createSearchResult('topic', 'url', function(result, term) {
|
||||||
|
|
|
@ -184,6 +184,10 @@
|
||||||
display: block;
|
display: block;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
transition: all linear .15s;
|
transition: all linear .15s;
|
||||||
|
|
||||||
|
.user-results {
|
||||||
|
color: dark-light-choose(scale-color($primary, $lightness: 30%), scale-color($secondary, $lightness: 70%));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover a:not(.badge-notification) {
|
&:hover a:not(.badge-notification) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class GroupedSearchResultSerializer < ApplicationSerializer
|
class GroupedSearchResultSerializer < ApplicationSerializer
|
||||||
has_many :posts, serializer: SearchPostSerializer
|
has_many :posts, serializer: SearchPostSerializer
|
||||||
has_many :users, serializer: BasicUserSerializer
|
has_many :users, serializer: SearchResultUserSerializer
|
||||||
has_many :categories, serializer: BasicCategorySerializer
|
has_many :categories, serializer: BasicCategorySerializer
|
||||||
attributes :more_posts, :more_users, :more_categories
|
attributes :more_posts, :more_users, :more_categories
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
class SearchResultUserSerializer < BasicUserSerializer
|
||||||
|
attributes :name
|
||||||
|
end
|
Loading…
Reference in New Issue