diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | gogs.go | 2 | ||||
-rw-r--r-- | models/action.go | 40 | ||||
-rw-r--r-- | models/user.go | 7 | ||||
-rw-r--r-- | modules/base/tool.go | 9 | ||||
-rwxr-xr-x | public/css/gogs.css | 15 | ||||
-rw-r--r-- | public/less/_dashboard.less | 18 | ||||
-rw-r--r-- | public/less/_explore.less | 5 | ||||
-rw-r--r-- | templates/.VERSION | 2 | ||||
-rw-r--r-- | templates/explore/repo_list.tmpl | 2 | ||||
-rw-r--r-- | templates/user/dashboard/dashboard.tmpl | 18 | ||||
-rw-r--r-- | templates/user/dashboard/feeds.tmpl | 2 |
12 files changed, 89 insertions, 33 deletions
@@ -3,7 +3,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra ![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true) -##### Current version: 0.8.19 +##### Current version: 0.8.20 | Web | UI | Preview | |:-------------:|:-------:|:-------:| @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.8.19.0111" +const APP_VER = "0.8.20.0111" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/models/action.go b/models/action.go index 9ecf67b4b6..4e5f461a36 100644 --- a/models/action.go +++ b/models/action.go @@ -90,54 +90,66 @@ func (a *Action) AfterSet(colName string, _ xorm.Cell) { } } -func (a Action) GetOpType() int { +func (a *Action) GetOpType() int { return int(a.OpType) } -func (a Action) GetActUserName() string { +func (a *Action) GetActUserName() string { return a.ActUserName } -func (a Action) GetActEmail() string { +func (a *Action) ShortActUserName() string { + return base.EllipsisString(a.ActUserName, 20) +} + +func (a *Action) GetActEmail() string { return a.ActEmail } -func (a Action) GetRepoUserName() string { +func (a *Action) GetRepoUserName() string { return a.RepoUserName } -func (a Action) GetRepoName() string { +func (a *Action) ShortRepoUserName() string { + return base.EllipsisString(a.RepoUserName, 20) +} + +func (a *Action) GetRepoName() string { return a.RepoName } -func (a Action) GetRepoPath() string { - return path.Join(a.RepoUserName, a.RepoName) +func (a *Action) ShortRepoName() string { + return base.EllipsisString(a.RepoName, 33) +} + +func (a *Action) GetRepoPath() string { + return path.Join(a.ShortRepoUserName(), a.ShortRepoName()) } -func (a Action) GetRepoLink() string { +func (a *Action) GetRepoLink() string { if len(setting.AppSubUrl) > 0 { return path.Join(setting.AppSubUrl, a.GetRepoPath()) } return "/" + a.GetRepoPath() } -func (a Action) GetBranch() string { +func (a *Action) GetBranch() string { return a.RefName } -func (a Action) GetContent() string { +func (a *Action) GetContent() string { return a.Content } -func (a Action) GetCreate() time.Time { +func (a *Action) GetCreate() time.Time { return a.Created } -func (a Action) GetIssueInfos() []string { +func (a *Action) GetIssueInfos() []string { return strings.SplitN(a.Content, "|", 2) } -func (a Action) GetIssueTitle() string { +func (a *Action) GetIssueTitle() string { index := com.StrTo(a.GetIssueInfos()[0]).MustInt64() issue, err := GetIssueByIndex(a.RepoID, index) if err != nil { @@ -147,7 +159,7 @@ func (a Action) GetIssueTitle() string { return issue.Name } -func (a Action) GetIssueContent() string { +func (a *Action) GetIssueContent() string { index := com.StrTo(a.GetIssueInfos()[0]).MustInt64() issue, err := GetIssueByIndex(a.RepoID, index) if err != nil { diff --git a/models/user.go b/models/user.go index f648a8abcf..5c43a23a2f 100644 --- a/models/user.go +++ b/models/user.go @@ -429,13 +429,8 @@ func (u *User) DisplayName() string { return u.Name } -// ShortName returns shorted user name with given maximum length, -// it adds "..." at the end if user name has more length than maximum. func (u *User) ShortName(length int) string { - if len(u.Name) < length { - return u.Name - } - return u.Name[:length] + "..." + return base.EllipsisString(u.Name, length) } // IsUserExist checks if given user name exist, diff --git a/modules/base/tool.go b/modules/base/tool.go index 255c34ef5a..6bfd912d32 100644 --- a/modules/base/tool.go +++ b/modules/base/tool.go @@ -453,6 +453,15 @@ func Subtract(left interface{}, right interface{}) interface{} { } } +// EllipsisString returns a truncated short string, +// it appends '...' in the end of the length of string is too large. +func EllipsisString(str string, length int) string { + if len(str) < length { + return str + } + return str[:length-3] + "..." +} + // StringsToInt64s converts a slice of string to a slice of int64. func StringsToInt64s(strs []string) []int64 { ints := make([]int64, len(strs)) diff --git a/public/css/gogs.css b/public/css/gogs.css index b6d2616586..452d4a19a5 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -3057,6 +3057,18 @@ footer .container .links > *:first-child { margin-right: 6px; color: #888; } +.feeds .list .repo-owner-name-list .item-name { + max-width: 70%; + margin-bottom: -4px; +} +.feeds .list #collaborative-repo-list .owner-and-repo { + max-width: 80%; + margin-bottom: -5px; +} +.feeds .list #collaborative-repo-list .owner-name { + max-width: 120px; + margin-bottom: -5px; +} .admin { padding-top: 15px; padding-bottom: 80px; @@ -3117,6 +3129,9 @@ footer .container .links > *:first-child { font-size: 1.5rem; padding-bottom: 10px; } +.ui.repository.list .item .ui.header .name { + word-break: break-all; +} .ui.repository.list .item .ui.header .metas { color: #888; font-size: 13px; diff --git a/public/less/_dashboard.less b/public/less/_dashboard.less index 6f4fbb196b..f194dc1282 100644 --- a/public/less/_dashboard.less +++ b/public/less/_dashboard.less @@ -123,5 +123,23 @@ } } } + + .repo-owner-name-list { + .item-name { + max-width: 70%; + margin-bottom: -4px; + } + } + + #collaborative-repo-list { + .owner-and-repo { + max-width: 80%; + margin-bottom: -5px; + } + .owner-name { + max-width: 120px; + margin-bottom: -5px; + } + } } } diff --git a/public/less/_explore.less b/public/less/_explore.less index 53a6b5a46c..5141d49928 100644 --- a/public/less/_explore.less +++ b/public/less/_explore.less @@ -15,6 +15,11 @@ .ui.header { font-size: 1.5rem; padding-bottom: 10px; + + .name { + word-break: break-all; + } + .metas { color: #888; font-size: 13px; diff --git a/templates/.VERSION b/templates/.VERSION index f1eb383c3e..4295f9db1e 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.8.19.0111
\ No newline at end of file +0.8.20.0111
\ No newline at end of file diff --git a/templates/explore/repo_list.tmpl b/templates/explore/repo_list.tmpl index a674bcc90a..f8dff62869 100644 --- a/templates/explore/repo_list.tmpl +++ b/templates/explore/repo_list.tmpl @@ -2,7 +2,7 @@ {{range .Repos}} <div class="item"> <div class="ui header"> - <a href="{{AppSubUrl}}/{{if .Owner}}{{.Owner.Name}}{{else if $.Org}}{{$.Org.Name}}{{else}}{{$.Owner.Name}}{{end}}/{{.Name}}">{{if $.PageIsExplore}}{{.Owner.Name}} / {{end}}{{.Name}}</a> + <a class="name" href="{{AppSubUrl}}/{{if .Owner}}{{.Owner.Name}}{{else if $.Org}}{{$.Org.Name}}{{else}}{{$.Owner.Name}}{{end}}/{{.Name}}">{{if $.PageIsExplore}}{{.Owner.Name}} / {{end}}{{.Name}}</a> {{if .IsPrivate}} <span class="text gold"><i class="icon octicon octicon-lock"></i></span> {{else if .IsFork}} diff --git a/templates/user/dashboard/dashboard.tmpl b/templates/user/dashboard/dashboard.tmpl index 86936efa68..109b0bbe7d 100644 --- a/templates/user/dashboard/dashboard.tmpl +++ b/templates/user/dashboard/dashboard.tmpl @@ -22,12 +22,12 @@ </div> </h4> <div class="ui attached table segment"> - <ul> + <ul class="repo-owner-name-list"> {{range .Repos}} <li {{if .IsPrivate}}class="private"{{end}}> <a href="{{AppSubUrl}}/{{$.ContextUser.Name}}/{{.Name}}"> <i class="icon octicon octicon-{{if .IsPrivate}}lock{{else if .IsFork}}repo-forked{{else if .IsMirror}}repo-clone{{else}}repo{{end}}"></i> - <strong>{{.Name}}</strong> + <strong class="text truncate item-name">{{.Name}}</strong> <span class="ui right text light grey"> <i class="octicon octicon-star"></i>{{.NumStars}} </span> @@ -42,12 +42,14 @@ {{.i18n.Tr "home.collaborative_repos"}} <span class="ui grey label">{{.CollaborateCount}}</span> </h4> <div class="ui attached table segment"> - <ul> + <ul id="collaborative-repo-list"> {{range .CollaborativeRepos}} <li {{if .IsPrivate}}class="private"{{end}}> <a href="{{AppSubUrl}}/{{.Owner.Name}}/{{.Name}}"> <i class="icon octicon octicon-{{if .IsPrivate}}lock{{else if .IsFork}}repo-forked{{else if .IsMirror}}repo-clone{{else}}repo{{end}}"></i> - {{.Owner.Name}} / <strong>{{.Name}}</strong> + <span class="text truncate owner-and-repo"> + <span class="text truncate owner-name">{{.Owner.Name}}</span> / <strong>{{.Name}}</strong> + </span> <span class="ui right text light grey"> <i class="octicon octicon-star"></i>{{.NumStars}} </span> @@ -68,12 +70,12 @@ </div> </h4> <div class="ui attached table segment"> - <ul> + <ul class="repo-owner-name-list"> {{range .ContextUser.Orgs}} <li> <a href="{{AppSubUrl}}/{{.Name}}"> <i class="icon octicon octicon-organization"></i> - <strong>{{.ShortName 20}}</strong> + <strong class="text truncate item-name">{{.Name}}</strong> <span class="ui right text light grey"> <i class="octicon octicon-repo"></i>{{.NumRepos}} </span> @@ -93,12 +95,12 @@ </div> </h4> <div class="ui attached table segment"> - <ul> + <ul class="repo-owner-name-list"> {{range .Mirrors}} <li {{if .IsPrivate}}class="private"{{end}}> <a href="{{AppSubUrl}}/{{$.ContextUser.Name}}/{{.Name}}"> <i class="icon octicon octicon-repo-clone"></i> - <strong>{{.Name}}</strong> + <strong class="text truncate item-name">{{.Name}}</strong> <span class="ui right text light grey"> <i class="octicon octicon-sync"></i>{{.Interval}}H </span> diff --git a/templates/user/dashboard/feeds.tmpl b/templates/user/dashboard/feeds.tmpl index 9228fab661..ac68ea6922 100644 --- a/templates/user/dashboard/feeds.tmpl +++ b/templates/user/dashboard/feeds.tmpl @@ -7,7 +7,7 @@ <div class="ui fifteen wide column"> <div class="{{if eq .GetOpType 5}}push news{{end}}"> <p> - <a href="{{AppSubUrl}}/{{.GetActUserName}}">{{.GetActUserName}}</a> + <a href="{{AppSubUrl}}/{{.GetActUserName}}">{{.ShortActUserName}}</a> {{if eq .GetOpType 1}} {{$.i18n.Tr "action.create_repo" .GetRepoLink .GetRepoPath | Str2html}} {{else if eq .GetOpType 2}} |