-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Fix ::User Profile Page - Project/Packages Tabs Have Inconsistent Layout #25108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
095c30c
e863960
e0813ef
e66e26d
91906db
ee7b36d
f51c22d
75f9726
8fc29fe
cc79eba
b887c71
449462b
cac6f0d
3b21c82
c64bbb1
127ae11
11d473d
c62a81c
3a0a73f
6c990c4
59c21a4
a906f9b
f3762b4
75961e1
7c8eda1
3ec39d8
c65e84c
f437075
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -11,6 +11,7 @@ import ( | |||
"code.gitea.io/gitea/modules/context" | ||||
code_indexer "code.gitea.io/gitea/modules/indexer/code" | ||||
"code.gitea.io/gitea/modules/setting" | ||||
"code.gitea.io/gitea/routers/web/shared/user" | ||||
) | ||||
|
||||
const ( | ||||
|
@@ -19,17 +20,16 @@ const ( | |||
|
||||
// CodeSearch render user/organization code search page | ||||
func CodeSearch(ctx *context.Context) { | ||||
user.RenderProfileBigAvatar(ctx) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The name and usage seems not ideal.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct, and I am even in favour of changing the naming pattern, but when I see https://github.com/go-gitea/gitea/pull/25108/files/6c990c4da74a329f700ffffaa5ddfa1d6195fd7b#diff-f4279417070a8e33829c338abeb42877500377f490abb1495ae6357d50b6a765R92 in the same function doing something like that and implementation looks like this gitea/routers/web/shared/user/header.go Line 13 in e24f651
I don't want to break the pattern, if you are suggesting an explicit change in function, that I can. In short maintainability is the real concern here. Could you suggest something which is easier for maintainers. I have less knowledge on naming conventions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, the old code is buggy, so I won't say it is a must now. |
||||
if !setting.Indexer.RepoIndexerEnabled { | ||||
ctx.Redirect(ctx.ContextUser.HomeLink()) | ||||
return | ||||
} | ||||
|
||||
ctx.Data["IsProjectEnabled"] = true | ||||
ctx.Data["IsPackageEnabled"] = setting.Packages.Enabled | ||||
ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled | ||||
ctx.Data["Title"] = ctx.Tr("explore.code") | ||||
ctx.Data["ContextUser"] = ctx.ContextUser | ||||
|
||||
language := ctx.FormTrim("l") | ||||
keyword := ctx.FormTrim("q") | ||||
|
||||
|
@@ -109,6 +109,5 @@ func CodeSearch(ctx *context.Context) { | |||
pager.SetDefaultParams(ctx) | ||||
pager.AddParam(ctx, "l", "Language") | ||||
ctx.Data["Page"] = pager | ||||
|
||||
ctx.HTML(http.StatusOK, tplUserCode) | ||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,23 @@ | ||
{{template "base/head" .}} | ||
<div role="main" aria-label="{{.Title}}" class="page-content repository packages"> | ||
{{template "user/overview/header" .}} | ||
{{template "projects/list" .}} | ||
</div> | ||
{{if .ContextUser.IsOrganization}} | ||
<div role="main" aria-label="{{.Title}}" class="page-content repository packages"> | ||
{{template "shared/user/profile_big_avatar" .}} | ||
{{template "user/overview/header" .}} | ||
{{template "projects/list" .}} | ||
</div> | ||
{{else}} | ||
<div role="main" aria-label="{{.Title}}" class="page-content user profile"> | ||
<div class="ui container"> | ||
<div class="ui stackable grid"> | ||
<div class="ui four wide column"> | ||
{{template "shared/user/profile_big_avatar" .}} | ||
</div> | ||
<div class="ui twelve wide column"> | ||
{{template "user/overview/header" .}} | ||
{{template "projects/list" .}} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{{end}} | ||
{{template "base/footer" .}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<div role="main" aria-label="{{.Title}}" class="page-content repository projects"> | ||
<div class="ui container"> | ||
<div class="ui{{if .ContextUser.IsOrganization}} container{{end}}"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's too hacky. Why "IsOrganization" means "container"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If possible, remove the container. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately container cannot be removed, it is hacky beause we are sharing this between repository and orgransation page. I tried removing it but it will mass the whole project tab design in org view. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, it might be an acceptable compromise then. Didn't check the details. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My opinion is that these |
||
{{if .CanWriteProjects}} | ||
<div class="navbar"> | ||
<div class="ui right"> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
{{if .ContextUser.IsOrganization}} | ||
{{with .ContextUser}} | ||
<div class="ui container"> | ||
<div class="ui vertically grid head"> | ||
<div class="column"> | ||
<div class="ui header"> | ||
{{avatar $.Context . 100}} | ||
<span class="text thin grey"><a href="{{.HomeLink}}">{{.DisplayName}}</a></span> | ||
<span class="org-visibility"> | ||
{{if .Visibility.IsLimited}}<div class="ui medium basic horizontal label">{{$.locale.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}} | ||
{{if .Visibility.IsPrivate}}<div class="ui medium basic horizontal label">{{$.locale.Tr "org.settings.visibility.private_shortname"}}</div>{{end}} | ||
</span> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{{end}} | ||
{{else}} | ||
<div class="ui card"> | ||
<div id="profile-avatar" class="content gt-df"> | ||
{{if eq .SignedUserID .ContextUser.ID}} | ||
<a class="image" href="{{AppSubUrl}}/user/settings" data-tooltip-content="{{.locale.Tr "user.change_avatar"}}"> | ||
{{/* the size doesn't take affect (and no need to take affect), image size(width) should be controlled by the parent container since this is not a flex layout*/}} | ||
{{avatar $.Context .ContextUser 256}} | ||
</a> | ||
{{else}} | ||
<span class="image"> | ||
{{avatar $.Context .ContextUser 256}} | ||
</span> | ||
{{end}} | ||
</div> | ||
<div class="content gt-word-break profile-avatar-name"> | ||
{{if .ContextUser.FullName}}<span class="header text center">{{.ContextUser.FullName}}</span>{{end}} | ||
<span class="username text center">{{.ContextUser.Name}}</span> | ||
{{if .EnableFeed}} | ||
<a href="{{.ContextUser.HomeLink}}.rss"><i class="ui text grey gt-ml-3" data-tooltip-content="{{.locale.Tr "rss_feed"}}">{{svg "octicon-rss" 18}}</i></a> | ||
{{end}} | ||
<div class="gt-mt-3"> | ||
<a class="muted" href="{{.ContextUser.HomeLink}}?tab=followers">{{svg "octicon-person" 18 "gt-mr-2"}}{{.NumFollowers}} {{.locale.Tr "user.followers"}}</a> · <a class="muted" href="{{.ContextUser.HomeLink}}?tab=following">{{.NumFollowing}} {{.locale.Tr "user.following"}}</a> | ||
</div> | ||
</div> | ||
<div class="extra content gt-word-break"> | ||
<ul> | ||
{{if .ContextUser.Location}} | ||
<li>{{svg "octicon-location"}} {{.ContextUser.Location}}</li> | ||
{{end}} | ||
{{if (eq .SignedUserID .ContextUser.ID)}} | ||
<li> | ||
{{svg "octicon-mail"}} | ||
<a href="mailto:{{.ContextUser.Email}}" rel="nofollow">{{.ContextUser.Email}}</a> | ||
<a href="{{AppSubUrl}}/user/settings#keep-email-private"> | ||
{{if .ShowUserEmail}} | ||
<i class="ui right" data-tooltip-content="{{.locale.Tr "user.email_visibility.limited"}}"> | ||
{{svg "octicon-unlock"}} | ||
</i> | ||
{{else}} | ||
<i class="ui right" data-tooltip-content="{{.locale.Tr "user.email_visibility.private"}}"> | ||
{{svg "octicon-lock"}} | ||
</i> | ||
{{end}} | ||
</a> | ||
</li> | ||
{{else}} | ||
{{if .ShowUserEmail}} | ||
<li> | ||
{{svg "octicon-mail"}} | ||
<a href="mailto:{{.ContextUser.Email}}" rel="nofollow">{{.ContextUser.Email}}</a> | ||
</li> | ||
{{end}} | ||
{{end}} | ||
{{if .ContextUser.Website}} | ||
<li> | ||
{{svg "octicon-link"}} | ||
<a target="_blank" rel="noopener noreferrer me" href="{{.ContextUser.Website}}">{{.ContextUser.Website}}</a> | ||
</li> | ||
{{end}} | ||
{{if $.RenderedDescription}} | ||
<li> | ||
<div class="render-content markup">{{$.RenderedDescription|Str2html}}</div> | ||
</li> | ||
{{end}} | ||
{{range .OpenIDs}} | ||
{{if .Show}} | ||
<li> | ||
{{svg "fontawesome-openid"}} | ||
<a target="_blank" rel="noopener noreferrer" href="{{.URI}}">{{.URI}}</a> | ||
</li> | ||
{{end}} | ||
{{end}} | ||
<li>{{svg "octicon-clock"}} {{.locale.Tr "user.joined_on" (DateTime "short" .ContextUser.CreatedUnix) | Safe}}</li> | ||
{{if and .Orgs .HasOrgsVisible}} | ||
<li> | ||
<ul class="user-orgs"> | ||
{{range .Orgs}} | ||
{{if (or .Visibility.IsPublic (and ($.SignedUser) (or .Visibility.IsLimited (and (.HasMemberWithUserID $.SignedUserID) .Visibility.IsPrivate) ($.IsAdmin))))}} | ||
<li> | ||
<a href="{{.HomeLink}}" data-tooltip-content="{{.Name}}"> | ||
{{avatar $.Context .}} | ||
</a> | ||
</li> | ||
{{end}} | ||
{{end}} | ||
</ul> | ||
</li> | ||
{{end}} | ||
{{if .Badges}} | ||
<li> | ||
<ul class="user-badges"> | ||
{{range .Badges}} | ||
<li> | ||
<img width="64" height="64" src="{{.ImageURL}}" alt="{{.Description}}" data-tooltip-content="{{.Description}}"> | ||
</li> | ||
{{end}} | ||
</ul> | ||
</li> | ||
{{end}} | ||
{{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> | ||
{{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> | ||
{{end}} | ||
</li> | ||
{{end}} | ||
</ul> | ||
</div> | ||
</div> | ||
{{end}} |
Uh oh!
There was an error while loading. Please reload this page.