aboutsummaryrefslogtreecommitdiff
path: root/templates/repo/header.tmpl
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2018-12-06 22:58:02 -0500
committerUnknwon <u@gogs.io>2018-12-06 22:58:02 -0500
commitf545faa06d553750b9f4018336e810530389f88c (patch)
treea906d0d46d9f07a093b7eb8faf01e2648b2540b9 /templates/repo/header.tmpl
parent458aadbb10a50948bbc237c5c2ab62d8710d2b4a (diff)
templates: make state changing routes to POST method (#5541)
- pkg/context: add ParamsUser to unify the injection process
Diffstat (limited to 'templates/repo/header.tmpl')
-rw-r--r--templates/repo/header.tmpl38
1 files changed, 22 insertions, 16 deletions
diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl
index d15b5dde..cacda1ed 100644
--- a/templates/repo/header.tmpl
+++ b/templates/repo/header.tmpl
@@ -20,22 +20,28 @@
{{if not $.IsGuest}}
<div class="ui right">
- <div class="ui labeled button" tabindex="0">
- <a class="ui basic button" href="{{$.RepoLink}}/action/{{if $.IsWatchingRepo}}un{{end}}watch?redirect_to={{$.Link}}">
- <i class="eye{{if not $.IsWatchingRepo}} slash outline{{end}} icon"></i>{{if $.IsWatchingRepo}}{{$.i18n.Tr "repo.unwatch"}}{{else}}{{$.i18n.Tr "repo.watch"}}{{end}}
- </a>
- <a class="ui basic label" href="{{.Link}}/watchers">
- {{.NumWatches}}
- </a>
- </div>
- <div class="ui labeled button" tabindex="0">
- <a class="ui basic button" href="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}un{{end}}star?redirect_to={{$.Link}}">
- <i class="star{{if not $.IsStaringRepo}} outline{{end}} icon"></i>{{if $.IsStaringRepo}}{{$.i18n.Tr "repo.unstar"}}{{else}}{{$.i18n.Tr "repo.star"}}{{end}}
- </a>
- <a class="ui basic label" href="{{.Link}}/stars">
- {{.NumStars}}
- </a>
- </div>
+ <form class="display inline" action="{{$.RepoLink}}/action/{{if $.IsWatchingRepo}}un{{end}}watch?redirect_to={{$.Link}}" method="POST">
+ {{$.CSRFTokenHTML}}
+ <div class="ui labeled button" tabindex="0">
+ <button class="ui basic button">
+ <i class="eye{{if not $.IsWatchingRepo}} slash outline{{end}} icon"></i>{{if $.IsWatchingRepo}}{{$.i18n.Tr "repo.unwatch"}}{{else}}{{$.i18n.Tr "repo.watch"}}{{end}}
+ </button>
+ <a class="ui basic label" href="{{.Link}}/watchers">
+ {{.NumWatches}}
+ </a>
+ </div>
+ </form>
+ <form class="display inline" action="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}un{{end}}star?redirect_to={{$.Link}}" method="POST">
+ {{$.CSRFTokenHTML}}
+ <div class="ui labeled button" tabindex="0">
+ <button class="ui basic button">
+ <i class="star{{if not $.IsStaringRepo}} outline{{end}} icon"></i>{{if $.IsStaringRepo}}{{$.i18n.Tr "repo.unstar"}}{{else}}{{$.i18n.Tr "repo.star"}}{{end}}
+ </button>
+ <a class="ui basic label" href="{{.Link}}/stars">
+ {{.NumStars}}
+ </a>
+ </div>
+ </form>
{{if .CanBeForked}}
<div class="ui labeled button" tabindex="0">
<a class="ui basic button {{if eq .OwnerID $.LoggedUserID}}poping up{{end}}" href="{{AppSubURL}}/repo/fork/{{.ID}}">