gitforge/templates/repo/star_unstar.tmpl
birdgoose 1ab4c8d915 fix(ui): fix HTMX attributes in watch, star, and notification buttons (#12976)
Fixes forgejo/forgejo#12951

The changes are made to the following template files:
- on the repo star/unstar button
- on the repo watch/unwatch button
- on the issue notification button

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12976
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2026-06-28 18:00:15 +02:00

16 lines
1.1 KiB
Go HTML Template

<form hx-target="this" hx-post="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}un{{end}}star" hx-on::after-settle="this.querySelector('button').focus()" method="post" action="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}un{{end}}star">
<div class="ui labeled button" {{if not $.IsSigned}}data-tooltip-content="{{ctx.Locale.Tr "repo.star_guest_user"}}"{{end}}>
<button type="submit" class="ui compact small basic button"{{if not $.IsSigned}} disabled{{end}} aria-label="{{if $.IsStaringRepo}}{{ctx.Locale.Tr "repo.unstar"}}{{else}}{{ctx.Locale.Tr "repo.star"}}{{end}}">
{{if $.IsStaringRepo}}
{{svg "octicon-star-fill"}}<span class="text not-mobile">{{ctx.Locale.Tr "repo.unstar"}}</span>
{{else}}
{{svg "octicon-star"}}<span class="text not-mobile">{{ctx.Locale.Tr "repo.star"}}</span>
{{end}}
</button>
<a hx-boost="false" class="ui basic label" href="{{$.RepoLink}}/stars"
aria-label="{{ctx.Locale.TrPluralString .Repository.NumStars "stars.n_stars" (printf "%d" .Repository.NumStars)}}"
>
{{CountFmt .Repository.NumStars}}
</a>
</div>
</form>