diff options
author | Unknwon <u@gogs.io> | 2018-12-06 22:58:02 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2018-12-06 22:58:02 -0500 |
commit | f545faa06d553750b9f4018336e810530389f88c (patch) | |
tree | a906d0d46d9f07a093b7eb8faf01e2648b2540b9 /templates/user/profile.tmpl | |
parent | 458aadbb10a50948bbc237c5c2ab62d8710d2b4a (diff) |
templates: make state changing routes to POST method (#5541)
- pkg/context: add ParamsUser to unify the injection process
Diffstat (limited to 'templates/user/profile.tmpl')
-rw-r--r-- | templates/user/profile.tmpl | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl index d60fce56..285aa12c 100644 --- a/templates/user/profile.tmpl +++ b/templates/user/profile.tmpl @@ -5,12 +5,12 @@ <div class="ui five wide column"> <div class="ui card"> {{if eq .LoggedUserName .Owner.Name}} - <a class="image poping up" href="{{AppSubURL}}/user/settings/avatar" id="profile-avatar" data-content="{{.i18n.Tr "user.change_avatar"}}" data-variation="inverted tiny" data-position="bottom center"> - <img src="{{AppendAvatarSize .Owner.RelAvatarLink 290}}" title="{{.Owner.Name}}"/> + <a class="profile-avatar image poping up" href="{{AppSubURL}}/user/settings/avatar" id="profile-avatar" data-content="{{.i18n.Tr "user.change_avatar"}}" data-variation="inverted tiny" data-position="bottom center"> + <img src="{{AppendAvatarSize .Owner.RelAvatarLink 287}}" title="{{.Owner.Name}}"/> </a> {{else}} - <span class="image"> - <img src="{{AppendAvatarSize .Owner.RelAvatarLink 290}}" title="{{.Owner.Name}}"/> + <span class="profile-avatar image"> + <img src="{{AppendAvatarSize .Owner.RelAvatarLink 287}}" title="{{.Owner.Name}}"/> </span> {{end}} <div class="content"> @@ -61,13 +61,23 @@ </li> {{end}} {{if and .IsLogged (ne .LoggedUserName .Owner.Name)}} - <li class="follow"> - {{if .LoggedUser.IsFollowing .Owner.ID}} - <a class="ui basic red button" href="{{.Link}}/action/unfollow?redirect_to={{$.Link}}"><i class="octicon octicon-person"></i> {{.i18n.Tr "user.unfollow"}}</a> - {{else}} - <a class="ui basic green button" href="{{.Link}}/action/follow?redirect_to={{$.Link}}"><i class="octicon octicon-person"></i> {{.i18n.Tr "user.follow"}}</a> - {{end}} - </li> + <li class="follow"> + {{if .LoggedUser.IsFollowing .Owner.ID}} + <form action="{{.Link}}/action/unfollow?redirect_to={{$.Link}}" method="POST"> + {{.CSRFTokenHTML}} + <button class="ui basic red button"> + <i class="octicon octicon-person"></i> {{.i18n.Tr "user.unfollow"}} + </button> + </form> + {{else}} + <form action="{{.Link}}/action/follow?redirect_to={{$.Link}}" method="POST"> + {{.CSRFTokenHTML}} + <button class="ui basic green button"> + <i class="octicon octicon-person"></i> {{.i18n.Tr "user.follow"}} + </button> + </form> + {{end}} + </li> {{end}} </ul> </div> |