Merge pull request #4706 from gsambrotta/add-name-search-dropbox

FEATURE: Add user name in search results
This commit is contained in:
Guo Xiang Tan 2017-03-02 15:22:15 +08:00 committed by GitHub
commit 442bef2df9
4 changed files with 9 additions and 2 deletions

View File

@ -46,7 +46,7 @@ function postResult(result, link, term) {
}
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) {

View File

@ -184,6 +184,10 @@
display: block;
padding: 5px;
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) {

View File

@ -1,6 +1,6 @@
class GroupedSearchResultSerializer < ApplicationSerializer
has_many :posts, serializer: SearchPostSerializer
has_many :users, serializer: BasicUserSerializer
has_many :users, serializer: SearchResultUserSerializer
has_many :categories, serializer: BasicCategorySerializer
attributes :more_posts, :more_users, :more_categories
end

View File

@ -0,0 +1,3 @@
class SearchResultUserSerializer < BasicUserSerializer
attributes :name
end