mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-07 03:53:54 +02:00
Make the watch, star, and fork buttons in the repo header consistent for logged-out users: - Apply the same look to all three buttons (number labels included), instead of only the action button being grayed. - Clicking any of them while logged out now leads to the login page (with a redirect back) instead of being inert. - Split the per-button markup out of `header.tmpl` into a dedicated `templates/repo/header/` folder (`fork.tmpl`, `star.tmpl`, `watch.tmpl`). --------- Co-authored-by: Claude (Opus 4.7) <noreply@anthropic.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
20 lines
794 B
Handlebars
20 lines
794 B
Handlebars
<div class="ui labeled button" {{if not $.IsSigned}}data-tooltip-content="{{ctx.Locale.Tr "repo.watch_guest_user"}}"{{end}}>
|
|
{{$buttonText := ctx.Locale.Tr "repo.watch"}}
|
|
{{if $.IsWatchingRepo}}{{$buttonText = ctx.Locale.Tr "repo.unwatch"}}{{end}}
|
|
<a role="button" class="ui compact small basic button" aria-label="{{$buttonText}}"
|
|
{{if $.IsSigned}}
|
|
data-fetch-method="post"
|
|
data-fetch-url="{{$.RepoLink}}/action/{{if $.IsWatchingRepo}}unwatch{{else}}watch{{end}}"
|
|
data-fetch-sync="$closest(.ui.labeled.button)"
|
|
{{else}}
|
|
href="{{AppSubUrl}}/user/login"
|
|
{{end}}
|
|
>
|
|
{{svg "octicon-eye"}}
|
|
<span class="not-mobile" aria-hidden="true">{{$buttonText}}</span>
|
|
</a>
|
|
<a class="ui basic label" href="{{$.RepoLink}}/watchers">
|
|
{{CountFmt .Repository.NumWatches}}
|
|
</a>
|
|
</div>
|