Following up fixes for "Fix inconsistent user profile layout across tabs" (#25739)

Follow
https://github.com/go-gitea/gitea/pull/25625#issuecomment-1621577816

1. Fix the incorrect "project view" layout
2. Fix the "follow/unfollow" link on "packages" and "projects" tab


Before:


![image](https://github.com/go-gitea/gitea/assets/2114189/3b071235-c186-4097-8a19-dd90dcb2a344)


After:


![image](https://github.com/go-gitea/gitea/assets/2114189/d1d23cd7-28d8-43e3-9f68-03e8a34a9b97)

---------

Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
wxiaoguang 2023-07-07 23:27:12 +08:00 committed by GitHub
parent a6a9389c70
commit 128d77a3a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 28 deletions

View file

@ -287,9 +287,9 @@ func Action(ctx *context.Context) {
} }
if err != nil { if err != nil {
ctx.ServerError(fmt.Sprintf("Action (%s)", ctx.FormString("action")), err) log.Error("Failed to apply action %q: %v", ctx.FormString("action"), err)
ctx.JSONError(fmt.Sprintf("Action %q failed", ctx.FormString("action")))
return return
} }
// FIXME: We should check this URL and make sure that it's a valid Gitea URL ctx.JSONOK()
ctx.RedirectToFirst(ctx.FormString("redirect_to"), ctx.ContextUser.HomeLink())
} }

View file

@ -20,16 +20,13 @@
</div> </div>
</div> </div>
<div class="right menu"> <div class="right menu">
<form method="post" action="{{.Link}}?action={{if $.IsFollowing}}unfollow{{else}}follow{{end}}&redirect_to={{$.Link}}"> <button class="link-action ui basic button gt-mr-0" data-url="{{.Org.HomeLink}}?action={{if $.IsFollowing}}unfollow{{else}}follow{{end}}">
{{$.CsrfTokenHtml}}
<button type="submit" class="ui basic button gt-mr-0">
{{if $.IsFollowing}} {{if $.IsFollowing}}
{{.locale.Tr "user.unfollow"}} {{.locale.Tr "user.unfollow"}}
{{else}} {{else}}
{{.locale.Tr "user.follow"}} {{.locale.Tr "user.follow"}}
{{end}} {{end}}
</button> </button>
</form>
</div> </div>
</div> </div>

View file

@ -1,5 +1,5 @@
{{template "base/head" .}} {{template "base/head" .}}
<div role="main" aria-label="{{.Title}}" class="page-content repository packages"> <div role="main" aria-label="{{.Title}}" class="page-content repository projects view-project">
{{template "shared/user/org_profile_avatar" .}} {{template "shared/user/org_profile_avatar" .}}
<div class="ui container"> <div class="ui container">
{{template "user/overview/header" .}} {{template "user/overview/header" .}}

View file

@ -1,5 +1,3 @@
<div role="main" aria-label="{{.Title}}" class="page-content repository projects view-project">
<div class="ui container">
<div class="ui two column stackable grid"> <div class="ui two column stackable grid">
<div class="column"> <div class="column">
</div> </div>
@ -70,8 +68,8 @@
{{end}} {{end}}
</div> </div>
<div class="divider"></div> <div class="divider"></div>
</div>
<div class="ui container fluid padded" id="project-board"> <div id="project-board">
<div class="board {{if .CanWriteProjects}}sortable{{end}}"> <div class="board {{if .CanWriteProjects}}sortable{{end}}">
{{range $board := .Boards}} {{range $board := .Boards}}
@ -253,8 +251,6 @@
</div> </div>
</div>
{{if .CanWriteProjects}} {{if .CanWriteProjects}}
<div class="ui g-modal-confirm delete modal"> <div class="ui g-modal-confirm delete modal">
<div class="header"> <div class="header">

View file

@ -99,15 +99,13 @@
{{if and .IsSigned (ne .SignedUserID .ContextUser.ID)}} {{if and .IsSigned (ne .SignedUserID .ContextUser.ID)}}
<li class="follow"> <li class="follow">
{{if $.IsFollowing}} {{if $.IsFollowing}}
<form method="post" action="{{.Link}}?action=unfollow&redirect_to={{$.Link}}"> <button class="ui basic red button link-action" data-url="{{.ContextUser.HomeLink}}?action=unfollow">
{{$.CsrfTokenHtml}} {{svg "octicon-person"}} {{.locale.Tr "user.unfollow"}}
<button type="submit" class="ui basic red button">{{svg "octicon-person"}} {{.locale.Tr "user.unfollow"}}</button> </button>
</form>
{{else}} {{else}}
<form method="post" action="{{.Link}}?action=follow&redirect_to={{$.Link}}"> <button class="ui basic green button link-action" data-url="{{.ContextUser.HomeLink}}?action=follow">
{{$.CsrfTokenHtml}} {{svg "octicon-person"}} {{.locale.Tr "user.follow"}}
<button type="submit" class="ui basic green button">{{svg "octicon-person"}} {{.locale.Tr "user.follow"}}</button> </button>
</form>
{{end}} {{end}}
</li> </li>
{{end}} {{end}}