Browse Source

Merge branch 'V20211213' into zouap

pull/1063/head
zouap 3 years ago
parent
commit
eb8ee48657
4 changed files with 68 additions and 6 deletions
  1. +1
    -0
      public/img/member.svg
  2. +1
    -0
      public/img/pro_num.svg
  3. +8
    -1
      routers/user/profile.go
  4. +58
    -5
      templates/user/profile.tmpl

+ 1
- 0
public/img/member.svg View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="120" height="120"><path fill="none" d="M0 0h24v24H0z"/><path d="M20 22h-2v-2a3 3 0 0 0-3-3H9a3 3 0 0 0-3 3v2H4v-2a5 5 0 0 1 5-5h6a5 5 0 0 1 5 5v2zm-8-9a6 6 0 1 1 0-12 6 6 0 0 1 0 12zm0-2a4 4 0 1 0 0-8 4 4 0 0 0 0 8z" fill="rgba(0,0,0,0.4)"/></svg>

+ 1
- 0
public/img/pro_num.svg View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="120" height="120"><path fill="none" d="M0 0h24v24H0z"/><path d="M20 3l2 4v13a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V7.004L4 3h16zm0 6H4v10h16V9zm-8 1l4 4h-3v4h-2v-4H8l4-4zm6.764-5H5.236l-.999 2h15.527l-1-2z" fill="rgba(0,0,0,0.4)"/></svg>

+ 8
- 1
routers/user/profile.go View File

@@ -6,6 +6,7 @@
package user package user


