userAvatar calls

This commit is contained in:
KennyTV 2020-07-14 21:39:42 +02:00
parent bd158c5071
commit 32b280b45d
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
8 changed files with 17 additions and 12 deletions

View File

@ -36,7 +36,8 @@
<div class="row">
<div class="col-xs-12 col-md-1" style="width: 40px;">
<a href="${routes.getRouteUrl("users.showProjects", flag.reporter)}">
@userAvatar(Some(flag.reporter), User.avatarUrl(flag.reporter), clazz = "user-avatar-xs")
<#import "*/utils/userAvatar.ftlh" as userAvatar>
<@userAvatar.userAvatar userName=flag.reporter avatarUrl=User.avatarUrl(flag.reporter) clazz="user-avatar-xs"></@userAvatar.userAvatar>
</a>
</div>
<div class="col-xs-12 col-md-11">

View File

@ -152,7 +152,8 @@
@versions.sortWith((a, b) => a.versionCreatedAt.compareTo(b.versionCreatedAt) < 0).map { entry =>
<tr data-version="@helper.urlEncode(entry.namespace.ownerName)/@helper.urlEncode(entry.namespace.slug)/versions/@helper.urlEncode(entry.versionString)">
<td>
@userAvatar(Some(entry.namespace.ownerName), User.avatarUrl(entry.namespace.ownerName), clazz = "user-avatar-xs")
<#import "*/utils/userAvatar.ftlh" as userAvatar>
<@userAvatar.userAvatar userName=entry.namespace.ownerName avatatUrl=User.avatarUrl(entry.namespace.ownerName) clazz="user-avatar-xs"></@userAvatar.userAvatar>
</td>
<td>
<a href="${routes.getRouteUrl("versions.show", entry.namespace.ownerName, entry.namespace.slug, entry.versionString)}">

View File

@ -58,19 +58,20 @@
<tbody>
@authors.map { case (name, joinDate, createdAt, optRole, optDonorRole, projectCount) =>
<tr>
<td>@userAvatar(Some(name), User.avatarUrl(name), clazz = "user-avatar-xs")</td>
<#import "*/utils/userAvatar.ftlh" as userAvatar>
<td><@userAvatar.userAvatar userName=name avatarUrl=User.avatarUrl(name) clazz="user-avatar-xs"></@userAvatar.userAvatar></td>
<td>
<a href="${routes.getRouteUrl("users.showProjects", name)}">${name}</a>
</td>
<td>
@optDonorRole.map { role =>
<span class="channel channel-sm" style="background-color: ${role.color.hex}">
@role.title
${role.title}
</span>
}
@optRole.map { role =>
<span class="user-role channel" style="background-color: ${role.color.hex}">
@role.title
${role.title}
</span>
}

View File

@ -2,6 +2,7 @@
<#import "*/utils/hangar.ftlh" as hangar />
<#import "*/utils/form.ftlh" as form>
<#import "*/utils/csrf.ftlh" as csrf>
<#import "*/utils/userAvatar.ftlh" as userAvatar>
@import ore.OreConfig
@import ore.models.user.role.UserRoleModel
@ -31,7 +32,7 @@
<ul style="display: none;">
<li id="row-user" class="list-group-item">
<input type="hidden" />
@userAvatar(None, clazz = "user-avatar-xs")
<@userAvatar.userAvatar clazz="user-avatar-xs"></@userAvatar.userAvatar>
<a class="username"></a>
<i class="fas fa-times user-cancel"></i>
@users.invite.roleSelect(roleCategory = j.roleCategory, classes="pull-right")
@ -101,7 +102,7 @@
<!-- Member list -->
@j.filteredMembers.map { case (role, user) =>
<li class="list-group-item">
@userAvatar(Some(user.name), user.avatarUrl, clazz = "user-avatar-xs")
<@userAvatar.userAvatar userName=user.name avatarUrl=user.avatarUrl clazz="user-avatar-xs"></@userAvatar.userAvatar>
<a class="username" href="${routes.getRouteUrl("users.showProjects", user.name)}">
${user.name}
</a>

View File

@ -87,7 +87,8 @@
<li class="list-group-item notification" data-action="${notification.action!"none"}"
data-id="@notification.id">
@origin.map { origin =>
@userAvatar(Some(origin.name), origin.avatarUrl, clazz = "user-avatar-s")
<#import "*/utils/userAvatar.ftlh" as userAvatar>
<@userAvatar.userAvatar userName=origin.name avatarUrl=origin.avatarUrl clazz = "user-avatar-s"></@userAvatar.userAvatar>
}
@formatNotification(notification)

View File

@ -76,7 +76,8 @@
@u.orgas.map { case (organization, user, role, _) =>
<tr>
<td>
@userAvatar(Some(organization.name), user.avatarUrl, clazz = "user-avatar-xxs")
<#import "*/utils/userAvatar.ftlh" as userAvatar>
<@userAvatar.userAvatar userName=organization.name avatarUrl=user.avatarUrl clazz="user-avatar-xxs"></@userAvatar.userAvatar>
<a href="${routes.getRouteUrl("users.showProjects", organization.name)}">
${organization.name}
</a>

View File

@ -44,7 +44,8 @@
<tbody>
<#list staff as user>
<tr>
<td>@userAvatar(user.name, User.avatarUrl(name), clazz = "user-avatar-xs")</td>
<#import "*/utils/userAvatar.ftlh" as userAvatar>
<td><@userAvatar.userAvatar userName=user.name avatarUrl=User.avatarUrl(name) clazz="user-avatar-xs"></@userAvatar.userAvatar></td>
<td>
<a href="${routes.getRouteUrl("showActivities", name)}">${user.name}</a>
</td>

View File

@ -3,8 +3,6 @@
<#import "/spring.ftl" as spring />
<#import "*/utils/hangar.ftlh" as hangar />
<#-- TODO: all the userName.nonEmpty/isEmpty stuff - how do you do this? -->
<#macro userAvatar userName="" avatarUrl="" imgSrc="" clazz="" attr={} href="">
<#assign src>
<#if imgSrc?has_content>