Skip to content
Snippets Groups Projects
Commit 0904dc71 authored by Rodrigo Nascimento's avatar Rodrigo Nascimento
Browse files

Some improvements

parent eee87488
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,8 @@
return "#{Meteor.absoluteUrl()}avatar/#{username}.jpg?_dc=#{random}"
Blaze.registerHelper 'avatarUrlFromUsername', getAvatarUrlFromUsername
@updateAvatarOfUsername = (username) ->
key = "avatar_random_#{username}"
Session.set key, Math.round(Math.random() * 1000)
......
......@@ -2156,18 +2156,28 @@ a.github-fork {
}
.popup-item {
padding: 8px 20px;
line-height: 24px;
cursor: pointer;
user-select: none;
color: @secondary-font-color;
&.selected {
background-color: @tertiary-background-color;
color: @primary-font-color;
}
}
.popup-user-avatar {
width: 24px;
display: inline-block;
height: 24px;
background-size: contain;
border-radius: 3px;
margin: -7px 4px;
}
.popup-user-status {
border: 1px solid rgba(0,0,0,.2);
width: 10px;
height: 10px;
display: inline-block;
margin-right: 5px;
border-radius: 10px;
}
.popup-user-status-system {
......
......@@ -12,16 +12,17 @@ Template.messagePopupConfig.helpers
getFilter: (collection, filter) ->
exp = new RegExp(filter, 'i')
Meteor.subscribe('onlineUsers', filter)
items = onlineUsers.find().fetch()
items = onlineUsers.find({$or: [{name: exp}, {username: exp}]}, {limit: 5}).fetch()
all =
_id: '@all'
username: '@all'
status: 'system'
system: true
name: t 'Notify_all_in_this_room'
compatibility: 'channel group'
if exp.test(all.username) or exp.test(all.name) or exp.test(all.compatibility)
exp = new RegExp("(^|\\s)#{filter}", 'i')
if exp.test(all.username) or exp.test(all.compatibility)
items.unshift all
return items
......
<template name="messagePopupUser">
<div class="popup-user-status popup-user-status-{{status}}"></div><strong>{{username}}</strong> {{name}}
{{#unless system}}
<div class="popup-user-status popup-user-status-{{status}}"></div>
<div class="popup-user-avatar" style="background-image:url({{avatarUrlFromUsername username}});"></div>
{{/unless}}
<strong>{{username}}</strong> {{name}}
</template>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment