Browse Source

fix #1960

pull/1962/head
Unknwon 9 years ago
parent
commit
5dc3dd1704
  1. 2
      README.md
  2. 7
      cmd/web.go
  3. 2
      gogs.go
  4. 2
      models/user.go
  5. 4
      modules/avatar/avatar.go
  6. 34
      public/css/gogs.css
  7. 3
      public/less/_base.less
  8. 10
      public/less/_explore.less
  9. 25
      public/less/_user.less
  10. 2
      templates/.VERSION
  11. 2
      templates/explore/repos.tmpl
  12. 2
      templates/repo/issue/navbar.tmpl
  13. 132
      templates/user/profile.tmpl

2
README.md

@ -5,7 +5,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
![](public/img/gogs-large-resize.png) ![](public/img/gogs-large-resize.png)
##### Current version: 0.7.12 Beta ##### Current version: 0.7.13 Beta
<table> <table>
<tr> <tr>

7
cmd/web.go

@ -515,10 +515,13 @@ func runWeb(ctx *cli.Context) {
m.Group("", func() { m.Group("", func() {
m.Get("/releases", repo.Releases) m.Get("/releases", repo.Releases)
m.Get("/^:type(issues|pulls)$", repo.RetrieveLabels, repo.Issues) m.Get("/^:type(issues|pulls)$", repo.RetrieveLabels, repo.Issues)
m.Get("/^:type(issues|pulls)$/:index", repo.ViewIssue)
m.Get("/labels/", repo.RetrieveLabels, repo.Labels) m.Get("/labels/", repo.RetrieveLabels, repo.Labels)
m.Get("/milestones", repo.Milestones) m.Get("/milestones", repo.Milestones)
}, middleware.RepoRef()) }, middleware.RepoRef(),
func(ctx *middleware.Context) {
ctx.Data["PageIsList"] = true
})
m.Get("/^:type(issues|pulls)$/:index", repo.ViewIssue)
m.Get("/branches", repo.Branches) m.Get("/branches", repo.Branches)
m.Get("/archive/*", repo.Download) m.Get("/archive/*", repo.Download)

2
gogs.go

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.7.12.1116 Beta" const APP_VER = "0.7.13.1116 Beta"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

2
models/user.go

@ -265,7 +265,7 @@ func (u *User) UploadAvatar(data []byte) error {
return fmt.Errorf("Decode: %v", err) return fmt.Errorf("Decode: %v", err)
} }
m := resize.Resize(234, 234, img, resize.NearestNeighbor) m := resize.Resize(290, 290, img, resize.NearestNeighbor)
sess := x.NewSession() sess := x.NewSession()
defer sessionRelease(sess) defer sessionRelease(sess)

4
modules/avatar/avatar.go

@ -104,7 +104,7 @@ func New(hash string, cacheDir string) *Avatar {
expireDuration: time.Minute * 10, expireDuration: time.Minute * 10,
reqParams: url.Values{ reqParams: url.Values{
"d": {"retro"}, "d": {"retro"},
"size": {"200"}, "size": {"290"},
"r": {"pg"}}.Encode(), "r": {"pg"}}.Encode(),
imagePath: filepath.Join(cacheDir, hash+".image"), //maybe png or jpeg imagePath: filepath.Join(cacheDir, hash+".image"), //maybe png or jpeg
} }
@ -194,7 +194,7 @@ func (this *service) mustInt(r *http.Request, defaultValue int, keys ...string)
func (this *service) ServeHTTP(w http.ResponseWriter, r *http.Request) { func (this *service) ServeHTTP(w http.ResponseWriter, r *http.Request) {
urlPath := r.URL.Path urlPath := r.URL.Path
hash := urlPath[strings.LastIndex(urlPath, "/")+1:] hash := urlPath[strings.LastIndex(urlPath, "/")+1:]
size := this.mustInt(r, 80, "s", "size") // default size = 80*80 size := this.mustInt(r, 290, "s", "size") // default size = 290*290
avatar := New(hash, this.cacheDir) avatar := New(hash, this.cacheDir)
avatar.AlterImage = this.altImage avatar.AlterImage = this.altImage

34
public/css/gogs.css

@ -848,6 +848,9 @@ pre.raw {
.ui .text.yellow { .ui .text.yellow {
color: #FBBD08 !important; color: #FBBD08 !important;
} }
.ui .text.gold {
color: #a1882b !important;
}
.ui .text.left { .ui .text.left {
text-align: left !important; text-align: left !important;
} }
@ -2688,6 +2691,23 @@ footer .container .links > *:first-child {
.user.settings .email.list .item:not(:first-child) .button { .user.settings .email.list .item:not(:first-child) .button {
margin-top: -10px; margin-top: -10px;
} }
.user.profile .ui.card .username {
display: block;
}
.user.profile .ui.card .extra.content {
padding: 0;
}
.user.profile .ui.card .extra.content ul {
margin: 0;
padding: 0;
}
.user.profile .ui.card .extra.content ul li {
padding: 10px;
list-style: none;
}
.user.profile .ui.card .extra.content ul li:not(:last-child) {
border-bottom: 1px solid #eaeaea;
}
.dashboard { .dashboard {
padding-top: 15px; padding-top: 15px;
padding-bottom: 80px; padding-bottom: 80px;
@ -2820,24 +2840,26 @@ footer .container .links > *:first-child {
padding-top: 15px; padding-top: 15px;
padding-bottom: 80px; padding-bottom: 80px;
} }
.explore.repositories .ui.repository.list .item { .ui.repository.list .item {
padding-bottom: 25px;
}
.ui.repository.list .item:not(:first-child) {
border-top: 1px solid #eee; border-top: 1px solid #eee;
padding-top: 25px; padding-top: 25px;
padding-bottom: 25px;
} }
.explore.repositories .ui.repository.list .item .ui.header { .ui.repository.list .item .ui.header {
font-size: 1.5rem; font-size: 1.5rem;
padding-bottom: 10px; padding-bottom: 10px;
} }
.explore.repositories .ui.repository.list .item .ui.header .metas { .ui.repository.list .item .ui.header .metas {
color: #888; color: #888;
font-size: 13px; font-size: 13px;
font-weight: normal; font-weight: normal;
} }
.explore.repositories .ui.repository.list .item .ui.header .metas span:not(:last-child) { .ui.repository.list .item .ui.header .metas span:not(:last-child) {
margin-right: 5px; margin-right: 5px;
} }
.explore.repositories .ui.repository.list .item .time { .ui.repository.list .item .time {
font-size: 12px; font-size: 12px;
color: #808080; color: #808080;
} }

3
public/less/_base.less

@ -139,6 +139,9 @@ pre {
&.yellow { &.yellow {
color: #FBBD08 !important; color: #FBBD08 !important;
} }
&.gold {
color: #a1882b !important;
}
&.left { &.left {
text-align: left !important; text-align: left !important;

10
public/less/_explore.less

@ -1,13 +1,17 @@
.explore { .explore {
padding-top: 15px; padding-top: 15px;
padding-bottom: @footer-margin * 2; padding-bottom: @footer-margin * 2;
}
&.repositories {
.ui.repository.list { .ui.repository.list {
.item { .item {
padding-bottom: 25px;
&:not(:first-child) {
border-top: 1px solid #eee; border-top: 1px solid #eee;
padding-top: 25px; padding-top: 25px;
padding-bottom: 25px; }
.ui.header { .ui.header {
font-size: 1.5rem; font-size: 1.5rem;
padding-bottom: 10px; padding-bottom: 10px;
@ -26,5 +30,3 @@
} }
} }
} }
}
}

25
public/less/_user.less

@ -18,4 +18,29 @@
} }
} }
} }
&.profile {
.ui.card {
.username {
display: block;
}
.extra.content {
padding: 0;
ul {
margin: 0;
padding: 0;
li {
padding: 10px;
list-style: none;
&:not(:last-child) {
border-bottom: 1px solid #eaeaea;
}
}
}
}
}
}
} }

2
templates/.VERSION

@ -1 +1 @@
0.7.12.1116 Beta 0.7.13.1116 Beta

2
templates/explore/repos.tmpl

@ -5,7 +5,7 @@
{{template "explore/navbar" .}} {{template "explore/navbar" .}}
<div class="twelve wide column content"> <div class="twelve wide column content">
<div class="ui repository list"> <div class="ui repository list">
{{range $i, $v := .Repos}} {{range .Repos}}
<div class="item"> <div class="item">
<div class="ui header"> <div class="ui header">
<a href="{{AppSubUrl}}/{{.Owner.Name}}/{{.Name}}">{{.Owner.Name}} / {{.Name}}</a> <a href="{{AppSubUrl}}/{{.Owner.Name}}/{{.Name}}">{{.Owner.Name}} / {{.Name}}</a>

2
templates/repo/issue/navbar.tmpl

