Show author badges on assets and comments

Comments layout is still broken, marked as TODO(Pablo).
This commit is contained in:
2018-09-12 15:58:29 +02:00
parent e8fb77c39b
commit 2be41a7145
5 changed files with 25 additions and 2 deletions

View File

@@ -142,7 +142,7 @@ def after_fetching_user(user):
return
# Remove all fields except public ones.
public_fields = {'full_name', 'username', 'email', 'extension_props_public'}
public_fields = {'full_name', 'username', 'email', 'extension_props_public', 'badges'}
for field in list(user.keys()):
if field not in public_fields:
del user[field]

View File

@@ -33,7 +33,8 @@ def get_user_info(user_id):
# TODO: put those fields into a config var or module-level global.
return {'email': user.email,
'full_name': user.full_name,
'username': user.username}
'username': user.username,
'badges_html': (user.badges and user.badges.html) or ''}
def setup_app(app):

View File

@@ -754,6 +754,24 @@ section.node-details-container
&.status
color: $color-text-dark
ul.blender-id-badges
padding-left: 0
list-style-type: none
display: flex
> li
margin: 0
padding: 0
> a
display: block
padding: 2px
img
// TODO(Pablo): fix this so that it keeps the aspect ratio okay when the original image isn't square.
max-width: 16px
max-height: 16px
.node-details-license
color: $color-text-dark-secondary
&:hover

View File

@@ -10,6 +10,9 @@
.comment-content
.comment-body
p.comment-author {{ comment._user.full_name }}
//- TODO(Pablo): due to the broad styling done on the .comment-content class the
//- styling for the badges that I put in _project.sass isn't applied properly here.
| {{ comment._user.badges_html|safe }}
span {{comment.properties | markdowned('content') }}

View File

@@ -47,6 +47,7 @@
li(title="Author")
| {{ node.user.full_name }}
| {{ node.user.badges.html|safe }}
li(
title="Created {{ node._created }} (updated {{ node._updated | pretty_date_time }})")