import ( import (
"errors"
"fmt" "fmt"
"path" "path"
"strings" "strings"
@@ -107,6 +108,9 @@ func Profile(ctx *context.Context) {
ctx.Data["HasOrgsVisible"] = models.HasOrgsVisible(orgs, ctx.User) ctx.Data["HasOrgsVisible"] = models.HasOrgsVisible(orgs, ctx.User)


tab := ctx.Query("tab") tab := ctx.Query("tab")
if tab == "" {
tab = "activity"
}
ctx.Data["TabName"] = tab ctx.Data["TabName"] = tab


page := ctx.QueryInt("page") page := ctx.QueryInt("page")
@@ -235,7 +239,7 @@ func Profile(ctx *context.Context) {
} }
total = int(count) total = int(count)
ctx.Data["Datasets"] = datasets ctx.Data["Datasets"] = datasets
default:
case "repository":
repos, count, err = models.SearchRepository(&models.SearchRepoOptions{ repos, count, err = models.SearchRepository(&models.SearchRepoOptions{
ListOptions: models.ListOptions{ ListOptions: models.ListOptions{
PageSize: setting.UI.User.RepoPagingNum, PageSize: setting.UI.User.RepoPagingNum,
@@ -256,6 +260,9 @@ func Profile(ctx *context.Context) {
} }


total = int(count) total = int(count)
default:
ctx.ServerError("tab error", errors.New("tab error"))
return
} }
ctx.Data["Repos"] = repos ctx.Data["Repos"] = repos
ctx.Data["Total"] = total ctx.Data["Total"] = total


+ 58
- 5
templates/user/profile.tmpl View File

@@ -50,16 +50,46 @@
{{end}} {{end}}
<li>{{svg "octicon-clock" 16}} {{.i18n.Tr "user.join_on"}} {{.Owner.CreatedUnix.FormatShort}}</li> <li>{{svg "octicon-clock" 16}} {{.i18n.Tr "user.join_on"}} {{.Owner.CreatedUnix.FormatShort}}</li>
{{if and .Orgs .HasOrgsVisible}} {{if and .Orgs .HasOrgsVisible}}
<li>
<ul class="user-orgs">
<li style="border-bottom: none;padding-bottom: 0;"><div style="border-bottom: 1px solid #eaeaea;padding-top: 5px;padding-bottom:5px"> <b> 组织</b></div></li>
<li style="padding-bottom: 0px;">
<!-- <ul class="user-orgs">
{{range .Orgs}} {{range .Orgs}}
{{if (or .Visibility.IsPublic (and ($.SignedUser) (or .Visibility.IsLimited (and (.IsUserPartOfOrg $.SignedUserID) .Visibility.IsPrivate) ($.IsAdmin))))}} {{if (or .Visibility.IsPublic (and ($.SignedUser) (or .Visibility.IsLimited (and (.IsUserPartOfOrg $.SignedUserID) .Visibility.IsPrivate) ($.IsAdmin))))}}
<li> <li>
<a href="{{.HomeLink}}"><img class="ui image poping up" src="{{.RelAvatarLink}}" data-content="{{.Name}}" data-position="top center" data-variation="tiny inverted"></a>
<ul>
<a href="{{.HomeLink}}"><img class="ui image poping up" src="{{.RelAvatarLink}}" data-content="{{.Name}}" data-position="top center" data-variation="tiny inverted"></a>
<span>{{.Name}}</span>
</ul>
</li> </li>
{{end}} {{end}}
{{end}} {{end}}
</ul>
</ul> -->
{{range .Orgs}}
<ul class="user-orgs">
{{if (or .Visibility.IsPublic (and ($.SignedUser) (or .Visibility.IsLimited (and (.IsUserPartOfOrg $.SignedUserID) .Visibility.IsPrivate) ($.IsAdmin))))}}
<li class="infor" style="width: 15%;" >
<a href="{{.HomeLink}}"><img class="ui image poping up" src="{{.RelAvatarLink}}" data-content="{{.Name}}" data-position="top center" data-variation="tiny inverted"></a>
</li>
<li class="infor" style="width: 35%;">
<a class="ui image poping up" style="color: #0366D6;overflow: hidden; white-space: nowrap; text-overflow: ellipsis;" href="{{.HomeLink}}" data-content="{{.Name}}" data-position="top center" data-variation="tiny inverted">{{.Name}}</a>
</li>
<li class="infor" style="width: 25%;">
<img style="width: 14px; height: 14px;border: none;" src="/img/member.svg" >
<span style="color: rgba(0,0,0,.4);padding-left: 5px;">{{.NumMembers}}</span>
</li>
<li class="infor" style="width: 25%;">
<img style="width: 14px; height: 14px" src="/img/pro_num.svg" >
<span style="color: rgba(0,0,0,.4);padding-left: 5px;">{{.NumRepos}}</span>
</li>
{{end}}
</ul>
{{end}}
</li> </li>
{{end}} {{end}}
{{if and .IsSigned (ne .SignedUserName .Owner.Name)}} {{if and .IsSigned (ne .SignedUserName .Owner.Name)}}
@@ -83,7 +113,11 @@
</div> </div>
<div class="ui eleven wide column"> <div class="ui eleven wide column">
<div class="ui secondary stackable pointing menu"> <div class="ui secondary stackable pointing menu">
<a class='{{if and (ne .TabName "datasets") (ne .TabName "activity") (ne .TabName "following") (ne .TabName "followers") (ne .TabName "stars")}}active{{end}} item' href="{{.Owner.HomeLink}}">
<!-- <a class='{{if and (ne .TabName "datasets") (ne .TabName "activity") (ne .TabName "following") (ne .TabName "followers") (ne .TabName "stars")}}active{{end}} item' href="{{.Owner.HomeLink}}">
{{svg "octicon-repo" 16}} {{.i18n.Tr "user.repositories"}}
</a> -->
<a class='{{if eq .TabName "repository" }}active{{end}} item' href="{{.Owner.HomeLink}}?tab=repository">
{{svg "octicon-repo" 16}} {{.i18n.Tr "user.repositories"}} {{svg "octicon-repo" 16}} {{.i18n.Tr "user.repositories"}}
</a> </a>
<a class='{{if eq .TabName "datasets"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=datasets"> <a class='{{if eq .TabName "datasets"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=datasets">
@@ -144,3 +178,22 @@
</div> </div>
</div> </div>
{{template "base/footer" .}} {{template "base/footer" .}}

<style>
.infor{
margin: auto 0;
}
.user-orgs{
padding: 10px 0px;
}
.user-orgs li{
max-width: 50%;
float: right;
}
.user.profile .ui.card .extra.content ul {
padding: 5px 0;
}

</style>

Loading…
Cancel
Save