@ -1,5 +1,5 @@
<div class="ui compact small menu"> <div class="ui compact small menu">
{{if not .CommitsCount}} {{if not .PageIsList}}
<a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues">{{.i18n.Tr "repo.issues"}}</a> <a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues">{{.i18n.Tr "repo.issues"}}</a>
<a class="{{if .PageIsPullList}}active{{end}} item" href="{{.RepoLink}}/pulls">{{.i18n.Tr "repo.pulls"}}</a> <a class="{{if .PageIsPullList}}active{{end}} item" href="{{.RepoLink}}/pulls">{{.i18n.Tr "repo.pulls"}}</a>
{{end}} {{end}}

132
templates/user/profile.tmpl

@ -1,104 +1,86 @@
{{template "ng/base/head" .}} {{template "base/head" .}}
{{template "ng/base/header" .}} <div class="user profile">
<div class="main-wrapper"> <div class="ui container">
<div id="user-profile-page" class="container clear"> <div class="ui grid">
<div class="grid-1-5 left"> <div class="ui five wide column">
<div> <div class="ui card">
{{if and (.Owner.UseCustomAvatar) (eq .SignedUserName .Owner.Name)}} {{if and (.Owner.UseCustomAvatar) (eq .SignedUserName .Owner.Name)}}
<a href="{{AppSubUrl}}/user/settings" id="profile-avatar" original-title="{{.i18n.Tr "user.change_custom_avatar"}}"> <a class="image poping up" href="{{AppSubUrl}}/user/settings" id="profile-avatar" data-content="{{.i18n.Tr "user.change_custom_avatar"}}" data-variation="inverted tiny" data-position="bottom center">
<img src="{{.Owner.AvatarLink}}?s=290" title="{{.Owner.Name}}"/>
</a>
{{else if eq .SignedUserName .Owner.Name}} {{else if eq .SignedUserName .Owner.Name}}
<a href="http://gravatar.com/emails/" id="profile-avatar" original-title="{{.i18n.Tr "user.change_avatar"}}"> <a class="image poping up" href="http://gravatar.com/emails/" id="profile-avatar" data-content="{{.i18n.Tr "user.change_avatar"}}" data-variation="inverted tiny" data-position="bottom center">
<img src="{{.Owner.AvatarLink}}?s=290" title="{{.Owner.Name}}"/>
</a>
{{else}} {{else}}
<a id="profile-avatar"> <span class="image">
<img src="{{.Owner.AvatarLink}}?s=290" title="{{.Owner.Name}}"/>
</span>
{{end}} {{end}}
<img class="profile-avatar" src="{{.Owner.AvatarLink}}?s=234" title="{{.Owner.Name}}"/> <div class="content">
</a> {{if .Owner.FullName}}<span class="header text center">{{.Owner.FullName}}</span>{{end}}
<div class="text-center" id="profile-name"> <span class="username text center">{{.Owner.Name}}</span>
{{if .Owner.FullName}}<span id="profile-fullname" class="center-block">{{.Owner.FullName}}</span><br>{{end}}
<span class="center-block" id="profile-username">{{.Owner.Name}}</span>
</div> </div>
</div> <div class="extra content">
<div class="profile-info"> <ul class="text black">
<hr>
<ul class="list-no-style">
{{if .Owner.Location}} {{if .Owner.Location}}
<li class="list-group-item"><i class="octicon octicon-location"></i>&nbsp;&nbsp;{{.Owner.Location}}</li> <li><i class="icon octicon octicon-location"></i> {{.Owner.Location}}</li>
{{end}} {{end}}
{{if and .Owner.Email .IsSigned}} {{if and .Owner.Email .IsSigned}}
<li class="list-group-item"><i class="octicon octicon-mail"></i>&nbsp;&nbsp;<a href="mailto:{{.Owner.Email}}" rel="nofollow">{{.Owner.Email}}</a></li> <li>
<i class="icon octicon octicon-mail"></i>
<a href="mailto:{{.Owner.Email}}" rel="nofollow">{{.Owner.Email}}</a>
</li>
{{end}} {{end}}
{{if .Owner.Website}} {{if .Owner.Website}}
<li class="list-group-item"><i class="octicon octicon-link"></i>&nbsp;&nbsp;<a target="_blank" href="{{.Owner.Website}}">{{.Owner.Website}}</a></li> <li>
<i class="icon octicon octicon-link"></i>
<a target="_blank" href="{{.Owner.Website}}">{{.Owner.Website}}</a>
</li>
{{end}} {{end}}
<li class="list-group-item"><i class="octicon octicon-clock"></i>&nbsp;&nbsp;{{.i18n.Tr "user.join_on"}} {{DateFmtShort .Owner.Created}}</li> <li><i class="icon octicon octicon-clock"></i> {{.i18n.Tr "user.join_on"}} {{DateFmtShort .Owner.Created}}</li>
</ul> </ul>
<hr> </div>
<ul class="list-no-style"> </div>
<li class="list-group-item profile-rel"> </div>
<a class="text-black" href=""> <div class="ui eleven wide column">
<strong>{{.Owner.NumFollowers}}</strong> <div class="ui secondary pointing menu">
<p>{{.i18n.Tr "user.followers"}}</p> <a class="{{if ne .TabName "activity"}}active{{end}} item" href="{{.Owner.HomeLink}}">
<i class="icon octicon octicon-repo"></i> {{.i18n.Tr "user.repositories"}}
</a> </a>
</li> <a class="item">
<li class="list-group-item profile-rel"> <a class="{{if eq .TabName "activity"}}active{{end}} item" href="{{.Owner.HomeLink}}?tab=activity">
<a class="text-black" href=""> <i class="icon octicon octicon-rss"></i> {{.i18n.Tr "user.activity"}}
<strong>{{.Owner.NumStars}}</strong>
<p>{{.i18n.Tr "user.starred"}}</p>
</a> </a>
</li>
<li class="list-group-item profile-rel">
<a class="text-black" href="">
<strong>{{.Owner.NumFollowings}}</strong>
<p>{{.i18n.Tr "user.following"}}</p>
</a> </a>
</li>
</ul>
<hr>
</div>
</div>
<div class="grid-4-5 left">
<div id="profile-body">
<ul class="menu menu-line" id="profile-header">
<li>
<a {{if not .TabName}}class="current"{{end}} href="{{.Owner.HomeLink}}"><i class="octicon octicon-repo"></i> {{.i18n.Tr "user.repositories"}}</a>
</li>
<li>
<a {{if eq .TabName "activity"}}class="current"{{end}} href="{{.Owner.HomeLink}}?tab=activity"><i class="octicon octicon-repo"></i> {{.i18n.Tr "user.activity"}}</a>
</li>
</ul>
<div class="tab-content">
{{if eq .TabName "activity"}}
<div class="tab-pane active" id="dashboard-news">
<br>
{{template "user/dashboard/feeds" .}}
</div> </div>
{{else}} {{if ne .TabName "activity"}}
<div class="tab-pane active"> <div class="ui repository list">
<div id="org-repo-list">
{{range .Repos}} {{range .Repos}}
{{if or (not .IsPrivate) (.HasAccess $.SignedUser)}} {{if or (not .IsPrivate) (.HasAccess $.SignedUser)}}
<div class="org-repo-item"> <div class="item">
<ul class="org-repo-status right"> <div class="ui header">
<li><i class="octicon octicon-star"></i> {{.NumStars}}</li>
<li><i class="octicon octicon-git-branch"></i> {{.NumForks}}</li>
</ul>
<h2>
<a href="{{AppSubUrl}}/{{$.Owner.Name}}/{{.Name}}">{{.Name}}</a> <a href="{{AppSubUrl}}/{{$.Owner.Name}}/{{.Name}}">{{.Name}}</a>
{{if .IsPrivate}} {{if .IsPrivate}}
<span class="text-gold"><i class="octicon octicon-lock"></i></span> <span class="text gold"><i class="icon octicon octicon-lock"></i></span>
{{end}} {{end}}
</h2>
<p class="org-repo-description">{{.Description}}</p> <div class="ui right metas">
<p class="org-repo-updated">{{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Updated $.i18n.Lang}}</p> <span class="text grey"><i class="octicon octicon-star"></i> {{.NumStars}}</span>
<span class="text grey"><i class="octicon octicon-git-branch"></i> {{.NumForks}}</span>
</div> </div>
{{end}}
{{end}}
</div> </div>
{{if .Description}}<p>{{.Description}}</p>{{end}}
<p class="time">{{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Updated $.i18n.Lang}}</p>
</div> </div>
{{end}} {{end}}
{{end}}
</div> </div>
{{else}}
<br>
{{template "user/dashboard/feeds" .}}
{{end}}
</div> </div>
</div> </div>
</div> </div>
</div> {{template "base/footer" .}}
{{template "ng/base/footer" .}}
Loading…
Cancel
Save