1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-31 22:58:35 +00:00

code optimization (#31315)

Simplifying complex if-else to existing Iif operations
This commit is contained in:
Kerwin Bryant
2024-06-11 21:07:10 +08:00
committed by GitHub
parent 397930d8c1
commit e6ab6e637f
14 changed files with 90 additions and 48 deletions

View File

@@ -3,7 +3,7 @@
{{$buttonText := ctx.Locale.Tr "repo.star"}}
{{if $.IsStaringRepo}}{{$buttonText = ctx.Locale.Tr "repo.unstar"}}{{end}}
<button type="submit" class="ui compact small basic button"{{if not $.IsSigned}} disabled{{end}} aria-label="{{$buttonText}}">
{{if $.IsStaringRepo}}{{svg "octicon-star-fill"}}{{else}}{{svg "octicon-star"}}{{end}}
{{svg (Iif $.IsStaringRepo "octicon-star-fill" "octicon-star")}}
<span aria-hidden="true">{{$buttonText}}</span>
</button>
<a hx-boost="false" class="ui basic label" href="{{$.RepoLink}}/stars">