diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-03-04 20:56:34 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-04 12:56:34 +0000 |
commit | 62aa5e2cbd64c90546bbaf849070b42931a4e60b (patch) | |
tree | cb68a175a5145409f0bea9e2b7c26002d25af607 /templates/repo/watch_unwatch.tmpl | |
parent | dae7f1ebdbe19620f40e110b285f7c0ecd0bb33b (diff) | |
download | gitea-62aa5e2cbd64c90546bbaf849070b42931a4e60b.tar.gz gitea-62aa5e2cbd64c90546bbaf849070b42931a4e60b.zip |
Refactor star/watch button (#29576)
1. Use "star/unstart", but not `{{if}}un{{}}star{{}}` (the same to "watch/unwatch")
2. Use "not-mobile" for hiding the elements on mobile
Diffstat (limited to 'templates/repo/watch_unwatch.tmpl')
-rw-r--r-- | templates/repo/watch_unwatch.tmpl | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/templates/repo/watch_unwatch.tmpl b/templates/repo/watch_unwatch.tmpl index c42bc5a9e7..2bf2c7bd21 100644 --- a/templates/repo/watch_unwatch.tmpl +++ b/templates/repo/watch_unwatch.tmpl @@ -1,11 +1,10 @@ -<form hx-boost="true" hx-target="this" method="post" action="{{$.RepoLink}}/action/{{if $.IsWatchingRepo}}un{{end}}watch"> +<form hx-boost="true" hx-target="this" method="post" action="{{$.RepoLink}}/action/{{if $.IsWatchingRepo}}unwatch{{else}}watch{{end}}"> <div class="ui labeled button" {{if not $.IsSigned}}data-tooltip-content="{{ctx.Locale.Tr "repo.watch_guest_user"}}"{{end}}> - <button type="submit" class="ui compact small basic button"{{if not $.IsSigned}} disabled{{end}}> - {{if $.IsWatchingRepo}} - {{svg "octicon-eye-closed" 16}}<span class="text">{{ctx.Locale.Tr "repo.unwatch"}}</span> - {{else}} - {{svg "octicon-eye"}}<span class="text">{{ctx.Locale.Tr "repo.watch"}}</span> - {{end}} + {{$buttonText := ctx.Locale.Tr "repo.watch"}} + {{if $.IsWatchingRepo}}{{$buttonText = ctx.Locale.Tr "repo.unwatch"}}{{end}} + <button type="submit" class="ui compact small basic button"{{if not $.IsSigned}} disabled{{end}} aria-label="{{$buttonText}}"> + {{if $.IsWatchingRepo}}{{svg "octicon-eye-closed"}}{{else}}{{svg "octicon-eye"}}{{end}} + <span class="not-mobile" aria-hidden="true">{{$buttonText}}</span> </button> <a hx-boost="false" class="ui basic label" href="{{.RepoLink}}/watchers"> {{CountFmt .Repository.NumWatches}} |