]> source.dussan.org Git - gitea.git/commitdiff
Following up fixes for "Fix inconsistent user profile layout across tabs" (#25739)
authorwxiaoguang <wxiaoguang@gmail.com>
Fri, 7 Jul 2023 15:27:12 +0000 (23:27 +0800)
committerGitHub <noreply@github.com>
Fri, 7 Jul 2023 15:27:12 +0000 (17:27 +0200)
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>
routers/web/user/profile.go
templates/org/home.tmpl
templates/org/projects/view.tmpl
templates/projects/view.tmpl
templates/shared/user/profile_big_avatar.tmpl

index 442fd0433a72c092c2554f3b70be76500fe5f14c..07a2261c967d3c866d2e04664cde31eeee958895 100644 (file)
@@ -287,9 +287,9 @@ func Action(ctx *context.Context) {
        }
 
        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
        }
-       // FIXME: We should check this URL and make sure that it's a valid Gitea URL
-       ctx.RedirectToFirst(ctx.FormString("redirect_to"), ctx.ContextUser.HomeLink())
+       ctx.JSONOK()
 }
index 7f52b8cc6dcab5c93e0e4f4dccb346ead2bfb7e9..967b31e7a8f5eaada04bf74ae936cdddde65f4b9 100644 (file)
                        </div>
                </div>
                <div class="right menu">
-                       <form method="post" action="{{.Link}}?action={{if $.IsFollowing}}unfollow{{else}}follow{{end}}&redirect_to={{$.Link}}">
-                               {{$.CsrfTokenHtml}}
-                               <button type="submit" class="ui basic button gt-mr-0">
-                                       {{if $.IsFollowing}}
-                                               {{.locale.Tr "user.unfollow"}}
-                                       {{else}}
-                                               {{.locale.Tr "user.follow"}}
-                                       {{end}}
-                               </button>
-                       </form>
+                       <button class="link-action ui basic button gt-mr-0" data-url="{{.Org.HomeLink}}?action={{if $.IsFollowing}}unfollow{{else}}follow{{end}}">
+                               {{if $.IsFollowing}}
+                                       {{.locale.Tr "user.unfollow"}}
+                               {{else}}
+                                       {{.locale.Tr "user.follow"}}
+                               {{end}}
+                       </button>
                </div>
        </div>
 
index ef8ec2422524ff8b8fc47c64923efdbff728c107..33346b61544b8f5e44cabfd176ad9ff5a5ba71b6 100644 (file)
@@ -1,5 +1,5 @@
 {{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" .}}
        <div class="ui container">
        {{template "user/overview/header" .}}
index 59fa1870f884e6b30704bedd127f475ac85bad3d..2f0556856f39084aabe482acb1c68f62ed1153f8 100644 (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="column">
                        </div>
@@ -70,8 +68,8 @@
                        {{end}}
                </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}}">
                        {{range $board := .Boards}}
 
        </div>
 
-</div>
-
 {{if .CanWriteProjects}}
        <div class="ui g-modal-confirm delete modal">
                <div class="header">
index 408877e481e862adc061883937bffb8027dfa8a4..5a1e43b88e351160bf80da38c40374ea4a11f9e7 100644 (file)
                        {{if and .IsSigned (ne .SignedUserID .ContextUser.ID)}}
                        <li class="follow">
                                {{if $.IsFollowing}}
-                                       <form method="post" action="{{.Link}}?action=unfollow&redirect_to={{$.Link}}">
-                                               {{$.CsrfTokenHtml}}
-                                               <button type="submit" class="ui basic red button">{{svg "octicon-person"}} {{.locale.Tr "user.unfollow"}}</button>
-                                       </form>
+                                       <button class="ui basic red button link-action" data-url="{{.ContextUser.HomeLink}}?action=unfollow">
+                                               {{svg "octicon-person"}} {{.locale.Tr "user.unfollow"}}
+                                       </button>
                                {{else}}
-                                       <form method="post" action="{{.Link}}?action=follow&redirect_to={{$.Link}}">
-                                               {{$.CsrfTokenHtml}}
-                                               <button type="submit" class="ui basic green button">{{svg "octicon-person"}} {{.locale.Tr "user.follow"}}</button>
-                                       </form>
+                                       <button class="ui basic green button link-action" data-url="{{.ContextUser.HomeLink}}?action=follow">
+                                               {{svg "octicon-person"}} {{.locale.Tr "user.follow"}}
+                                       </button>
                                {{end}}
                        </li>
                        {{end}}