DEV: render-invitee helper

This commit is contained in:
jjaffeux 2020-03-27 10:25:55 +01:00
parent 02cc7a4a41
commit 43c62d6cec
2 changed files with 22 additions and 6 deletions

View File

@ -10,12 +10,7 @@
<ul class="invitees">
{{#each invitees as |invitee|}}
<li class="invitee">
<span class="user">
{{avatar invitee.user imageSize="medium"}}
<span class="username">
{{format-username invitee.user.username}}
</span>
</span>
{{render-invitee invitee}}
{{#if invitee.status}}
<span class="status {{invitee.status}}">
{{i18n (concat "event.invitee_status." invitee.status)}}

View File

@ -0,0 +1,21 @@
import { renderAvatar } from "discourse/helpers/user-avatar";
import { userPath } from "discourse/lib/url";
import { htmlHelper } from "discourse-common/lib/helpers";
import { htmlSafe } from "@ember/template";
import { formatUsername } from "discourse/lib/utilities";
export default htmlHelper(invitee => {
const path = userPath(invitee.user.username);
const template = `
<a href="${path}" data-user-card="${invitee.user.username}">
<span class="user">
${renderAvatar(invitee.user, { imageSize: "medium" })}
<span class="username">
${formatUsername(invitee.user.username)}
</span>
</span>
</a>
`;
return htmlSafe(template);
});