mirror of
1
Fork 0
forgejo/templates/repo/issue/view_content/reactions.tmpl

27 lines
1.1 KiB
Go HTML Template

<div class="ui attached segment reactions" data-action-url="{{$.ActionURL}}">
{{range $key, $value := .Reactions}}
{{$hasReacted := $value.HasUser $.ctxData.SignedUserID}}
<a role="button" class="ui label basic{{if $hasReacted}} primary{{end}}{{if not $.ctxData.IsSigned}} disabled{{end}} comment-reaction-button"
title="{{$value.GetFirstUsers}}"
aria-label="
{{if eq ($value.GetMoreUserCount) 0}}
{{ctx.Locale.Tr "repo.issues.reaction.alt_few" $value.GetFirstUsers $key}}
{{else}}
{{ctx.Locale.Tr "repo.issues.reaction.alt_many" $value.GetFirstUsers $value.GetMoreUserCount $key}}
{{end}}
{{if $hasReacted}}
{{ctx.Locale.Tr "repo.issues.reaction.alt_remove" $key}}
{{else}}
{{ctx.Locale.Tr "repo.issues.reaction.alt_add" $key}}
{{end}}"
data-tooltip-placement="bottom-start"
data-reaction-content="{{$key}}" data-has-reacted="{{$hasReacted}}">
<span class="reaction">{{ReactionToEmoji $key}}</span>
<span class="reaction-count">{{len $value}}</span>
</a>
{{end}}
{{if AllowedReactions}}
{{template "repo/issue/view_content/add_reaction" dict "ctxData" $.ctxData "ActionURL" .ActionURL}}
{{end}}
</div>