This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/plugins/chat/assets/javascripts/discourse/components/chat-channel-card.hbs

99 lines
2.9 KiB
Handlebars

{{#if this.channel}}
<div
class={{concat-class
"chat-channel-card"
(if this.channel.isClosed "-closed")
(if this.channel.isArchived "-archived")
}}
style={{border-color this.channel.chatable.color}}
>
<div class="chat-channel-card__header">
<LinkTo
@route="chat.channel"
@models={{array this.channel.id (slugify-channel this.channel)}}
class="chat-channel-card__name-container"
>
<span class="chat-channel-card__name">
{{replace-emoji this.channel.escapedTitle}}
</span>
{{#if this.channel.chatable.read_restricted}}
{{d-icon "lock" class="chat-channel-card__read-restricted"}}
{{/if}}
</LinkTo>
<div class="chat-channel-card__header-actions">
{{#if this.channel.current_user_membership.muted}}
<LinkTo
@route="chat.channel.info.settings"
@models={{array
this.channel.id
(slugify-channel this.channel)
}}
class="chat-channel-card__tag -muted"
tabindex="-1"
>
{{i18n "chat.muted"}}
</LinkTo>
{{/if}}
<LinkTo
@route="chat.channel.info.settings"
@models={{array this.channel.id (slugify-channel this.channel)}}
class="chat-channel-card__setting"
tabindex="-1"
>
{{d-icon "cog"}}
</LinkTo>
</div>
</div>
{{#if this.channel.description}}
<div class="chat-channel-card__description">
{{replace-emoji this.channel.escapedDescription}}
</div>
{{/if}}
<div class="chat-channel-card__cta">
{{#if this.channel.isFollowing}}
<div class="chat-channel-card__tags">
<span class="chat-channel-card__tag -joined">
{{i18n "chat.joined"}}
</span>
<ToggleChannelMembershipButton
@channel={{this.channel}}
@onToggle={{action "afterMembershipToggle"}}
@options={{hash
leaveClass="btn-link btn-small chat-channel-card__leave-btn"
labelType="short"
}}
/>
</div>
{{else if this.channel.isJoinable}}
<ToggleChannelMembershipButton
@channel={{this.channel}}
@onToggle={{action "afterMembershipToggle"}}
@options={{hash
joinClass="btn-primary btn-small chat-channel-card__join-btn"
labelType="short"
}}
/>
{{/if}}
{{#if (gt this.channel.membershipsCount 0)}}
<LinkTo
@route="chat.channel.info.members"
@models={{array this.channel.id (slugify-channel this.channel)}}
class="chat-channel-card__members"
tabindex="-1"
>
{{i18n
"chat.channel.memberships_count"
count=this.channel.membershipsCount
}}
</LinkTo>
{{/if}}
</div>
</div>
{{/if}}