User rendering WIP.
This commit is contained in:
parent
e8546bbf5c
commit
a3b8d2eb54
@ -142,12 +142,8 @@ ProjectCreationModal = (args) ->
|
||||
[
|
||||
for uid in self.project.permissions[permission]
|
||||
h \tr {key: uid} [
|
||||
# FIXME: show full name or login
|
||||
h \td [
|
||||
if user = self.users-cache.get-user uid
|
||||
user.profile?.full_name || user.login
|
||||
else
|
||||
uid.to-string!
|
||||
self.users-cache.render-user uid
|
||||
]
|
||||
h \td [ permission ]
|
||||
]
|
||||
|
@ -12,24 +12,6 @@ maquette-css-transitions = require "maquette-css-transitions"
|
||||
Task = (self, project, todod-ws, users-cache) ->
|
||||
modal = void
|
||||
|
||||
self.render-login = (uid) ->
|
||||
h \p [
|
||||
if user = users-cache.get-user uid
|
||||
[
|
||||
if avatar = user.profile?.avatar
|
||||
h \figure.image.is-32x32.is-pulled-left [
|
||||
h \img.is-rounded {
|
||||
src=avatar
|
||||
alt=""
|
||||
}
|
||||
]
|
||||
|
||||
'@' + user.login
|
||||
]
|
||||
else
|
||||
'@' + uid.to-string!
|
||||
]
|
||||
|
||||
self.render = (args) ->
|
||||
args or= {}
|
||||
|
||||
@ -52,7 +34,7 @@ Task = (self, project, todod-ws, users-cache) ->
|
||||
title 5 self.title
|
||||
|
||||
if uid = self.assigned_to
|
||||
self.render-login uid
|
||||
users-cache.render-user uid
|
||||
]
|
||||
right: [
|
||||
h \a.has-text-grey.is-pulled-right {
|
||||
|
@ -1,4 +1,6 @@
|
||||
|
||||
{h} = require "maquette"
|
||||
|
||||
UsersCache = (authd-ws, on-user) ->
|
||||
self = {}
|
||||
|
||||
@ -21,6 +23,26 @@ UsersCache = (authd-ws, on-user) ->
|
||||
if message.reason == "user not found"
|
||||
console.log "warning: got a “user not found” error"
|
||||
|
||||
self.render-user = (uid) ->
|
||||
if user = self.get-user uid
|
||||
h \div.level.user {key: "user-#{uid}"} [
|
||||
h \div.level-left [
|
||||
if avatar = user.profile?.avatar
|
||||
h \div.level-item [
|
||||
h \figure.image.is-32x32.is-rounded [
|
||||
h \img {
|
||||
src: avatar
|
||||
alt: ""
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
h \div.level-item [
|
||||
"@" + (user.profile?.full_name || user.login)
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
# Note: uid may also be a login.
|
||||
self.get-user = (uid, request-if-missing = true) ->
|
||||
switch user = self.users[uid]
|
||||
|
Loading…
Reference in New Issue
Block a user